Skip to content

Instantly share code, notes, and snippets.

@holysoles
Created February 1, 2025 19:47
Show Gist options
  • Select an option

  • Save holysoles/b67e186abcc10b27866a176094bd7f1e to your computer and use it in GitHub Desktop.

Select an option

Save holysoles/b67e186abcc10b27866a176094bd7f1e to your computer and use it in GitHub Desktop.
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: imessage-bridge
name: imessage-bridge
spec:
selector:
matchLabels:
app: imessage-bridge
template:
metadata:
labels:
app: imessage-bridge
spec:
containers:
- image: ghcr.io/beeper/bridge-manager:latest
imagePullPolicy: Always
name: imessage-bridge
env:
- name: MATRIX_ACCESS_TOKEN
valueFrom:
secretKeyRef:
name: beeper-secret
key: access-token
- name: BRIDGE_NAME
value: sh-imessage
volumeMounts:
- name: beeper-data
subPath: "beeper-bridges/imessage"
mountPath: "/data"
command:
- /bin/bash
- -c
- |
set -euf -o pipefail
if [[ -z "${BRIDGE_NAME:-}" ]]; then
if [[ ! -z "$1" ]]; then
export BRIDGE_NAME="$1"
else
echo "BRIDGE_NAME not set"
exit 1
fi
fi
export BBCTL_CONFIG=${BBCTL_CONFIG:-/tmp/bbctl.json}
export BEEPER_ENV=${BEEPER_ENV:-prod}
if [[ ! -f $BBCTL_CONFIG ]]; then
if [[ -z "$MATRIX_ACCESS_TOKEN" ]]; then
echo "MATRIX_ACCESS_TOKEN not set"
exit 1
fi
export DATA_DIR=${DATA_DIR:-/data}
if [[ ! -d $DATA_DIR ]]; then
echo "DATA_DIR ($DATA_DIR) does not exist, creating"
mkdir -p $DATA_DIR
fi
export DB_DIR=${DB_DIR:-/data/db}
mkdir -p $DB_DIR
jq -n '{environments: {"\(env.BEEPER_ENV)": {access_token: env.MATRIX_ACCESS_TOKEN, database_dir: env.DB_DIR, bridge_data_dir: env.DATA_DIR}}}' > $BBCTL_CONFIG
fi
bbctl -e $BEEPER_ENV run --param 'bluebubbles_url=http://<blue bubbles server FQDN>:1234' --param 'bluebubbles_password=<password>' --param 'imessage_platform=bluebubbles' $BRIDGE_NAME
volumes:
- name: beeper-data
nfs:
server: <nfs server>
path: /mnt/tank/k8s-storage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment