forked from Emmyt24/nova-launch
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
118 lines (112 loc) · 4.25 KB
/
docker-compose.yml
File metadata and controls
118 lines (112 loc) · 4.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
version: '3.8'
services:
postgres:
image: postgres:16-alpine
container_name: nova-launch-db
environment:
POSTGRES_DB: nova_launch
POSTGRES_USER: ${POSTGRES_USER:-nova_user}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-nova_password}
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./backend/src/database/schema.sql:/docker-entrypoint-initdb.d/schema.sql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-nova_user} -d nova_launch"]
interval: 10s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
container_name: nova-launch-redis
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: nova-launch-backend
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
environment:
NODE_ENV: development
PORT: 3001
DATABASE_URL: postgresql://${POSTGRES_USER:-nova_user}:${POSTGRES_PASSWORD:-nova_password}@postgres:5432/nova_launch
JWT_SECRET: ${JWT_SECRET:-change-me-in-production}
JWT_EXPIRES_IN: ${JWT_EXPIRES_IN:-24h}
ADMIN_JWT_SECRET: ${ADMIN_JWT_SECRET:-change-me-admin-in-production}
ADMIN_JWT_EXPIRES_IN: ${ADMIN_JWT_EXPIRES_IN:-8h}
STELLAR_NETWORK: ${STELLAR_NETWORK:-testnet}
STELLAR_HORIZON_URL: ${STELLAR_HORIZON_URL:-https://horizon-testnet.stellar.org}
FACTORY_CONTRACT_ID: ${FACTORY_CONTRACT_ID:-}
REDIS_URL: redis://redis:6379
FRONTEND_URL: http://localhost:5173
ports:
- "3001:3001"
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://localhost:3001/health', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
args:
VITE_API_BASE_URL: ${VITE_API_BASE_URL:-http://localhost:3001/api}
VITE_TOKEN_INFO_API_URL: ${VITE_TOKEN_INFO_API_URL:-http://localhost:3001/api/token-info}
VITE_LEADERBOARD_API_URL: ${VITE_LEADERBOARD_API_URL:-http://localhost:3001/api/leaderboard}
VITE_GOVERNANCE_API_URL: ${VITE_GOVERNANCE_API_URL:-http://localhost:3001/api/governance}
VITE_NETWORK: ${VITE_NETWORK:-testnet}
VITE_FACTORY_CONTRACT_ID: ${VITE_FACTORY_CONTRACT_ID:-}
VITE_IPFS_API_KEY: ${VITE_IPFS_API_KEY:-}
VITE_IPFS_API_SECRET: ${VITE_IPFS_API_SECRET:-}
container_name: nova-launch-frontend
depends_on:
backend:
condition: service_healthy
ports:
- "5173:80"
# ── Automated PITR backup service ──────────────────────────────────────────
# Runs backup-db.sh on a schedule via cron inside the container.
# Mounts the postgres data directory (read-only) and a dedicated backup
# volume so base backups and WAL archives persist across container restarts.
db-backup:
image: postgres:16-alpine
container_name: nova-launch-db-backup
depends_on:
postgres:
condition: service_healthy
environment:
DATABASE_URL: postgresql://${POSTGRES_USER:-nova_user}:${POSTGRES_PASSWORD:-nova_password}@postgres:5432/nova_launch
BACKUP_STORAGE_PATH: /var/backups/nova/pitr
BACKUP_RETENTION_DAYS: ${BACKUP_RETENTION_DAYS:-7}
BACKUP_S3_BUCKET: ${BACKUP_S3_BUCKET:-}
# Set to a GPG key ID to encrypt backups at rest
BACKUP_ENCRYPTION_KEY: ${BACKUP_ENCRYPTION_KEY:-}
volumes:
- ./scripts/backup-db.sh:/usr/local/bin/backup-db.sh:ro
- pitr_backups:/var/backups/nova/pitr
# Run a base backup immediately on start, then every 6 hours via crond.
command: >
sh -c "
chmod +x /usr/local/bin/backup-db.sh &&
echo '0 */6 * * * /usr/local/bin/backup-db.sh base >> /var/backups/nova/pitr/cron.log 2>&1' | crontab - &&
/usr/local/bin/backup-db.sh base &&
crond -f -l 8
"
restart: unless-stopped
volumes:
postgres_data:
# Persistent volume for PITR base backups and WAL archive
pitr_backups: