-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.production.yml
More file actions
110 lines (105 loc) · 3.03 KB
/
docker-compose.production.yml
File metadata and controls
110 lines (105 loc) · 3.03 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
# OpenCodeHub Production Docker Compose
# Pull pre-built images from DockerHub
# Usage:
# 1. Copy .env.example to .env and configure
# 2. docker compose -f docker-compose.production.yml up -d
#
# Required environment variables in .env:
# JWT_SECRET=<generate with: openssl rand -base64 32>
# POSTGRES_PASSWORD=<strong password>
# WORKFLOW_SECRET_ENCRYPTION_KEY=<generate with: openssl rand -hex 32>
services:
app:
image: swadhinbiswas/opencodehub:latest
container_name: opencodehub
restart: unless-stopped
ports:
- "${APP_PORT:-4321}:4321"
- "${SSH_PORT:-2222}:2222"
environment:
- NODE_ENV=production
- DATABASE_URL=postgresql://opencodehub:${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD}@postgres:5432/opencodehub
- DATABASE_TYPE=postgres
- REDIS_URL=redis://redis:6379
- JWT_SECRET=${JWT_SECRET:?Set JWT_SECRET with: openssl rand -base64 32}
- SESSION_SECRET=${SESSION_SECRET:-${JWT_SECRET}}
- WORKFLOW_SECRET_ENCRYPTION_KEY=${WORKFLOW_SECRET_ENCRYPTION_KEY:?Set WORKFLOW_SECRET_ENCRYPTION_KEY with: openssl rand -hex 32}
- SSH_HOST_KEY_PATH=/data/ssh/host_key
- SERVER_URL=${SERVER_URL:-http://localhost:4321}
- STORAGE_TYPE=local
- STORAGE_PATH=/data/storage
- REPOS_PATH=/data/repos
- INTERNAL_HOOK_SECRET=${INTERNAL_HOOK_SECRET:-$(openssl rand -hex 32)}
volumes:
- repos-data:/data/repos
- storage-data:/data/storage
- ssh-data:/data/ssh
- cache-data:/data/cache
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
networks:
- opencodehub-network
healthcheck:
test:
[
"CMD",
"wget",
"--no-verbose",
"--tries=1",
"--spider",
"http://localhost:4321/api/health",
]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
postgres:
image: postgres:16-alpine
container_name: opencodehub-postgres
restart: unless-stopped
environment:
POSTGRES_USER: opencodehub
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD}
POSTGRES_DB: opencodehub
volumes:
- postgres-data:/var/lib/postgresql/data
networks:
- opencodehub-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U opencodehub -d opencodehub"]
interval: 10s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
container_name: opencodehub-redis
restart: unless-stopped
command: redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy allkeys-lru
volumes:
- redis-data:/data
networks:
- opencodehub-network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
volumes:
repos-data:
driver: local
storage-data:
driver: local
ssh-data:
driver: local
cache-data:
driver: local
postgres-data:
driver: local
redis-data:
driver: local
networks:
opencodehub-network:
driver: bridge