feat(infrastructure): pull pre-built images from Gitea registry
migrate/api/worker/frontend now reference
git.devils.zone/devil/youtube-studio-flow-{backend,frontend}:\${IMAGE_TAG}
instead of building on the deploy host. Adds scripts/build-and-push.sh
to build+tag (git short SHA + latest) and push both images from a dev
machine, and updates infrastructure/README.md with the pull-based
deploy sequence.
This commit is contained in:
@@ -2,6 +2,12 @@
|
||||
# The public domain Traefik routes to this app (no https://, no trailing slash).
|
||||
DOMAIN=yourdomain.com
|
||||
|
||||
# ─── Image tag ────────────────────────────────────────────────────────────────
|
||||
# Which tag to pull from git.devils.zone/devil/youtube-studio-flow-{backend,frontend}.
|
||||
# Pin to a git short SHA or release tag for reproducible deploys; `latest` tracks
|
||||
# whatever scripts/build-and-push.sh last pushed.
|
||||
IMAGE_TAG=latest
|
||||
|
||||
# ─── Postgres ─────────────────────────────────────────────────────────────────
|
||||
POSTGRES_USER=studioflow
|
||||
POSTGRES_PASSWORD=change_me_strong_password
|
||||
|
||||
@@ -10,11 +10,23 @@ Dieses Verzeichnis enthält die Konfiguration für die lokale Entwicklung und da
|
||||
- **postgres:** PostgreSQL 16 (Port 5432)
|
||||
- **redis:** Redis 7 für Caching und Queues (Port 6379)
|
||||
|
||||
## Schnellstart
|
||||
## Schnellstart (Server-Deployment)
|
||||
|
||||
Images werden **nicht** auf dem Server gebaut — sie kommen fertig aus der Gitea Container
|
||||
Registry (`git.devils.zone/devil/youtube-studio-flow-{backend,frontend}`), gebaut per
|
||||
`scripts/build-and-push.sh` auf der Dev-Maschine.
|
||||
|
||||
1. `.env.example` kopieren: `cp .env.example .env`
|
||||
2. Werte in `.env` anpassen (besonders Google API Keys).
|
||||
3. Container starten: `docker compose up -d`
|
||||
4. Datenbank migrieren: `docker compose run --rm migrate`
|
||||
2. Werte in `.env` anpassen (Secrets, Domain, Google API Keys, `IMAGE_TAG`).
|
||||
3. Am Server einloggen: `docker login git.devils.zone`
|
||||
4. Images ziehen: `docker compose pull`
|
||||
5. Datenbank migrieren: `docker compose run --rm migrate`
|
||||
6. Container starten: `docker compose up -d`
|
||||
|
||||
Für ein Update auf eine neue Version: `IMAGE_TAG` in `.env` anpassen (oder `latest`
|
||||
belassen), dann Schritte 4–6 wiederholen. Das externe Docker-Netzwerk `traefik-network`
|
||||
muss vorher existieren (`docker network create traefik-network`), falls Traefik das nicht
|
||||
bereits selbst anlegt.
|
||||
|
||||
## Daten-Persistenz
|
||||
- PostgreSQL-Daten liegen im Volume `postgres_data`.
|
||||
|
||||
@@ -2,9 +2,7 @@ services:
|
||||
|
||||
# Runs database migrations once before the API and worker start.
|
||||
migrate:
|
||||
build:
|
||||
context: ../backend
|
||||
dockerfile: Dockerfile
|
||||
image: git.devils.zone/devil/youtube-studio-flow-backend:${IMAGE_TAG:-latest}
|
||||
command: npx prisma migrate deploy
|
||||
restart: "no"
|
||||
environment:
|
||||
@@ -16,9 +14,7 @@ services:
|
||||
- app-network
|
||||
|
||||
api:
|
||||
build:
|
||||
context: ../backend
|
||||
dockerfile: Dockerfile
|
||||
image: git.devils.zone/devil/youtube-studio-flow-backend:${IMAGE_TAG:-latest}
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
@@ -57,9 +53,7 @@ services:
|
||||
- traefik-network
|
||||
|
||||
worker:
|
||||
build:
|
||||
context: ../backend
|
||||
dockerfile: Dockerfile
|
||||
image: git.devils.zone/devil/youtube-studio-flow-backend:${IMAGE_TAG:-latest}
|
||||
restart: unless-stopped
|
||||
command: node dist/worker.js
|
||||
environment:
|
||||
@@ -84,11 +78,10 @@ services:
|
||||
- app-network
|
||||
|
||||
frontend:
|
||||
build:
|
||||
context: ../frontend
|
||||
dockerfile: Dockerfile
|
||||
# NEXT_PUBLIC_API_URL defaults to /api/v1 in the Dockerfile — no override needed.
|
||||
# The relative path works because Traefik serves both frontend and API on the same domain.
|
||||
# NEXT_PUBLIC_API_URL is baked in at build time (scripts/build-and-push.sh uses the
|
||||
# Dockerfile default, /api/v1) — the relative path works because Traefik serves both
|
||||
# frontend and API on the same domain.
|
||||
image: git.devils.zone/devil/youtube-studio-flow-frontend:${IMAGE_TAG:-latest}
|
||||
restart: unless-stopped
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
|
||||
Reference in New Issue
Block a user