diff --git a/whmcs-dokploy/README.md b/whmcs-dokploy/README.md new file mode 100644 index 0000000..09fcc65 --- /dev/null +++ b/whmcs-dokploy/README.md @@ -0,0 +1,7 @@ +# WHMCS for Dokploy +This is a ready to use docker compose for Dokploy compose demployment. You only need to follow instructions below for installation and deployment of WHMCS in Dokploy. + +> [!CAUTION] +> Work in progress, do not use in production. + +# 🧰 Getting Started \ No newline at end of file diff --git a/whmcs-dokploy/docker-compose.yml b/whmcs-dokploy/docker-compose.yml new file mode 100644 index 0000000..0a87c3d --- /dev/null +++ b/whmcs-dokploy/docker-compose.yml @@ -0,0 +1,90 @@ +services: + + volume_init: + image: "alpine:latest" + command: | # TODO: Create sub directories for whmcs_storage + mkdir -p /srv/data/whmcs_web-root/ /srv/data/nginx_logs/ /srv/data/whmcs_storage/ + volumes: + - whmcs-data:/srv/data + + nginx: + image: ghcr.io/edythecow/whmcs-nginx:latest + volumes: + - type: volume + source: whmcs-data + target: /var/www/html + volume: + subpath: whmcs_web-root/ + - type: volume + source: whmcs-data + target: /var/www/whmcs_storage + volume: + subpath: whmcs_storage/ + - type: volume + source: nginx-data + target: /var/log/nginx + volume: + subpath: nginx_logs/ + environment: + - NGINX_DOMAIN=${DOMAIN} + - TRAEFIK_SUBNET=${TRAEFIK_SUBNET} + - PUBLIC_SERVER_IP=${PUBLIC_SERVER_IP} + depends_on: + - volume_init + - php-fpm + labels: + # Basic auth for /admin page TODO: Move credentials directly inside the label + - "traefik.http.routers.whmcs-admin.rule=Host(`${DOMAIN}`) && PathPrefix(`/admin`)" + - "traefik.http.middlewares.basic-auth.basicauth.usersfile=/.htpasswd" + - "traefik.http.routers.whmcs-admin.middlewares=basic-auth" + - "traefik.http.routers.whmcs-admin.tls=true" + + php-fpm: + image: ghcr.io/edythecow/whmcs-php-fpm:latest + volumes: + - type: volume + source: whmcs-data + target: /var/www/html + volume: + subpath: whmcs_web-root/ + - type: volume + source: whmcs-data + target: /var/www/whmcs_storage + volume: + subpath: whmcs_storage/ + expose: + - "9000" + depends_on: + - volume_init + environment: + - PHP_IDE_CONFIG=xwhmcs + labels: + - "ofelia.enabled=true" + - "ofelia.job-exec.whmcs.schedule=@every 5m" + - "ofelia.job-exec.whmcs.command=php -q /var/www/whmcs_storage/crons/cron.php" + # Cronjobs for mail-to-ticket import. Uncomment to fetch new emails every minute. + # - "ofelia.job-exec.whmcs-mail-import.schedule=@every 1m" + # - "ofelia.job-exec.whmcs-mail-import.command=php -q /var/www/whmcs_storage/crons/pop.php" + + # Used for running WHMCS crontabs + ofelia: + image: mcuadros/ofelia:latest + depends_on: + - php-fpm + command: daemon --docker + volumes: + - /var/run/docker.sock:/var/run/docker.sock:ro + + mysql: + image: mysql:8 + environment: + - MYSQL_DATABASE=${MYSQL_DATABASE} + - MYSQL_USER=${MYSQL_USER} + - MYSQL_PASSWORD=${MYSQL_PASSWORD} + - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} + volumes: + - whmcs-database:/var/lib/mysql + +volumes: + whmcs-data: + whmcs-database: \ No newline at end of file