-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose.yml
59 lines (57 loc) · 2.52 KB
/
docker-compose.yml
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
services:
marzban:
image: gozargah/marzban:latest
restart: always
network_mode: host
env_file: .env
volumes:
- /var/lib/marzban:/var/lib/marzban
- /var/lib/marzban/logs:/var/lib/marzban-node
depends_on:
mariadb:
condition: service_healthy
mariadb:
image: mariadb:lts
restart: always
network_mode: host
env_file: .env
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_ROOT_HOST: '%'
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
command:
- --bind-address=127.0.0.1 # Restricts access to localhost for increased security
- --character_set_server=utf8mb4 # Sets UTF-8 character set for full Unicode support
- --collation_server=utf8mb4_unicode_ci # Defines collation for Unicode
- --host-cache-size=0 # Disables host cache to prevent DNS issues
- --innodb-open-files=1024 # Sets the limit for InnoDB open files
- --innodb-buffer-pool-size=256M # Allocates buffer pool size for InnoDB
- --binlog_expire_logs_seconds=1209600 # Sets binary log expiration to 14 days (2 weeks)
- --innodb-log-file-size=64M # Sets InnoDB log file size to balance log retention and performance
- --innodb-log-files-in-group=2 # Uses two log files to balance recovery and disk I/O
- --innodb-doublewrite=0 # Disables doublewrite buffer (reduces disk I/O; may increase data loss risk)
- --general_log=0 # Disables general query log to reduce disk usage
- --slow_query_log=1 # Enables slow query log for identifying performance issues
- --slow_query_log_file=/var/lib/mysql/slow.log # Logs slow queries for troubleshooting
- --long_query_time=2 # Defines slow query threshold as 2 seconds
volumes:
- /var/lib/marzban/mysql:/var/lib/mysql
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
start_period: 10s
start_interval: 3s
interval: 10s
timeout: 5s
retries: 3
nginx:
image: nginx:latest
restart: always
network_mode: host
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
- ./nginx-log:/var/log/nginx
- /etc/letsencrypt/live:/etc/letsencrypt/live
depends_on:
- marzban