-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
162 lines (157 loc) · 4.33 KB
/
docker-compose.yml
File metadata and controls
162 lines (157 loc) · 4.33 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
services:
# Lavalink Audio Server (for music streaming)
lavalink:
image: ghcr.io/lavalink-devs/lavalink:4
container_name: lavalink
restart: unless-stopped
environment:
- LAVALINK_PASSWORD=${LAVALINK_PASSWORD:-youshallnotpass}
- _JAVA_OPTIONS=-Xmx512m -Xms256m
volumes:
- ./lavalink/application.yml:/opt/Lavalink/application.yml
- ./logs/lavalink:/opt/Lavalink/logs
expose:
- "2333"
deploy:
resources:
limits:
memory: 640M
cpus: '1.5'
reservations:
memory: 256M
cpus: '0.5'
healthcheck:
# Use /version endpoint with Authorization header to avoid warning logs
test: ["CMD-SHELL", "curl -s -H 'Authorization: ${LAVALINK_PASSWORD:-youshallnotpass}' http://localhost:2333/version || exit 1"]
interval: 10s
timeout: 5s
retries: 5
start_period: 45s
networks:
- discord-network
# Discord Bot (Node.js)
discord-bot:
build:
context: ./bot
dockerfile: Dockerfile
container_name: discord-bot
env_file: .env
environment:
- NODE_ENV=production
- NODE_OPTIONS=--max-old-space-size=192
- DATABASE_URL=${DATABASE_URL}
# - REDIS_URL=${REDIS_URL} # Disabled - Redis not currently used
- DISCORD_TOKEN=${DISCORD_TOKEN}
- DISCORD_CLIENT_ID=${DISCORD_CLIENT_ID}
- SPOTIFY_CLIENT_ID=${SPOTIFY_CLIENT_ID}
- SPOTIFY_CLIENT_SECRET=${SPOTIFY_CLIENT_SECRET}
- YOUTUBE_COOKIE=${YOUTUBE_COOKIE:-}
- LAVALINK_HOST=${LAVALINK_HOST:-lavalink}
- LAVALINK_PORT=${LAVALINK_PORT:-2333}
- LAVALINK_PASSWORD=${LAVALINK_PASSWORD:-youshallnotpass}
depends_on:
postgres:
condition: service_healthy
# redis: # Disabled - Redis not currently used
# condition: service_healthy
lavalink:
condition: service_healthy
restart: unless-stopped
volumes:
- ./logs/bot:/app/logs
deploy:
resources:
limits:
memory: 256M
cpus: '0.8'
reservations:
memory: 128M
cpus: '0.3'
# Health check uses process monitoring instead of HTTP (bot has no HTTP server)
healthcheck:
test: ["CMD-SHELL", "pgrep -f 'node dist/index.js' || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
networks:
- discord-network
# PostgreSQL Database
postgres:
image: postgres:18-alpine
container_name: discord-postgres
environment:
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
command:
- "postgres"
- "-c"
- "shared_buffers=64MB"
- "-c"
- "effective_cache_size=128MB"
- "-c"
- "max_connections=30"
- "-c"
- "work_mem=4MB"
volumes:
- postgres-data:/var/lib/postgresql/data
- ./database/init.sql:/docker-entrypoint-initdb.d/init.sql
restart: unless-stopped
expose:
- "5432"
deploy:
resources:
limits:
memory: 256M
cpus: '0.6'
reservations:
memory: 96M
cpus: '0.2'
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 10s
timeout: 5s
retries: 5
networks:
- discord-network
# Redis Cache (DISABLED - not currently used, saves 64MB memory)
# Uncomment below if you need Redis for caching in the future
# redis:
# image: redis:7-alpine
# container_name: discord-redis
# restart: unless-stopped
# command: >
# redis-server
# --save 900 1 --save 300 10 --save 60 10000
# --requirepass ${REDIS_PASSWORD}
# --maxmemory 48mb
# --maxmemory-policy allkeys-lru
# volumes:
# - redis-data:/data
# expose:
# - "6379"
# deploy:
# resources:
# limits:
# memory: 64M
# cpus: '0.2'
# reservations:
# memory: 48M
# cpus: '0.1'
# healthcheck:
# test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"]
# interval: 10s
# timeout: 3s
# retries: 5
# networks:
# - discord-network
volumes:
postgres-data:
driver: local
# redis-data: # Disabled - Redis not currently used
# driver: local
networks:
discord-network:
driver: bridge
internal: false