-
-
Notifications
You must be signed in to change notification settings - Fork 301
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
201 lines (189 loc) · 5.22 KB
/
Copy pathdocker-compose.yml
File metadata and controls
201 lines (189 loc) · 5.22 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
x-common-env-vars:
- &postgres-db
POSTGRES_DB=ballsdex
- &postgres-user
POSTGRES_USER=ballsdex
- &postgres-url
"BALLSDEXBOT_DB_URL=postgres://ballsdex:${POSTGRES_PASSWORD}@postgres:5432/ballsdex"
# if serving the admin panel online, copy the file "production.example.py" and set
# DJANGO_SETTINGS_MODULE=config.production via docker-compose.override.yml, see
# docs/selfhosting/admin-panel/exposing-to-internet.md
- &django-settings
"DJANGO_SETTINGS_MODULE=admin_panel.settings"
services:
bot:
restart: "no"
image: ballsdex
build: .
environment:
- *postgres-url
- *django-settings
depends_on:
migration:
condition: service_completed_successfully
postgres-db:
condition: service_healthy
# ports:
# - "127.0.0.1:15260:15260"
networks:
- internal
volumes:
- "./logs/:/var/log/ballsdex/:rw"
- "./config:/code/admin_panel/config:ro"
- "./extra:/code/extra:ro"
- "./admin_panel/media:/code/admin_panel/media:rw"
tty: true
command: python3 -m ballsdex --dev
develop:
watch:
- path: ./ballsdex/packages
target: /opt/venv/lib/python3.14/site-packages/ballsdex/packages
initial_sync: true
action: sync
ignore:
- "*.pyc"
- path: ./ballsdex
target: /opt/venv/lib/python3.14/site-packages/ballsdex
initial_sync: true
action: sync+restart
include:
- "core/**/*.py"
- path: ./admin_panel
target: /opt/venv/lib/python3.14/site-packages
initial_sync: true
action: sync+restart
ignore:
- "*.pyc"
- path: ./uv.lock
action: rebuild
admin-panel:
image: ballsdex
build: .
hostname: admin-panel
networks:
- internal
- nginx
environment:
- *postgres-url
- *django-settings
depends_on:
migration:
condition: service_completed_successfully
postgres-db:
condition: service_healthy
volumes:
- "./logs/:/var/log/ballsdex/:rw"
- "./config:/code/admin_panel/config:ro"
- "./extra:/code/extra:ro"
- "./admin_panel/templates:/code/admin_panel/templates:ro"
- "./admin_panel/media:/code/admin_panel/media:rw"
tty: true
command: "python3 -m uvicorn admin_panel.asgi:application --host 0.0.0.0"
develop:
watch:
- path: ./admin_panel
target: /opt/venv/lib/python3.14/site-packages
initial_sync: true
action: sync+restart
include:
- "admin_panel/**/*.py"
- "bd_models/**/*.py"
- "preview/**/*.py"
- "settings/**/*.py"
- "templates/**/*"
- "users/**/*.py"
- path: ./uv.lock
action: rebuild
migration:
image: ballsdex
build: .
networks:
- internal
environment:
- *postgres-url
- *django-settings
- "STATIC_ROOT=/var/www/ballsdex/static"
volumes:
- "./config:/code/admin_panel/config:ro"
- "./extra:/code/extra:rw"
depends_on:
postgres-db:
condition: service_healthy
command: >
sh -c "python3 -m django migrate --no-input --fake-initial"
proxy:
build:
context: .
target: proxy
restart: on-failure:3
hostname: nginx
depends_on:
admin-panel:
condition: service_started
ports:
- "127.0.0.1:8000:80"
networks:
- nginx
volumes:
- ./bd-nginx.conf:/etc/nginx/conf.d/default.conf:ro
- ./admin_panel/media:/var/www/ballsdex/media:ro
postgres-db:
image: postgres:18.1-alpine3.22
restart: always
hostname: postgres
shm_size: 1g
environment:
- *postgres-db
- *postgres-user
- POSTGRES_PASSWORD
# WARNING: before exposing ports, change the default db password in the .env file!
# ports:
# - "127.0.0.1:5432:5432"
networks:
- internal
volumes: # Persist the db data
- database-data:/var/lib/postgresql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-ballsdex}"]
interval: 5s
timeout: 5s
retries: 5
postgres-backup:
image: prodrigestivill/postgres-backup-local:18-alpine-d257e5d
restart: always
# Uncomment to have the backup files owned by your local user instead of root
# user: username
volumes:
- ./pgbackups:/backups
depends_on:
postgres-db:
condition: service_healthy
networks:
- internal
environment:
- *postgres-db
- *postgres-user
- POSTGRES_PASSWORD
- POSTGRES_HOST=postgres
- SCHEDULE=@daily
- BACKUP_KEEP_DAYS=7
- BACKUP_KEEP_WEEKS=4
- BACKUP_KEEP_MONTHS=6
- HEALTHCHECK_PORT=3928
# Uncomment to enable gateway proxy feature and
# add "--gateway-url ws://gateway_proxy:5421" to your startup flags
# Also change tag corresponding to your platform if not x86-64
#
# gateway-proxy:
# container_name: gateway_proxy
# image: ghcr.io/martinebot/gateway-proxy:x86-64
# restart: always
# volumes:
# - ./gatewayproxy/config.json:/config.json
# networks:
# - internal
volumes:
database-data:
networks:
internal:
nginx: