-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
170 lines (164 loc) · 4.58 KB
/
docker-compose.yml
File metadata and controls
170 lines (164 loc) · 4.58 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
services:
db:
image: postgres:16-alpine
restart: unless-stopped
command:
- postgres
- -c
- max_connections=30
- -c
- shared_buffers=128MB
- -c
- effective_cache_size=512MB
- -c
- work_mem=4MB
- -c
- maintenance_work_mem=64MB
- -c
- wal_buffers=8MB
environment:
POSTGRES_DB: auth
POSTGRES_USER: auth
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD}
volumes:
- postgres-data:/var/lib/postgresql/data
- ./db/schema.sql:/docker-entrypoint-initdb.d/001-schema.sql:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U auth -d auth"]
interval: 10s
timeout: 5s
retries: 5
mem_limit: 512m
memswap_limit: 512m
cpus: 1.0
pids_limit: 128
logging:
options:
max-size: "10m"
max-file: "3"
redis:
image: redis:7-alpine
restart: unless-stopped
read_only: true
tmpfs:
- /data:rw,noexec,nosuid,size=64m
mem_limit: 128m
memswap_limit: 128m
cpus: 0.25
pids_limit: 64
logging:
options:
max-size: "10m"
max-file: "3"
app:
build: .
restart: unless-stopped
environment:
AUTH_BASE_URL: ${AUTH_BASE_URL:-https://auth.bottleneck.cc}
DATABASE_URL: postgres://auth:${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD}@db:5432/auth
DATABASE_POOL_MAX: ${DATABASE_POOL_MAX:-4}
NODE_OPTIONS: ${APP_NODE_OPTIONS:---max-old-space-size=256}
REDIS_URL: ${REDIS_URL:-redis://redis:6379}
SESSION_MAX_AGE_SECONDS: ${SESSION_MAX_AGE_SECONDS:-2592000}
SESSION_SHORT_AGE_SECONDS: ${SESSION_SHORT_AGE_SECONDS:-43200}
LOGIN_2FA_TTL_MINUTES: ${LOGIN_2FA_TTL_MINUTES:-5}
TELEGRAM_BOT_TOKEN: ${TELEGRAM_BOT_TOKEN:-}
TELEGRAM_BOT_USERNAME: ${TELEGRAM_BOT_USERNAME:-bottleneck_auth_bot}
TELEGRAM_BOT_WEBHOOK_SECRET: ${TELEGRAM_BOT_WEBHOOK_SECRET:-}
NEXT_PUBLIC_TELEGRAM_BOT_USERNAME: ${NEXT_PUBLIC_TELEGRAM_BOT_USERNAME:-bottleneck_auth_bot}
TURNSTILE_SECRET_KEY: ${TURNSTILE_SECRET_KEY:-}
TURNSTILE_SITE_KEY: ${TURNSTILE_SITE_KEY:-}
NEXT_PUBLIC_TURNSTILE_SITE_KEY: ${NEXT_PUBLIC_TURNSTILE_SITE_KEY:-}
TELEGRAM_ANALYTICS_CHAT_ID: ${TELEGRAM_ANALYTICS_CHAT_ID:-}
TELEGRAM_ANALYTICS_THREAD_ID: ${TELEGRAM_ANALYTICS_THREAD_ID:-}
OIDC_PRIVATE_KEY_PEM: ${OIDC_PRIVATE_KEY_PEM:-}
OIDC_KEY_ID: ${OIDC_KEY_ID:-default}
expose:
- "3000"
depends_on:
db:
condition: service_healthy
healthcheck:
test: ["CMD", "node", "-e", "fetch('http://127.0.0.1:3000/api/health').then(r => process.exit(r.ok ? 0 : 1)).catch(() => process.exit(1))"]
interval: 30s
timeout: 5s
start_period: 15s
retries: 3
read_only: true
tmpfs:
- /tmp:rw,noexec,nosuid,size=64m
mem_limit: 384m
memswap_limit: 384m
cpus: 1.0
pids_limit: 128
logging:
options:
max-size: "10m"
max-file: "3"
bot:
build: ./bot
restart: unless-stopped
environment:
TELEGRAM_BOT_TOKEN: ${TELEGRAM_BOT_TOKEN:?set TELEGRAM_BOT_TOKEN}
TELEGRAM_BOT_WEBHOOK_SECRET: ${TELEGRAM_BOT_WEBHOOK_SECRET:?set TELEGRAM_BOT_WEBHOOK_SECRET}
AUTH_INTERNAL_URL: http://app:3000
TELEGRAM_ANALYTICS_CHAT_ID: ${TELEGRAM_ANALYTICS_CHAT_ID:-}
TELEGRAM_ANALYTICS_THREAD_ID: ${TELEGRAM_ANALYTICS_THREAD_ID:-}
depends_on:
app:
condition: service_healthy
read_only: true
mem_limit: 128m
memswap_limit: 128m
cpus: 0.25
pids_limit: 64
logging:
options:
max-size: "10m"
max-file: "3"
cloudflared:
image: cloudflare/cloudflared:latest
restart: unless-stopped
command:
- tunnel
- --no-autoupdate
- run
- --token
- ${CLOUDFLARED_TOKEN:?set CLOUDFLARED_TOKEN}
depends_on:
app:
condition: service_healthy
read_only: true
tmpfs:
- /tmp:rw,noexec,nosuid,size=32m
mem_limit: 128m
memswap_limit: 128m
cpus: 0.25
pids_limit: 64
logging:
options:
max-size: "10m"
max-file: "3"
worker:
image: node:20-alpine
restart: unless-stopped
working_dir: /app
volumes:
- .:/app
command: node worker.js
environment:
REDIS_URL: ${REDIS_URL:-redis://redis:6379}
TELEGRAM_BOT_TOKEN: ${TELEGRAM_BOT_TOKEN:?set TELEGRAM_BOT_TOKEN}
depends_on:
redis:
condition: service_started
mem_limit: 128m
memswap_limit: 128m
cpus: 0.25
pids_limit: 64
logging:
options:
max-size: "10m"
max-file: "3"
volumes:
postgres-data: