Files
wild-directory/mastodon/versions/4/db-init-job.yaml
Paul Payne e25b07126c Bump 33 apps to latest upstream versions
Patch/minor bumps:
- akaunting: 3.1.21 -> 3.2.3
- aptly: 1.6.2 -> 1.6.3
- baserow: 2.2.2 -> 2.4.1
- crowdsec: v1.7.8 -> v1.8.1
- docker-registry: 3.0.0 -> 3.1.2
- etherpad: 2.2.7 -> 2.6.1
- headlamp: v0.42.0 -> v0.46.0
- headscale: 0.29.1 -> 0.29.5
- indico: 3.3.12 -> 3.3.14
- karrot: v17.4.1 -> v17.4.2
- keila: 0.17.1 -> 0.30.3
- lemmy: 0.19.15 -> 0.19.19
- loomio: 3.0.24 -> 3.12.0
- mastodon: 4.5.3 -> 4.7.3
- mautic: 7.1.2 -> 7.2.1
- memcached: 1.6.32 -> 1.6.45
- mobilizon: 5.2.3 -> 5.2.4
- nocodb: 2026.04.1 -> 2026.09.1
- open-webui: 0.9.5 -> 0.12.3
- outline: 1.8.1 -> 1.11.0
- peertube: 8.2.1 -> 8.2.4
- pixelfed: 0.12.7 -> 0.15.1
- pretix: 2026.5.1 -> 2026.8.0
- synapse: v1.144.0 -> v1.163.0
- traefik: v3.4.1 -> v3.7.16
- typebot: 3.17.1 -> 3.19.1
- vaultwarden: 1.37.1 -> 1.37.4
- writefreely: 0.15.1 -> 0.17.2

Multi-file updates for apps with workers/sidekiq/streaming:
- mastodon (5 files), indico (3 files), karrot (4 files),
  lemmy (2 files), loomio (2 files), typebot (2 files),
  pixelfed (2 files), synapse (2 refs), pretix (2 refs),
  aptly (2 refs)
2026-10-23 14:02:09 +00:00

186 lines
5.2 KiB
YAML

apiVersion: batch/v1
kind: Job
metadata:
name: mastodon-db-init
namespace: {{ .namespace }}
spec:
ttlSecondsAfterFinished: 300
template:
metadata:
labels:
component: db-init
spec:
restartPolicy: OnFailure
securityContext:
runAsUser: 999
runAsGroup: 999
fsGroup: 999
seccompProfile:
type: RuntimeDefault
containers:
- name: db-init
image: postgres:16-alpine
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: [ALL]
readOnlyRootFilesystem: false
env:
- name: PGHOST
value: "{{ .db.host }}"
- name: PGPORT
value: "{{ .db.port }}"
- name: PGUSER
value: postgres
- name: PGPASSWORD
valueFrom:
secretKeyRef:
name: mastodon-secrets
key: postgres.password
- name: MASTODON_DB
value: "{{ .db.name }}"
- name: MASTODON_USER
value: "{{ .db.user }}"
- name: MASTODON_PASSWORD
valueFrom:
secretKeyRef:
name: mastodon-secrets
key: dbPassword
command:
- sh
- -c
- |
set -e
echo "Waiting for PostgreSQL to be ready..."
until pg_isready -h $PGHOST -p $PGPORT -U $PGUSER; do
echo "PostgreSQL is unavailable - sleeping"
sleep 2
done
echo "PostgreSQL is ready"
echo "Creating database if it doesn't exist..."
psql -v ON_ERROR_STOP=1 <<-EOSQL
SELECT 'CREATE DATABASE $MASTODON_DB'
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = '$MASTODON_DB')\gexec
EOSQL
echo "Creating/updating user..."
psql -v ON_ERROR_STOP=1 <<-EOSQL
DO \$\$
BEGIN
IF NOT EXISTS (SELECT FROM pg_user WHERE usename = '$MASTODON_USER') THEN
CREATE USER $MASTODON_USER WITH PASSWORD '$MASTODON_PASSWORD';
ELSE
ALTER USER $MASTODON_USER WITH PASSWORD '$MASTODON_PASSWORD';
END IF;
END
\$\$;
EOSQL
echo "Granting privileges..."
psql -v ON_ERROR_STOP=1 <<-EOSQL
GRANT ALL PRIVILEGES ON DATABASE $MASTODON_DB TO $MASTODON_USER;
\c $MASTODON_DB
GRANT ALL ON SCHEMA public TO $MASTODON_USER;
EOSQL
echo "Database initialization complete"
---
apiVersion: batch/v1
kind: Job
metadata:
name: mastodon-db-migrate
namespace: {{ .namespace }}
spec:
ttlSecondsAfterFinished: 300
template:
metadata:
labels:
component: db-migrate
spec:
restartPolicy: OnFailure
securityContext:
runAsNonRoot: true
runAsUser: 991
runAsGroup: 991
fsGroup: 991
seccompProfile:
type: RuntimeDefault
containers:
- name: db-migrate
image: ghcr.io/mastodon/mastodon:v4.7.3
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: [ALL]
readOnlyRootFilesystem: false
command:
- bundle
- exec
- rails
- db:migrate
env:
- name: LOCAL_DOMAIN
value: "{{ .domain }}"
- name: RAILS_ENV
value: production
- name: SECRET_KEY_BASE
valueFrom:
secretKeyRef:
name: mastodon-secrets
key: secretKeyBase
- name: OTP_SECRET
valueFrom:
secretKeyRef:
name: mastodon-secrets
key: otpSecret
- name: ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY
valueFrom:
secretKeyRef:
name: mastodon-secrets
key: activeRecordPrimaryKey
- name: ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY
valueFrom:
secretKeyRef:
name: mastodon-secrets
key: activeRecordDeterministicKey
- name: ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT
valueFrom:
secretKeyRef:
name: mastodon-secrets
key: activeRecordKeyDerivationSalt
- name: DB_HOST
value: "{{ .db.host }}"
- name: DB_PORT
value: "{{ .db.port }}"
- name: DB_NAME
value: "{{ .db.name }}"
- name: DB_USER
value: "{{ .db.user }}"
- name: DB_PASS
valueFrom:
secretKeyRef:
name: mastodon-secrets
key: dbPassword
- name: REDIS_HOST
value: "{{ .redis.host }}"
- name: REDIS_PORT
value: "{{ .redis.port }}"
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: mastodon-secrets
key: redis.password
volumeMounts:
- name: assets
mountPath: /opt/mastodon/public/assets
- name: system
mountPath: /opt/mastodon/public/system
volumes:
- name: assets
persistentVolumeClaim:
claimName: mastodon-assets
- name: system
persistentVolumeClaim:
claimName: mastodon-system