7d7b308759
Die Migration brach im Container nach einer halben Stunde mit "Knex: Timeout acquiring a connection" ab: Ohne Angabe erlaubt Knex zehn Verbindungen, bei einer Migration meldet sich aber jedes der rund 30 Module gleichzeitig. Pool jetzt auf 30 gesetzt. Dazu der Stack für Portainer: Postgres, Redis, ein einmaliger Migrationsdienst, Backend und Frontend. Die Images kommen fertig aus der Gitea-Registry, gebaut wird auf dem Entwicklungsrechner — ein Medusa-Build auf dem Orange Pi dauert eine halbe Stunde. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
113 lines
3.6 KiB
YAML
113 lines
3.6 KiB
YAML
# Stack für Portainer auf dem Orange Pi.
|
|
#
|
|
# Die Images kommen fertig aus der Gitea-Registry, hier wird nichts gebaut —
|
|
# ein Medusa-Build auf dem Pi dauert eine halbe Stunde, auf dem Mac drei
|
|
# Minuten. Gebaut und hochgeladen wird mit ./deploy.sh.
|
|
#
|
|
# Alles Veränderliche liegt außerhalb der Images:
|
|
# - Datenbank und Uploads in Volumes
|
|
# - Zugangsdaten als Variablen des Stacks (in Portainer unter "Environment")
|
|
#
|
|
# Pflichtvariablen: IMAGE_TAG, POSTGRES_PASSWORD, JWT_SECRET, COOKIE_SECRET,
|
|
# MEDUSA_BACKEND_URL, STORE_CORS, ADMIN_CORS, AUTH_CORS
|
|
|
|
name: place4bees
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_USER: medusa
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
|
POSTGRES_DB: medusa
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U medusa"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 10
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
restart: unless-stopped
|
|
volumes:
|
|
- redis_data:/data
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 10
|
|
|
|
# Läuft bei jedem Deploy einmal und beendet sich wieder. Als eigener Dienst,
|
|
# damit im Portainer sofort zu sehen ist, ob die Migration durchlief — sonst
|
|
# steckt der Fehler in den Logs des Backends.
|
|
migrate:
|
|
image: ${REGISTRY:-git.place4bees.com/place4bees}/backend:${IMAGE_TAG:-latest}
|
|
restart: "no"
|
|
command: ["npx", "medusa", "db:migrate"]
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
environment:
|
|
DATABASE_URL: postgres://medusa:${POSTGRES_PASSWORD}@postgres:5432/medusa
|
|
REDIS_URL: redis://redis:6379
|
|
JWT_SECRET: ${JWT_SECRET}
|
|
COOKIE_SECRET: ${COOKIE_SECRET}
|
|
|
|
backend:
|
|
image: ${REGISTRY:-git.place4bees.com/place4bees}/backend:${IMAGE_TAG:-latest}
|
|
restart: unless-stopped
|
|
depends_on:
|
|
migrate:
|
|
condition: service_completed_successfully
|
|
redis:
|
|
condition: service_healthy
|
|
# Das Image migriert sonst beim Start noch einmal — das macht hier der
|
|
# Dienst oben.
|
|
command: ["npx", "medusa", "start"]
|
|
environment:
|
|
DATABASE_URL: postgres://medusa:${POSTGRES_PASSWORD}@postgres:5432/medusa
|
|
REDIS_URL: redis://redis:6379
|
|
JWT_SECRET: ${JWT_SECRET}
|
|
COOKIE_SECRET: ${COOKIE_SECRET}
|
|
MEDUSA_BACKEND_URL: ${MEDUSA_BACKEND_URL}
|
|
STORE_CORS: ${STORE_CORS}
|
|
ADMIN_CORS: ${ADMIN_CORS}
|
|
AUTH_CORS: ${AUTH_CORS}
|
|
# Bleiben leer, solange die Zugänge fehlen. Die Module melden sich dann
|
|
# gar nicht erst an, statt beim Start zu scheitern.
|
|
DHL_API_KEY: ${DHL_API_KEY:-}
|
|
DHL_USERNAME: ${DHL_USERNAME:-}
|
|
DHL_PASSWORD: ${DHL_PASSWORD:-}
|
|
DHL_BILLING_NUMBER: ${DHL_BILLING_NUMBER:-}
|
|
DHL_SHIPPER_NAME: ${DHL_SHIPPER_NAME:-}
|
|
DHL_SHIPPER_STREET: ${DHL_SHIPPER_STREET:-}
|
|
DHL_SHIPPER_POSTAL_CODE: ${DHL_SHIPPER_POSTAL_CODE:-}
|
|
DHL_SHIPPER_CITY: ${DHL_SHIPPER_CITY:-}
|
|
DHL_SHIPPER_COUNTRY: ${DHL_SHIPPER_COUNTRY:-}
|
|
MOLLIE_API_KEY: ${MOLLIE_API_KEY:-}
|
|
SMTP_HOST: ${SMTP_HOST:-}
|
|
SMTP_PORT: ${SMTP_PORT:-}
|
|
SMTP_USER: ${SMTP_USER:-}
|
|
SMTP_PASSWORD: ${SMTP_PASSWORD:-}
|
|
MAIL_FROM: ${MAIL_FROM:-}
|
|
volumes:
|
|
- medusa_uploads:/app/static
|
|
ports:
|
|
- "${BACKEND_PORT:-9001}:9001"
|
|
|
|
frontend:
|
|
image: ${REGISTRY:-git.place4bees.com/place4bees}/frontend:${IMAGE_TAG:-latest}
|
|
restart: unless-stopped
|
|
depends_on:
|
|
- backend
|
|
ports:
|
|
- "${FRONTEND_PORT:-4321}:4321"
|
|
|
|
volumes:
|
|
postgres_data:
|
|
redis_data:
|
|
medusa_uploads:
|