I’m trying to setup production server using docker.
I’ve create Docker Image pipech/erpnext which is self-contained images, it works fine in development setup
Now I want to setup production server.
First I’ve tried using
sudo bench setup production but centos images doesn’t enable systemd by default, I tried setting it up using guide form Docker but I can’t get it done.
So I take a look in
bench setup production command from what I understand
bench setup production does 4 things (From Setup Production and bench/production_setup.py at master · frappe/bench · GitHub)
- make nginx conf and link it to /etc/nginx/conf.d/
- make supervisor conf and link it to /etc/supervisor/conf.d/
- load nginx
- load supervisor
So what I’ve done is
- make nginx conf and copy it to nginx image
- make supervisor conf and copy it to /etc/supervisor/conf.d/
- load nginx in nginx image using docker-compose
- load supervisor in erpnext image using shell script
But it didn’t work
- localhost:8000 > This page isn’t working localhost didn’t send any data. ERR_EMPTY_RESPONSE
- localhost:9000 > Error: ENOENT: no such file or directory, stat ‘/home/frappe/bench-dev/index.html’
- localhost > 404 Not Found nginx/1.13.8
I’ve check supervisor is running
bench-dev-web:bench-dev-frappe-web RUNNING pid 303, uptime 0:38:54 bench-dev-web:bench-dev-node-socketio RUNNING pid 304, uptime 0:38:54 bench-dev-workers:bench-dev-frappe-default-worker-0 RUNNING pid 336, uptime 0:38:52 bench-dev-workers:bench-dev-frappe-long-worker-0 RUNNING pid 333, uptime 0:38:52 bench-dev-workers:bench-dev-frappe-schedule RUNNING pid 318, uptime 0:38:53 bench-dev-workers:bench-dev-frappe-short-worker-0 RUNNING pid 355, uptime 0:38:51
Nginx is running nginx.conf is at /etc/nginx/conf.d/ in nginx image
docker-compose file is here > https://github.com/pipech/docker-centos-erpnext-production
How to use
- clone repository
- docker-compose up
- docker ps > find erpnext container id
- docker exec -it [erpnext container id] bash
- cd … && cd frappe-docker-conf && . init.sh
The reason I want to set up this way mostly because stability, to gain more control over bench, frappe or erpnext update (easyinstall always give you latest update), if newest commit doesn’t work I can just use old image in docker hub which i know it will work.
Thank you in advance for any help