Last active
November 11, 2024 02:50
-
-
Save dvcrn/14f698d6b5a7fe290e8ac591d11e268f to your computer and use it in GitHub Desktop.
Beeper Bridge K8s
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# you don't really need Kustomize here but it's convenient | |
# I mainly use it for the configMapGenerator, basically turnint the file at my local drive under config/facebook.yml (bridge config) | |
# into a kubernetes config map that then gets mounted into the statefulset | |
resources: | |
- pvc.yml | |
- statefulset.yml | |
- svc.yml | |
configMapGenerator: | |
- name: matrix-facebook-config | |
files: | |
- config.yaml=config/facebook.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this is specific to vultr, but any kubernetes provider has some way of getting storage mounted | |
# this config file is telling kubernetes to allocate a new storage volume with 10gb, with storage class 'vultr-block-storage-retain' | |
# Vultr (my hosting provider) is then creating a new 10gb drive and mounts it to the pod | |
# ('retain' here means that it stays around even if I delete the entire statefulset) | |
--- | |
apiVersion: v1 | |
kind: PersistentVolumeClaim | |
metadata: | |
name: matrix-bridge-pvc | |
spec: | |
accessModes: | |
- ReadWriteOnce | |
resources: | |
requests: | |
storage: 10Gi | |
storageClassName: vultr-block-storage-retain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: apps/v1 | |
kind: StatefulSet | |
metadata: | |
name: conduwuit-facebook | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: conduwuit-facebook | |
template: | |
metadata: | |
labels: | |
app: conduwuit-facebook | |
spec: | |
containers: | |
- name: conduwuit-facebook | |
imagePullPolicy: Always | |
image: dvcrn/matrix-meta-nodelete:latest # <- this is the docker image of what to pull | |
command: ["mautrix-meta", "-c", "/config/config.yaml", "--no-update"] # <- how to start the container, with custom config path | |
env: | |
- name: "TZ" | |
- name: "DB_DIR" | |
value: "/data" | |
volumeMounts: | |
# this volume mount here is the persistent volume, aka storage | |
# this is for the bridge to store stuff like database and what not | |
# basically anything that needs to be persisted | |
- name: "matrix-bridge-pvc" | |
mountPath: "/data" | |
subPath: "facebook-bridge-conduwuit" # <- I personally run multiple bridges on the same storage, so I use subpath to separate them | |
- name: config | |
mountPath: /config | |
resources: | |
requests: | |
cpu: "0" | |
memory: "0Mi" | |
limits: | |
cpu: "0" | |
memory: "0Mi" | |
volumes: | |
# this is telling to mount the pvc 'matrix-bridge-pvc' | |
- name: matrix-bridge-pvc | |
persistentVolumeClaim: | |
claimName: matrix-bridge-pvc | |
readOnly: false | |
# this is a virtual volume, basically we just turn the static yaml config file into a 'volume' | |
# then mount it under /config (see above) | |
- name: config | |
projected: | |
sources: | |
- configMap: | |
name: matrix-facebook-config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this is the service for internal routing. it's not needed for beeper because beeper supports websockets | |
# but since I'm using my own matrix server, the server itself has to somehow communicate with the bridge | |
# The bridge listens on port 29319 and I use that to expose the correct port, so that the matrix server can call the bridge directly | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: conduwuit-facebook | |
spec: | |
selector: | |
app: conduwuit-facebook | |
ports: | |
- port: 29319 | |
targetPort: 29319 | |
name: bridge |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example of using bbctl instead of bridge container: