feat(bridge): Add instagram
This commit is contained in:
parent
3a035e3927
commit
b7beefd92e
14
manifests/bridges/instagram/create_db.sh
Normal file
14
manifests/bridges/instagram/create_db.sh
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Checking if $INSTAGRAM_DB database exists..."
|
||||||
|
|
||||||
|
if psql -lqt | cut -d \| -f 1 | grep -qw $INSTAGRAM_DB; then
|
||||||
|
echo "Database exists, skipping creation"
|
||||||
|
else
|
||||||
|
echo "Database does not exist, creating..."
|
||||||
|
createdb $INSTAGRAM_DB
|
||||||
|
createuser $INSTAGRAM_USER
|
||||||
|
psql -c "ALTER USER $INSTAGRAM_USER WITH ENCRYPTED PASSWORD '$INSTAGRAM_PASSWORD';"
|
||||||
|
psql -c "GRANT ALL PRIVILEGES ON DATABASE $INSTAGRAM_DB TO $INSTAGRAM_USER;"
|
||||||
|
psql -c "ALTER DATABASE $INSTAGRAM_DB OWNER TO $INSTAGRAM_USER;"
|
||||||
|
fi
|
46
manifests/bridges/instagram/job.yaml
Normal file
46
manifests/bridges/instagram/job.yaml
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
apiVersion: batch/v1
|
||||||
|
kind: Job
|
||||||
|
metadata:
|
||||||
|
name: instagram-db-init
|
||||||
|
namespace: synapse
|
||||||
|
spec:
|
||||||
|
template:
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: instagram-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: INSTAGRAM_USER
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: mautrix-instagram-db
|
||||||
|
key: username
|
||||||
|
- name: INSTAGRAM_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: mautrix-instagram-db
|
||||||
|
key: password
|
||||||
|
- name: INSTAGRAM_DB
|
||||||
|
value: instagram
|
||||||
|
volumeMounts:
|
||||||
|
- name: create-db
|
||||||
|
mountPath: /data
|
||||||
|
volumes:
|
||||||
|
- name: create-db
|
||||||
|
configMap:
|
||||||
|
name: instagram-db-creation
|
||||||
|
restartPolicy: Never
|
||||||
|
backoffLimit: 4
|
18
manifests/bridges/instagram/kustomization.yaml
Normal file
18
manifests/bridges/instagram/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: instagram
|
||||||
|
|
||||||
|
configMapGenerator:
|
||||||
|
- name: instagram-db-creation
|
||||||
|
behavior: create
|
||||||
|
files:
|
||||||
|
- create_db.sh
|
16
manifests/bridges/instagram/service.yaml
Normal file
16
manifests/bridges/instagram/service.yaml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: instagram
|
||||||
|
namespace: synapse
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: instagram
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
port: 29319
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: 29319
|
||||||
|
selector:
|
||||||
|
app: instagram
|
||||||
|
publishNotReadyAddresses: true
|
36
manifests/bridges/instagram/statefulset.yaml
Normal file
36
manifests/bridges/instagram/statefulset.yaml
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: StatefulSet
|
||||||
|
metadata:
|
||||||
|
name: instagram
|
||||||
|
namespace: synapse
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: instagram
|
||||||
|
serviceName: instagram
|
||||||
|
replicas: 1
|
||||||
|
minReadySeconds: 10
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: instagram
|
||||||
|
spec:
|
||||||
|
terminationGracePeriodSeconds: 10
|
||||||
|
containers:
|
||||||
|
- name: instagram
|
||||||
|
image: dock.mau.dev/mautrix/meta:v0.4.2
|
||||||
|
command: [
|
||||||
|
"/usr/bin/mautrix-meta",
|
||||||
|
"--config", "/data/config.yaml",
|
||||||
|
"--no-update",
|
||||||
|
]
|
||||||
|
ports:
|
||||||
|
- containerPort: 29328
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: "/data/config.yaml"
|
||||||
|
name: instagram-config-file
|
||||||
|
subPath: config.yaml
|
||||||
|
volumes:
|
||||||
|
- name: instagram-config-file
|
||||||
|
secret:
|
||||||
|
secretName: instagram-secret-config
|
@ -4,3 +4,4 @@ kind: Kustomization
|
|||||||
resources:
|
resources:
|
||||||
- ./signal
|
- ./signal
|
||||||
- ./messenger
|
- ./messenger
|
||||||
|
- ./instagram
|
||||||
|
@ -39,6 +39,9 @@ spec:
|
|||||||
- mountPath: "/data/messenger.yaml"
|
- mountPath: "/data/messenger.yaml"
|
||||||
name: messenger-secret-registration
|
name: messenger-secret-registration
|
||||||
subPath: messenger.yaml
|
subPath: messenger.yaml
|
||||||
|
- mountPath: "/data/instagram.yaml"
|
||||||
|
name: instagram-secret-registration
|
||||||
|
subPath: instagram.yaml
|
||||||
volumes:
|
volumes:
|
||||||
- name: synapse-data
|
- name: synapse-data
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
@ -58,3 +61,6 @@ spec:
|
|||||||
- name: messenger-secret-registration
|
- name: messenger-secret-registration
|
||||||
secret:
|
secret:
|
||||||
secretName: messenger-secret-registration
|
secretName: messenger-secret-registration
|
||||||
|
- name: instagram-secret-registration
|
||||||
|
secret:
|
||||||
|
secretName: instagram-secret-registration
|
||||||
|
Loading…
Reference in New Issue
Block a user