Replaced Headscale (too buggy in 0.28.x — random node drops) with direct WireGuard hub-and-spoke + full mesh. 7 Proxmox VMs across 3 hosts form a K3s v1.34.6 cluster: 3 control-plane/etcd nodes, 4 workers. Running services: postgres, mariadb, ghost (x3), forgejo, authentik. All unpinned services use local-path StorageClass. Databases pinned to pve-worker and adder-worker with local PVs. Includes VM provisioning scripts (create-debian-template.sh, clone-vm.sh), K3s manifests for all services, and full deployment docs in k3s/README.md. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
60 lines
2.1 KiB
YAML
60 lines
2.1 KiB
YAML
# Ghost DB Init Job
|
|
# Creates Ghost databases and users in MariaDB.
|
|
# Run once before deploying Ghost instances.
|
|
# Runs in default namespace — can access all secrets directly.
|
|
#
|
|
# Apply with:
|
|
# kubectl apply -f ghost-db-init.yaml
|
|
#
|
|
# Watch completion:
|
|
# kubectl get jobs -w
|
|
# kubectl logs job/ghost-db-init
|
|
|
|
apiVersion: batch/v1
|
|
kind: Job
|
|
metadata:
|
|
name: ghost-db-init
|
|
spec:
|
|
template:
|
|
spec:
|
|
restartPolicy: OnFailure
|
|
containers:
|
|
- name: ghost-db-init
|
|
image: mariadb:11
|
|
env:
|
|
- name: MARIADB_ROOT_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: mariadb-secret
|
|
key: root-password
|
|
- name: GHOST1_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: ghost-secrets
|
|
key: ghost1-db-password
|
|
- name: GHOST2_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: ghost-secrets
|
|
key: ghost2-db-password
|
|
- name: GHOST3_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: ghost-secrets
|
|
key: ghost3-db-password
|
|
command:
|
|
- /bin/sh
|
|
- -c
|
|
- |
|
|
mariadb -h mariadb -u root -p"${MARIADB_ROOT_PASSWORD}" <<EOF
|
|
CREATE DATABASE IF NOT EXISTS ghost1_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
CREATE DATABASE IF NOT EXISTS ghost2_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
CREATE DATABASE IF NOT EXISTS ghost3_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
CREATE USER IF NOT EXISTS 'ghost1_user'@'%' IDENTIFIED BY '${GHOST1_PASSWORD}';
|
|
CREATE USER IF NOT EXISTS 'ghost2_user'@'%' IDENTIFIED BY '${GHOST2_PASSWORD}';
|
|
CREATE USER IF NOT EXISTS 'ghost3_user'@'%' IDENTIFIED BY '${GHOST3_PASSWORD}';
|
|
GRANT ALL ON ghost1_db.* TO 'ghost1_user'@'%';
|
|
GRANT ALL ON ghost2_db.* TO 'ghost2_user'@'%';
|
|
GRANT ALL ON ghost3_db.* TO 'ghost3_user'@'%';
|
|
FLUSH PRIVILEGES;
|
|
EOF
|