prod preparation

This commit is contained in:
Andreas Knuth 2025-07-30 17:30:39 -05:00
parent 04e9f4ccec
commit ee7b6fd1fb
2 changed files with 66 additions and 6 deletions

View File

@ -0,0 +1,43 @@
services:
app:
image: node:22-alpine
container_name: bizmatch-app-prod # Neu: Unterscheide Namen
working_dir: /app
volumes:
- ~/git/bizmatch-project-prod/bizmatch-server:/app # Verwende Prod-Checkout
ports:
- "3001:3000" # Neu: Host-Port 3001, Container-Port bleibt 3000
environment:
- NODE_ENV=development # Neu: Production-Modus (für Nest.js-Config)
- DB_HOST=postgres-prod # Neu: Passe an neuen Service-Namen
- DB_PORT=5432
- DB_NAME=${POSTGRES_DB_PROD} # Neu: Separate DB-Name aus Env-File
- DB_USER=${POSTGRES_USER_PROD}
- DB_PASSWORD=${POSTGRES_PASSWORD_PROD}
env_file:
- ~/git/docker-prod/app/.env.prod # Neu: Separate Env-File für Prod
command: sh -c "npm install && npm run build && node dist/src/main.js" # Entferne --omit=dev für Prod
restart: unless-stopped
depends_on:
- postgres-prod
networks:
- bizmatch-prod # Neu: Separates Network für Isolation
postgres-prod: # Neu: Umbenannt für Unterscheidung
container_name: bizmatchdb-prod
image: postgres:latest
restart: always
volumes:
- ${PWD}/bizmatchdb-data-prod:/var/lib/postgresql/data # Neu: Separates Daten-Volume
environment:
POSTGRES_DB: ${POSTGRES_DB_PROD}
POSTGRES_USER: ${POSTGRES_USER_PROD}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD_PROD}
ports:
- "5433:5432" # Neu: Host-Port 5433, Container-Port bleibt 5432
networks:
- bizmatch-prod
networks:
bizmatch-prod:
external: true # Neu: Erstelle es mit `docker network create bizmatch-prod`

View File

@ -4,11 +4,21 @@
acme_ca https://acme-v02.api.letsencrypt.org/directory acme_ca https://acme-v02.api.letsencrypt.org/directory
debug debug
} }
bizmatch.net { # Prod: Neue Domains
bizmatch.net, www.bizmatch.net {
} handle /pictures/* {
www.bizmatch.net { root * /home/aknuth/git/bizmatch-project-prod/bizmatch-server # Prod-Ordner
file_server
}
handle {
root * /srv/prod # Neuer Prod-Dist-Ordner
try_files {path} {path}/ /index.html
file_server
}
log {
output file /var/log/caddy/access.prod.log { ... } # Separate Logs
}
encode gzip
} }
bayarea-cc.com { bayarea-cc.com {
# TLS-Direktive entfernen, falls Cloudflare die Verbindung terminiert # TLS-Direktive entfernen, falls Cloudflare die Verbindung terminiert
@ -77,7 +87,14 @@ api-dev.bizmatch.net {
header_up CF-IPCountry {http.request.header.CF-IPCountry} header_up CF-IPCountry {http.request.header.CF-IPCountry}
} }
} }
api.bizmatch.net {
reverse_proxy host.docker.internal:3001 { # Neu: Proxy auf Prod-Port 3001
header_up X-Real-IP {http.request.header.CF-Connecting-IP}
header_up X-Forwarded-For {http.request.header.CF-Connecting-IP}
header_up X-Forwarded-Proto {http.request.header.X-Forwarded-Proto}
header_up CF-IPCountry {http.request.header.CF-IPCountry}
}
}
mailsync.bizmatch.net { mailsync.bizmatch.net {
reverse_proxy host.docker.internal:5000 { reverse_proxy host.docker.internal:5000 {
header_up X-Real-IP {http.request.header.CF-Connecting-IP} header_up X-Real-IP {http.request.header.CF-Connecting-IP}