9c58fe2312
A fresh production environment only ran migrations, so the four built-in platform templates were never inserted unless someone manually ran dev-seed (which also writes broad demo data). Extract the platform template upsert into a reusable repository.EnsurePlatformTemplates and add a standalone cmd/seed-platform-templates that calls it. Bake the binary into the migrate image and chain it after migrate up in both docker-compose and the k3s migration job (mounting app config so the binary can dial the right database). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
93 lines
2.9 KiB
YAML
93 lines
2.9 KiB
YAML
apiVersion: batch/v1
|
|
kind: Job
|
|
metadata:
|
|
name: minio-init
|
|
labels:
|
|
app.kubernetes.io/name: minio-init
|
|
spec:
|
|
backoffLimit: 12
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/name: minio-init
|
|
spec:
|
|
restartPolicy: OnFailure
|
|
containers:
|
|
- name: minio-init
|
|
image: minio/mc:latest
|
|
imagePullPolicy: IfNotPresent
|
|
env:
|
|
- name: MINIO_ROOT_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: geo-rankly-app-secret
|
|
key: MINIO_ROOT_USER
|
|
- name: MINIO_ROOT_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: geo-rankly-app-secret
|
|
key: MINIO_ROOT_PASSWORD
|
|
command:
|
|
- /bin/sh
|
|
- -ec
|
|
- |
|
|
until mc alias set local http://minio:9000 "${MINIO_ROOT_USER}" "${MINIO_ROOT_PASSWORD}"; do
|
|
sleep 3
|
|
done
|
|
mc mb --ignore-existing local/geo-private
|
|
---
|
|
apiVersion: batch/v1
|
|
kind: Job
|
|
metadata:
|
|
name: migrate
|
|
labels:
|
|
app.kubernetes.io/name: migrate
|
|
spec:
|
|
backoffLimit: 6
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/name: migrate
|
|
spec:
|
|
restartPolicy: OnFailure
|
|
containers:
|
|
- name: migrate
|
|
image: geo-rankly/migrate:latest
|
|
imagePullPolicy: IfNotPresent
|
|
env:
|
|
- name: CONFIG_PATH
|
|
value: /app/configs/config.yaml
|
|
- name: POSTGRES_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: geo-rankly-app-secret
|
|
key: POSTGRES_PASSWORD
|
|
volumeMounts:
|
|
- name: app-config
|
|
mountPath: /app/configs
|
|
readOnly: true
|
|
command:
|
|
- /bin/sh
|
|
- -ec
|
|
- |
|
|
/usr/local/bin/migrate -path /migrations -database "postgres://geo:${POSTGRES_PASSWORD}@postgres:5432/geo?sslmode=disable" up
|
|
/usr/local/bin/migrate -path /migrations_monitoring -database "postgres://geo:${POSTGRES_PASSWORD}@monitoring-postgres:5432/geo_monitoring?sslmode=disable" up
|
|
/usr/local/bin/migrate -path /migrations_ops -database "postgres://geo:${POSTGRES_PASSWORD}@postgres:5432/geo?sslmode=disable&x-migrations-table=schema_migrations_ops" up
|
|
/usr/local/bin/seed-platform-templates
|
|
volumes:
|
|
- name: app-config
|
|
projected:
|
|
sources:
|
|
- configMap:
|
|
name: geo-rankly-app-config
|
|
items:
|
|
- key: config.yaml
|
|
path: config.yaml
|
|
- key: prompts.yml
|
|
path: prompts.yml
|
|
- secret:
|
|
name: geo-rankly-app-secret
|
|
items:
|
|
- key: config.local.yaml
|
|
path: config.local.yaml
|