feat(bridge): Add discord
This commit is contained in:
parent
03a167a13f
commit
62b57c19f9
@ -3,8 +3,8 @@
|
|||||||
## Bridges
|
## Bridges
|
||||||
|
|
||||||
- [x] Signal
|
- [x] Signal
|
||||||
- [ ] Telegram
|
- [x] Telegram
|
||||||
- [x] Facebook Messenger
|
- [x] Facebook Messenger
|
||||||
- [x] WhatsApp
|
- [x] WhatsApp
|
||||||
- [x] Instagram
|
- [x] Instagram
|
||||||
- [ ] Discord
|
- [x] Discord
|
||||||
|
14
manifests/bridges/discord/create_db.sh
Normal file
14
manifests/bridges/discord/create_db.sh
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Checking if $DISCORD_DB database exists..."
|
||||||
|
|
||||||
|
if psql -lqt | cut -d \| -f 1 | grep -qw $DISCORD_DB; then
|
||||||
|
echo "Database exists, skipping creation"
|
||||||
|
else
|
||||||
|
echo "Database does not exist, creating..."
|
||||||
|
createdb $DISCORD_DB
|
||||||
|
createuser $DISCORD_USER
|
||||||
|
psql -c "ALTER USER $DISCORD_USER WITH ENCRYPTED PASSWORD '$DISCORD_PASSWORD';"
|
||||||
|
psql -c "GRANT ALL PRIVILEGES ON DATABASE $DISCORD_DB TO $DISCORD_USER;"
|
||||||
|
psql -c "ALTER DATABASE $DISCORD_DB OWNER TO $DISCORD_USER;"
|
||||||
|
fi
|
46
manifests/bridges/discord/job.yaml
Normal file
46
manifests/bridges/discord/job.yaml
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
apiVersion: batch/v1
|
||||||
|
kind: Job
|
||||||
|
metadata:
|
||||||
|
name: discord-db-init
|
||||||
|
namespace: synapse
|
||||||
|
spec:
|
||||||
|
template:
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: discord-db-init
|
||||||
|
image: postgres:15.10
|
||||||
|
command: ["/bin/bash", "/data/create_db.sh"]
|
||||||
|
env:
|
||||||
|
- name: PGHOST
|
||||||
|
value: synapse-db-rw.synapse.svc.cluster.local
|
||||||
|
- name: PGUSER
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: synapse-db-superuser
|
||||||
|
key: username
|
||||||
|
- name: PGPASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: synapse-db-superuser
|
||||||
|
key: password
|
||||||
|
- name: DISCORD_USER
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: mautrix-discord-db
|
||||||
|
key: username
|
||||||
|
- name: DISCORD_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: mautrix-discord-db
|
||||||
|
key: password
|
||||||
|
- name: DISCORD_DB
|
||||||
|
value: discord
|
||||||
|
volumeMounts:
|
||||||
|
- name: create-db
|
||||||
|
mountPath: /data
|
||||||
|
volumes:
|
||||||
|
- name: create-db
|
||||||
|
configMap:
|
||||||
|
name: discord-db-creation
|
||||||
|
restartPolicy: Never
|
||||||
|
backoffLimit: 4
|
18
manifests/bridges/discord/kustomization.yaml
Normal file
18
manifests/bridges/discord/kustomization.yaml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
namespace: synapse
|
||||||
|
|
||||||
|
resources:
|
||||||
|
- service.yaml
|
||||||
|
- statefulset.yaml
|
||||||
|
- job.yaml
|
||||||
|
|
||||||
|
generatorOptions:
|
||||||
|
labels:
|
||||||
|
app: discord
|
||||||
|
|
||||||
|
configMapGenerator:
|
||||||
|
- name: discord-db-creation
|
||||||
|
behavior: create
|
||||||
|
files:
|
||||||
|
- create_db.sh
|
16
manifests/bridges/discord/service.yaml
Normal file
16
manifests/bridges/discord/service.yaml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: discord
|
||||||
|
namespace: synapse
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: discord
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
port: 29334
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: 29334
|
||||||
|
selector:
|
||||||
|
app: discord
|
||||||
|
publishNotReadyAddresses: true
|
36
manifests/bridges/discord/statefulset.yaml
Normal file
36
manifests/bridges/discord/statefulset.yaml
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: StatefulSet
|
||||||
|
metadata:
|
||||||
|
name: discord
|
||||||
|
namespace: synapse
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: discord
|
||||||
|
serviceName: discord
|
||||||
|
replicas: 1
|
||||||
|
minReadySeconds: 10
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: discord
|
||||||
|
spec:
|
||||||
|
terminationGracePeriodSeconds: 10
|
||||||
|
containers:
|
||||||
|
- name: discord
|
||||||
|
image: dock.mau.dev/mautrix/discord:v0.7.1
|
||||||
|
command: [
|
||||||
|
"/usr/bin/mautrix-discord",
|
||||||
|
"--config", "/data/config.yaml",
|
||||||
|
"--no-update",
|
||||||
|
]
|
||||||
|
ports:
|
||||||
|
- containerPort: 29328
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: "/data/config.yaml"
|
||||||
|
name: discord-config-file
|
||||||
|
subPath: config.yaml
|
||||||
|
volumes:
|
||||||
|
- name: discord-config-file
|
||||||
|
secret:
|
||||||
|
secretName: discord-secret-config
|
@ -4,6 +4,7 @@ kind: Kustomization
|
|||||||
resources:
|
resources:
|
||||||
- ./signal
|
- ./signal
|
||||||
- ./telegram
|
- ./telegram
|
||||||
|
- ./discord
|
||||||
- ./messenger
|
- ./messenger
|
||||||
- ./instagram
|
- ./instagram
|
||||||
- ./whatsapp
|
- ./whatsapp
|
||||||
|
@ -39,6 +39,9 @@ spec:
|
|||||||
- mountPath: "/data/telegram.yaml"
|
- mountPath: "/data/telegram.yaml"
|
||||||
name: telegram-secret-registration
|
name: telegram-secret-registration
|
||||||
subPath: telegram.yaml
|
subPath: telegram.yaml
|
||||||
|
- mountPath: "/data/discord.yaml"
|
||||||
|
name: discord-secret-registration
|
||||||
|
subPath: discord.yaml
|
||||||
- mountPath: "/data/messenger.yaml"
|
- mountPath: "/data/messenger.yaml"
|
||||||
name: messenger-secret-registration
|
name: messenger-secret-registration
|
||||||
subPath: messenger.yaml
|
subPath: messenger.yaml
|
||||||
@ -67,6 +70,9 @@ spec:
|
|||||||
- name: telegram-secret-registration
|
- name: telegram-secret-registration
|
||||||
secret:
|
secret:
|
||||||
secretName: telegram-secret-registration
|
secretName: telegram-secret-registration
|
||||||
|
- name: discord-secret-registration
|
||||||
|
secret:
|
||||||
|
secretName: discord-secret-registration
|
||||||
- name: messenger-secret-registration
|
- name: messenger-secret-registration
|
||||||
secret:
|
secret:
|
||||||
secretName: messenger-secret-registration
|
secretName: messenger-secret-registration
|
||||||
|
Loading…
Reference in New Issue
Block a user