openpanel/docker/docker-compose.yml
2024-06-14 20:10:25 +02:00

156 lines
4.5 KiB
YAML

services:
# Database for OpenPanel users, plans, websites and domains
openpanel_mysql:
image: mysql/mysql-server
container_name: openpanel_mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: panel
MYSQL_USER: panel
MYSQL_PASSWORD: ${MYSQL_ROOT_PASSWORD}
ports:
- "3306:3306"
volumes:
- openadmin_mysql:/var/lib/mysql
- /etc/openpanel/:/etc/openpanel/
- /root/initialize.sql:/docker-entrypoint-initdb.d/initialize.sql
mem_limit: 1g
cpus: 1
oom_kill_disable: true
healthcheck:
test: ["CMD-SHELL", "mysql --user=panel --password=$MYSQL_ROOT_PASSWORD --execute \"SHOW DATABASES;\" || exit 1"]
interval: 10s
timeout: 10s
retries: 5
start_period: 10s
# OpenAdmin service running on port 2087
openadmin:
image: openpanel/openadmin
container_name: openadmin
depends_on:
- openpanel_mysql
#condition: service_healthy
cap_add:
- NET_ADMIN
- SYS_MODULE
healthcheck:
test: ["CMD-SHELL", "curl --fail http://localhost:2087/ || curl --fail https://localhost:2087/ || exit 1"]
interval: 30s
timeout: 10s
retries: 3
volumes:
- /lib/modules:/lib/modules:ro
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/hostfs:ro
- /home:/home
- /etc/ufw:/etc/ufw
- /usr/local/panel:/usr/local/panel
- /var/log:/var/log
- /etc/letsencrypt:/etc/letsencrypt
- /etc/my.cnf:/etc/my.cnf
- /etc/openpanel/:/etc/openpanel/
- /var/run/docker.sock:/var/run/docker.sock
- openadmin_mysql:/var/lib/mysql
- /usr/bin/docker:/usr/bin/docker
- /usr/local/admin/scripts:/usr/local/admin/scripts
network_mode: host
deploy:
resources:
limits:
memory: 1g
cpus: '1.0'
restart: always
privileged: true
# OpenPanel service running on port 2083
openpanel:
image: openpanel/openpanel
container_name: openpanel
depends_on:
- openpanel_mysql
cap_add:
- NET_ADMIN
- SYS_MODULE
healthcheck:
test: ["CMD-SHELL", "curl --fail http://localhost:2083/ || curl --fail https://localhost:2083/ || exit 1"]
interval: 30s
timeout: 10s
retries: 3
volumes:
- /lib/modules:/lib/modules:ro
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/hostfs:ro
- /home:/home
- /etc/ufw:/etc/ufw
- /usr/local/admin:/usr/local/admin
- /var/log:/var/log
- /etc/letsencrypt:/etc/letsencrypt
- /etc/my.cnf:/etc/my.cnf
- /etc/openpanel/:/etc/openpanel/
- /var/run/docker.sock:/var/run/docker.sock
- openadmin_mysql:/var/lib/mysql
- /usr/bin/docker:/usr/bin/docker
- /usr/local/admin/scripts:/usr/local/admin/scripts
network_mode: host
deploy:
resources:
limits:
memory: 1g
cpus: '2.0'
restart: always
privileged: true
# Nginx Reverse Proxy and WAF
nginx:
image: nginx
container_name: openpanel_nginx
cap_add:
- NET_ADMIN
- SYS_MODULE
ports:
- "80:80"
- "443:443"
healthcheck:
test: ["CMD-SHELL", "curl --fail http://localhost/b|| exit 1"]
interval: 30s
timeout: 10s
retries: 3
volumes:
- /etc/openpanel/nginx/nginx.conf:/etc/nginx/nginx.conf
- /etc/openpanel/nginx/vhosts/default.conf:/etc/nginx/sites-available/default
- /etc/openpanel/nginx/vhosts/default.conf:/etc/nginx/sites-enabled/default
- /etc/openpanel/nginx/vhosts/openpanel_proxy.conf:/etc/openpanel/nginx/vhosts/openpanel_proxy.conf
- /etc/nginx/sites-available/:/etc/nginx/sites-available/
- /etc/nginx/sites-enabled/:/etc/nginx/sites-enabled/
- /etc/openpanel/nginx/error_pages/snippets/:/etc/nginx/snippets/
- /etc/openpanel/nginx/error_pages/:/srv/http/default/
- /var/log/nginx/stats/:/var/log/nginx/stats/
- /var/log/nginx/domlogs/:/var/log/nginx/domlogs/
- /etc/letsencrypt:/etc/letsencrypt
- /etc/openpanel/openpanel/core/users/:/etc/openpanel/openpanel/core/users/
deploy:
resources:
limits:
memory: 1g
cpus: '1.0'
restart: always
privileged: true
oom_kill_disable: true
# User images
#openpanel_apache:
#image: openpanel/apache:latest
#entrypoint: /bin/true
#openpanel_nginx:
#image: openpanel/nginx:latest
#entrypoint: /bin/true
# make the data persistent
volumes:
openadmin_mysql: