fix: correct indentation in deploy.sh docker-compose generation

- Fixed docker-compose.prod.deployed.yml YAML indentation
- postgres service now uses consistent 2-space indents
- db-migrate, backend, and frontend services properly aligned as siblings
- All healthcheck, deploy, and networks sections correctly indented
- Fixed comment indentation in file header
- Fixed print_summary() function echo statement indentation
This commit is contained in:
2026-01-17 21:22:19 +01:00
parent 1956a09560
commit 1a81a6d191

191
deploy.sh
View File

@@ -255,15 +255,15 @@ generate_deployment_config() {
# Generated: $(date -u +'%Y-%m-%dT%H:%M:%SZ')
# GitHub User: ${GITHUB_USER}
#
# IMPORTANT: Create a .env file with these variables:
# DB_NAME=edh_stats
# DB_USER=postgres
# DB_PASSWORD=\$(openssl rand -base64 32)
# JWT_SECRET=\$(openssl rand -base64 32)
# CORS_ORIGIN=https://yourdomain.com
# LOG_LEVEL=warn
# ALLOW_REGISTRATION=false
# DB_SEED=false
# IMPORTANT: Create a .env file with these variables:
# DB_NAME=edh_stats
# DB_USER=postgres
# DB_PASSWORD=\$(openssl rand -base64 32)
# JWT_SECRET=\$(openssl rand -base64 32)
# CORS_ORIGIN=https://yourdomain.com
# LOG_LEVEL=warn
# ALLOW_REGISTRATION=false
# DB_SEED=false
#
# FIRST TIME SETUP:
# 1. Create .env file with above variables
@@ -272,66 +272,66 @@ generate_deployment_config() {
# 4. Monitor logs: docker-compose logs -f db-migrate
services:
# PostgreSQL database service
postgres:
image: postgres:16-alpine
environment:
- POSTGRES_USER=\${DB_USER:-postgres}
- POSTGRES_PASSWORD=\${DB_PASSWORD}
- POSTGRES_DB=\${DB_NAME}
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ['CMD-SHELL', 'PGPASSWORD=\${DB_PASSWORD} pg_isready -U postgres -h localhost']
interval: 10s
timeout: 5s
retries: 5
networks:
- edh-stats-network
restart: unless-stopped
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
reservations:
memory: 256M
cpus: '0.25'
# PostgreSQL database service
postgres:
image: postgres:16-alpine
environment:
- POSTGRES_USER=\${DB_USER:-postgres}
- POSTGRES_PASSWORD=\${DB_PASSWORD}
- POSTGRES_DB=\${DB_NAME}
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ['CMD-SHELL', 'PGPASSWORD=\${DB_PASSWORD} pg_isready -U postgres -h localhost']
interval: 10s
timeout: 5s
retries: 5
networks:
- edh-stats-network
restart: unless-stopped
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
reservations:
memory: 256M
cpus: '0.25'
# Database migration service - runs once on startup
# Database migration service - runs once on startup
db-migrate:
image: ${BACKEND_IMAGE}
depends_on:
postgres:
condition: service_healthy
environment:
- NODE_ENV=production
- DB_HOST=\${DB_HOST:-postgres}
- DB_NAME=\${DB_NAME}
- DB_USER=\${DB_USER:-postgres}
- DB_PASSWORD=\${DB_PASSWORD}
command: node src/database/migrate.js migrate
networks:
- edh-stats-network
restart: 'no'
backend:
image: ${BACKEND_IMAGE}
ports:
- '3002:3000'
depends_on:
db-migrate:
image: ${BACKEND_IMAGE}
depends_on:
postgres:
condition: service_healthy
environment:
- NODE_ENV=production
- DB_HOST=\${DB_HOST:-postgres}
- DB_NAME=\${DB_NAME}
- DB_USER=\${DB_USER:-postgres}
- DB_PASSWORD=\${DB_PASSWORD}
command: node src/database/migrate.js migrate
networks:
- edh-stats-network
restart: 'no'
backend:
image: ${BACKEND_IMAGE}
ports:
- '3002:3000'
depends_on:
db-migrate:
condition: service_completed_successfully
environment:
- NODE_ENV=production
- DB_HOST=\${DB_HOST:-postgres}
- DB_NAME=\${DB_NAME}
- DB_USER=\${DB_USER:-postgres}
- DB_PASSWORD=\${DB_PASSWORD}
- JWT_SECRET=\${JWT_SECRET}
- CORS_ORIGIN=\${CORS_ORIGIN:-https://yourdomain.com}
- LOG_LEVEL=\${LOG_LEVEL:-warn}
- ALLOW_REGISTRATION=\${ALLOW_REGISTRATION:-false}
condition: service_completed_successfully
environment:
- NODE_ENV=production
- DB_HOST=\${DB_HOST:-postgres}
- DB_NAME=\${DB_NAME}
- DB_USER=\${DB_USER:-postgres}
- DB_PASSWORD=\${DB_PASSWORD}
- JWT_SECRET=\${JWT_SECRET}
- CORS_ORIGIN=\${CORS_ORIGIN:-https://yourdomain.com}
- LOG_LEVEL=\${LOG_LEVEL:-warn}
- ALLOW_REGISTRATION=\${ALLOW_REGISTRATION:-false}
restart: unless-stopped
deploy:
resources:
@@ -351,32 +351,32 @@ services:
- edh-stats-network
stop_grace_period: 30s
frontend:
image: ${FRONTEND_IMAGE}
ports:
- '38080:80'
- '30443:443'
restart: unless-stopped
healthcheck:
test:
- CMD
- curl
- http://localhost:80/health
interval: 10s
timeout: 5s
retries: 5
networks:
- edh-stats-network
depends_on:
- backend
deploy:
resources:
limits:
memory: 256M
cpus: '0.25'
reservations:
memory: 128M
cpus: '0.125'
frontend:
image: ${FRONTEND_IMAGE}
ports:
- '38080:80'
- '30443:443'
restart: unless-stopped
healthcheck:
test:
- CMD
- curl
- http://localhost:80/health
interval: 10s
timeout: 5s
retries: 5
networks:
- edh-stats-network
depends_on:
- backend
deploy:
resources:
limits:
memory: 256M
cpus: '0.25'
reservations:
memory: 128M
cpus: '0.125'
volumes:
postgres_data:
@@ -385,6 +385,7 @@ volumes:
networks:
edh-stats-network:
driver: bridge
x-dockge:
urls:
- https://edh.zlor.fi
@@ -429,8 +430,8 @@ print_summary() {
echo ""
echo "Next Steps:"
echo " 1. Commit version update:"
echo " git add frontend/public/version.txt"
echo " git commit -m \"Bump version to ${VERSION#v}\""
echo " git add frontend/public/version.txt"
echo " git commit -m \"Bump version to ${VERSION#v}\""
echo " 2. Pull images: docker pull ${BACKEND_IMAGE}"
echo " 3. Create .env file with PostgreSQL credentials:"
echo " DB_PASSWORD=\$(openssl rand -base64 32)"