/home/techb158/cosmic-risk.abdallabala.com
Edit: /home/techb158/cosmic-risk.abdallabala.com/docker-compose.prod.yml (3400B)
# Production Docker Compose for VPS deployment
# Usage: docker compose -f docker-compose.prod.yml up -d
#
# Prerequisites:
# 1. Copy .env.production to .env and fill in secrets
# 2. Get your Cloudflare Tunnel token:
# - Go to https://one.dash.cloudflare.com → Networks → Tunnels
# - Create a tunnel or use existing one
# - Set the public hostname (balavpn.abdallabala.com) → http://localhost:8092
# - Copy the tunnel token
# 3. Add TUNNEL_TOKEN to .env
# 4. Ensure ports 5432, 6379 are free
services:
app:
build:
context: .
dockerfile: Dockerfile
env_file:
- .env
environment:
DATABASE_URL: postgresql://cosmic:${POSTGRES_PASSWORD}@postgres:5432/cosmic_saas?schema=public
REDIS_URL: redis://redis:6379
NEXT_PUBLIC_APP_URL: https://balavpn.abdallabala.com
COSMIC_SSO_ENABLED: "false"
NODE_ENV: production
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
expose:
- "8090"
ports:
- "127.0.0.1:8092:8090"
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8090/api/health"]
interval: 30s
timeout: 10s
start_period: 20s
retries: 3
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
postgres:
image: postgres:16-alpine
environment:
POSTGRES_DB: cosmic_saas
POSTGRES_USER: cosmic
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- cosmic-postgres-data:/var/lib/postgresql/data
expose:
- "5432"
ports:
- "127.0.0.1:5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U cosmic -d cosmic_saas"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
redis:
image: redis:7-alpine
volumes:
- cosmic-redis-data:/data
expose:
- "6379"
ports:
- "127.0.0.1:6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
restart: unless-stopped
cloudflared:
image: cloudflare/cloudflared:latest
command: tunnel --no-autoupdate run --token ${TUNNEL_TOKEN}
environment:
- TUNNEL_TOKEN=${TUNNEL_TOKEN}
restart: unless-stopped
depends_on:
- app
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
uptime-kuma:
image: louislam/uptime-kuma:1
container_name: uptime-kuma
restart: unless-stopped
expose:
- "3001"
ports:
- "127.0.0.1:3001:3001"
volumes:
- cosmic-uptime-kuma-data:/app/data
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3001"]
interval: 30s
timeout: 10s
start_period: 10s
retries: 3
pgadmin:
image: dpage/pgadmin4:latest
container_name: pgadmin
restart: unless-stopped
environment:
PGADMIN_DEFAULT_EMAIL: admin@cosmic.com
PGADMIN_DEFAULT_PASSWORD: ${POSTGRES_PASSWORD}
expose:
- "80"
ports:
- "127.0.0.1:5050:80"
volumes:
- cosmic-pgadmin-data:/var/lib/pgadmin
depends_on:
- postgres
volumes:
cosmic-postgres-data:
cosmic-redis-data:
cosmic-uptime-kuma-data:
cosmic-pgadmin-data: