-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
101 lines (95 loc) · 2.96 KB
/
Copy pathdocker-compose.yml
File metadata and controls
101 lines (95 loc) · 2.96 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
# ==========================================================================
# Self-hosted Flarum 2.0 — full stack: app (nginx + php-fpm + Horizon +
# realtime, all under supervisor) + MariaDB + Valkey (Redis-compatible).
#
# Generic: NO Traefik labels, NO external network. Put your own reverse proxy /
# TLS in front of the published port 80, or expose it directly. The realtime
# websocket server is also published on 6001 (and proxied at /app on port 80).
# ==========================================================================
services:
flarum:
# Prebuilt image published to GitHub Container Registry. `docker compose pull`
# grabs it; `build: .` is the local fallback (used by `up --build`).
image: ghcr.io/linkrobins/flarum-docker:latest
build: .
container_name: flarum_app
restart: unless-stopped
env_file: .env
depends_on:
mariadb:
condition: service_healthy
valkey:
condition: service_healthy
ports:
- "80:80"
- "6001:6001"
healthcheck:
test: ["CMD-SHELL", "curl -fsS -o /dev/null http://127.0.0.1/ || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 240s
volumes:
- flarum_data:/var/www/html
# Backup/restore drop-zone. Put database.sql[.gz] + storage.tar.gz here
# (see backup.sh) and they're restored on a FRESH deploy. Also where
# `docker compose exec flarum backup.sh` writes backups.
- ./restore:/restore
networks:
- flarum_net
mariadb:
image: mariadb:11
container_name: flarum_mariadb
restart: unless-stopped
command:
- --innodb-flush-log-at-trx-commit=2
- --skip-name-resolve
- --performance-schema=OFF
- --max-connections=100
environment:
- MYSQL_DATABASE=${DB_NAME:-flarum}
- MYSQL_USER=${DB_USER:-flarum}
- MYSQL_PASSWORD=${DB_PASS}
- MYSQL_ROOT_PASSWORD=${DB_ROOT_PASS}
volumes:
- mariadb_data:/var/lib/mysql
networks:
- flarum_net
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
valkey:
image: valkey/valkey:alpine
container_name: flarum_valkey
restart: unless-stopped
command:
- sh
- -c
- |
if [ -n "$$REDIS_PASSWORD" ]; then
exec valkey-server --requirepass "$$REDIS_PASSWORD" --maxmemory 128mb --maxmemory-policy volatile-lru
else
exec valkey-server --maxmemory 128mb --maxmemory-policy volatile-lru
fi
environment:
- REDIS_PASSWORD=${REDIS_PASSWORD:-}
volumes:
- valkey_data:/data
networks:
- flarum_net
healthcheck:
test: ["CMD-SHELL", "valkey-cli ${REDIS_PASSWORD:+-a $REDIS_PASSWORD} ping | grep -q PONG"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
volumes:
flarum_data:
mariadb_data:
valkey_data:
networks:
flarum_net:
driver: bridge