d227223a74
Der Dienst, der sich einen Abzug per HTTP holte, ist wieder raus. Statt dessen veröffentlicht Postgres seinen Port auf dem Host (Standard 5433), damit Daten von außen eingespielt und gesichert werden können. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
118 lines
4.1 KiB
YAML
118 lines
4.1 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, Redis und Uploads als Ordner auf dem Pi unter DATA_DIR
|
|
# (Standard /srv/place4bees). Damit sind sie sichtbar, sicherbar und
|
|
# überstehen jedes Neuladen des Stacks.
|
|
# - Zugangsdaten als Variablen des Stacks (in Portainer unter "Environment")
|
|
#
|
|
# Vor dem ersten Deploy auf dem Pi anlegen:
|
|
# sudo mkdir -p /srv/place4bees/{postgres,redis,uploads}
|
|
#
|
|
# 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
|
|
# Port auf dem Host, damit Datenbestände von außen eingespielt und
|
|
# gesichert werden können. Im Heimnetz in Ordnung; sobald das System aus
|
|
# dem Internet erreichbar ist, gehört er hinter eine Firewall.
|
|
ports:
|
|
- "${POSTGRES_PORT:-5433}:5432"
|
|
volumes:
|
|
- ${DATA_DIR:-/srv/place4bees}/postgres:/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:
|
|
- ${DATA_DIR:-/srv/place4bees}/redis:/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:
|
|
- ${DATA_DIR:-/srv/place4bees}/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"
|