-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
140 lines (135 loc) · 3.81 KB
/
Copy pathdocker-compose.yml
File metadata and controls
140 lines (135 loc) · 3.81 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
services:
postgres:
image: postgres:16
container_name: keycast-postgres
environment:
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?error}
POSTGRES_DB: keycast
POSTGRES_USER: postgres
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 3s
retries: 5
restart: unless-stopped
networks:
- keycast
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
compress: "true"
redis:
image: redis:7-alpine
container_name: keycast-redis
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
restart: unless-stopped
networks:
- keycast
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
compress: "true"
migrate:
build:
context: ./database
dockerfile: Dockerfile
container_name: keycast-migrate
environment:
DATABASE_URL: postgres://postgres:${POSTGRES_PASSWORD:?error}@postgres:5432/keycast
depends_on:
postgres:
condition: service_healthy
networks:
- keycast
restart: "no"
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
compress: "true"
keycast:
container_name: keycast-unified
build:
context: .
command: unified
ports:
- "3000:3000"
- "5173:5173"
volumes:
- ./master.key:/app/master.key:ro
environment:
DATABASE_URL: postgres://postgres:${POSTGRES_PASSWORD:?error}@postgres:5432/keycast
RUST_LOG: ${RUST_LOG:-info,keycast_signer=debug}
MASTER_KEY_PATH: /app/master.key
USE_GCP_KMS: ${USE_GCP_KMS:-false}
BUNKER_RELAYS: ${BUNKER_RELAYS:?error}
ALLOWED_ORIGINS: ${ALLOWED_ORIGINS:?error}
WEB_BUILD_DIR: /app/web
SERVER_NSEC: ${SERVER_NSEC:?error}
REDIS_URL: redis://redis:6379
# Email configuration
SENDGRID_API_KEY: ${SENDGRID_API_KEY:-}
FROM_EMAIL: ${FROM_EMAIL:-noreply@divine.video}
FROM_NAME: ${FROM_NAME:-Divine}
BASE_URL: ${BASE_URL:-http://localhost:5173}
# DISABLE_EMAILS: ${DISABLE_EMAILS:-}
# Server configuration
PORT: ${PORT:-3000}
NODE_ENV: ${NODE_ENV:-development}
# Performance tuning (optional)
TOKIO_WORKER_THREADS: ${TOKIO_WORKER_THREADS:-}
SQLX_POOL_SIZE: ${SQLX_POOL_SIZE:-10}
RELAY_WORKER_COUNT: ${RELAY_WORKER_COUNT:-}
# Development features
ENABLE_EXAMPLES: ${ENABLE_EXAMPLES:-false}
# GCP KMS (if USE_GCP_KMS=true)
GCP_PROJECT_ID: ${GCP_PROJECT_ID:-}
GCP_KMS_LOCATION: ${GCP_KMS_LOCATION:-}
GCP_KMS_KEY_RING: ${GCP_KMS_KEY_RING:-}
GCP_KMS_KEY_NAME: ${GCP_KMS_KEY_NAME:-}
# Frontend runtime configuration (injected into HTML)
VITE_DOMAIN: ${VITE_DOMAIN:-https://${DOMAIN:?error}}
VITE_ALLOWED_PUBKEYS: ${VITE_ALLOWED_PUBKEYS:-}
VITE_NDK_EXPLICIT_RELAYS: ${VITE_NDK_EXPLICIT_RELAYS:-}
VITE_NDK_BUNKER_RELAYS: ${VITE_NDK_BUNKER_RELAYS:-}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
migrate:
condition: service_completed_successfully
healthcheck:
test: ["CMD", "/usr/local/bin/healthcheck.sh", "unified"]
interval: 10s
timeout: 5s
retries: 3
start_period: 20s
restart: unless-stopped
networks:
- keycast
labels:
- "caddy=${DOMAIN:?error}"
- "caddy.reverse_proxy=/api/* {{upstreams 3000}}"
- "caddy.reverse_proxy=/* {{upstreams 5173}}"
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
compress: "true"
volumes:
postgres_data:
networks:
keycast: