Custom templates & addons
Hey,
Awesome work, I'm glad I've found this repo, I'm curious how I should install, modify base WHMCS for custom styles, payment modules, assets in Dokploy?
Thanks in advance, Alex
Thank you! Took a lot of painful testing to get it where its at now!
I think the easiest way is to just SFTP into the server WHMCS is running on and locate the volume. Normally they are found at /var/lib/docker/volumes/<name of your www volume> the volume name can be found in Dokploy panel, otherwise it can be easily guessed since Dokploy uses project name to name the volumes.
This is not the most "optimal" way, but Dokploy cannot define a custom location for volumes due to how it is designed and meant to work so currently the best solution is to just access it directly.
The optimal way, I think it should be like that:
services:
nginx:
image: ghcr.io/edythecow/whmcs-nginx:latest
volumes:
- ../files:/var/www
environment:
- NGINX_DOMAIN=${DOMAIN}
- TRAEFIK_SUBNET=${TRAEFIK_SUBNET}
- PUBLIC_SERVER_IP=${PUBLIC_SERVER_IP}
depends_on:
- php-fpm
labels:
# Basic auth for /admin page
- "traefik.http.routers.whmcs-admin.rule=Host(`${DOMAIN}`) && (Path(`/admin`) || PathPrefix(`/admin/`))"
- "traefik.http.routers.whmcs-admin.entrypoints=websecure"
- "traefik.http.routers.whmcs-admin.tls=true"
- "traefik.http.routers.whmcs-admin.tls.certresolver=letsencrypt"
- "traefik.http.routers.whmcs-admin.priority=10000"
- "traefik.http.routers.whmcs-admin.service=whmcs-admin-svc"
- "traefik.http.services.whmcs-admin-svc.loadbalancer.server.port=80"
- "traefik.http.middlewares.whmcs-admin-auth.basicauth.users=${BASIC_AUTH_CREDENTIALS}"
- "traefik.http.routers.whmcs-admin.middlewares=whmcs-admin-auth@docker"
php-fpm:
image: ghcr.io/edythecow/whmcs-php-fpm:latest
volumes:
- ../files:/var/www
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-database:
The change made was to delete, the whmcs-www and use file system of Dokploy, that way the backup functions from Dokploy would still work.
What is file system of Dokploy and how would whmcs files stay persistent? Would you mind explaining it more in depth or linking related documentation?
Oh, I see, I missed the - ../files:/var/www part. I wasn't aware you could do that when using Dokploy, interesting.
All Dokploy related configurations are stored persistent to /etc/dokploy as seen bellow:
ls -l /etc/dokploy
total 32
drwxr-xr-x 5 root root 4096 Oct 24 23:40 applications
drwxr-xr-x 4 root root 4096 Oct 24 19:09 compose
drwxr-xr-x 10 root root 4096 Oct 25 01:30 logs
drwxr-xr-x 3 root root 4096 Oct 24 15:06 monitoring
drwxr-xr-x 2 root root 4096 Oct 24 15:05 schedules
drwx------ 2 root root 4096 Oct 24 22:56 ssh
drwxr-xr-x 3 root root 4096 Oct 24 15:05 traefik
drwxr-xr-x 2 root root 4096 Oct 24 15:05 volume-backups
Inside compose are stored the docker-compose files.
ls -la
total 16
drwxr-xr-x 4 root root 4096 Oct 24 19:09 .
drwxrwxrwx 10 root root 4096 Oct 24 15:26 ..
drwxr-xr-x 4 root root 4096 Oct 24 22:17 billing-whmcs-acp1mv
When doing ../files, it will create the persistent layer alongside Docker compose code folder:
ls -lah
total 16K
drwxr-xr-x 4 root root 4.0K Oct 24 22:17 .
drwxr-xr-x 4 root root 4.0K Oct 24 19:09 ..
drwxr-xr-x 2 root root 4.0K Oct 24 22:17 code
drwxr-xr-x 4 root root 4.0K Oct 24 22:17 files
ls /etc/dokploy/compose/billing-whmcs-acp1mv/files
html whmcs_storage
So, you can modify modify easily the WHMCS code.
Ah that makes sense, thanks for explanation. I assume this would only work on the server where Dokploy itself is hosted? Or would something similar also work on remote servers?
- If you choose remote servers, files would be stored to
/etc/dokployof remote server. - If it's deployed to Dokploy instance, the same applies, but it's on instance you're currently running.
I see, interesting! Thank you for pointing this out.