Using this to generate the docker compose file needed for my site (behind Portainer and NPM), i managed to make it work.
below is the extract of my custom docker-compose which i use in the portainer stack along with the .env for easier deployment:
version: "3"
services:
backend:
depends_on:
configurator:
condition: service_completed_successfully
image: frappe/erpnext:${ERPNEXT_VERSION}
networks:
default: null
volumes:
- type: volume
source: sites
target: /home/frappe/frappe-bench/sites
volume: {}
configurator:
command:
- |
bench set-config -g db_host $$DB_HOST; bench set-config -gp db_port $$DB_PORT; bench set-config -g redis_cache "redis://$$REDIS_CACHE"; bench set-config -g redis_queue "redis://$$REDIS_QUEUE"; bench set-config -g redis_socketio "redis://$$REDIS_SOCKETIO"; bench set-config -gp socketio_port $$SOCKETIO_PORT;
depends_on:
erpnextdb:
condition: service_healthy
redis-cache:
condition: service_started
redis-queue:
condition: service_started
redis-socketio:
condition: service_started
entrypoint:
- bash
- -c
environment:
DB_HOST: erpnextdb
DB_PORT: "3306"
REDIS_CACHE: redis-cache:6379
REDIS_QUEUE: redis-queue:6379
REDIS_SOCKETIO: redis-socketio:6379
SOCKETIO_PORT: "19000"
DB_ROOT_USER: ${DB_ROOT_USER}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
image: frappe/erpnext:${ERPNEXT_VERSION}
networks:
default: null
volumes:
- type: volume
source: sites
target: /home/frappe/frappe-bench/sites
volume: {}
erpnextdb:
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
- --skip-character-set-client-handshake
- --skip-innodb-read-only-compressed
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
healthcheck:
test:
- CMD-SHELL
- mysqladmin ping -h localhost --password=${MYSQL_ROOT_PASSWORD}
interval: 1s
retries: 15
image: mariadb:10.6
networks:
default: null
volumes:
- type: volume
source: db-data
target: /var/lib/mysql
volume: {}
frontend:
command:
- nginx-entrypoint.sh
depends_on:
backend:
condition: service_started
websocket:
condition: service_started
environment:
BACKEND: backend:8000
CLIENT_MAX_BODY_SIZE: 50m
FRAPPE_SITE_NAME_HEADER: ${SITE_NAME}
PROXY_READ_TIMOUT: "120"
SOCKETIO: websocket:19000
UPSTREAM_REAL_IP_ADDRESS: 127.0.0.1
UPSTREAM_REAL_IP_HEADER: X-Forwarded-For
UPSTREAM_REAL_IP_RECURSIVE: "off"
image: frappe/erpnext:${ERPNEXT_VERSION}
networks:
default: null
ports:
- mode: ingress
target: 8080
published: "18080"
protocol: tcp
volumes:
- type: volume
source: sites
target: /home/frappe/frappe-bench/sites
volume: {}
queue-default:
command:
- bench
- worker
- --queue
- default
depends_on:
configurator:
condition: service_completed_successfully
image: frappe/erpnext:${ERPNEXT_VERSION}
networks:
default: null
volumes:
- type: volume
source: sites
target: /home/frappe/frappe-bench/sites
volume: {}
queue-long:
command:
- bench
- worker
- --queue
- long
depends_on:
configurator:
condition: service_completed_successfully
image: frappe/erpnext:${ERPNEXT_VERSION}
networks:
default: null
volumes:
- type: volume
source: sites
target: /home/frappe/frappe-bench/sites
volume: {}
queue-short:
command:
- bench
- worker
- --queue
- short
depends_on:
configurator:
condition: service_completed_successfully
image: frappe/erpnext:${ERPNEXT_VERSION}
networks:
default: null
volumes:
- type: volume
source: sites
target: /home/frappe/frappe-bench/sites
volume: {}
redis-cache:
image: redis:6.2-alpine
networks:
default: null
volumes:
- type: volume
source: redis-cache-data
target: /data
volume: {}
redis-queue:
image: redis:6.2-alpine
networks:
default: null
volumes:
- type: volume
source: redis-queue-data
target: /data
volume: {}
redis-socketio:
image: redis:6.2-alpine
networks:
default: null
volumes:
- type: volume
source: redis-socketio-data
target: /data
volume: {}
scheduler:
command:
- bench
- schedule
depends_on:
configurator:
condition: service_completed_successfully
image: frappe/erpnext:${ERPNEXT_VERSION}
networks:
default: null
volumes:
- type: volume
source: sites
target: /home/frappe/frappe-bench/sites
volume: {}
websocket:
command:
- node
- /home/frappe/frappe-bench/apps/frappe/socketio.js
depends_on:
configurator:
condition: service_completed_successfully
image: frappe/erpnext:${ERPNEXT_VERSION}
networks:
default: null
volumes:
- type: volume
source: sites
target: /home/frappe/frappe-bench/sites
volume: {}
networks:
default:
name: frappe_docker_default
volumes:
db-data:
name: frappe_docker_db-data
redis-cache-data:
name: frappe_docker_redis-cache-data
redis-queue-data:
name: frappe_docker_redis-queue-data
redis-socketio-data:
name: frappe_docker_redis-socketio-data
sites:
name: frappe_docker_sites
x-backend-defaults:
depends_on:
configurator:
condition: service_completed_successfully
image: frappe/erpnext:${ERPNEXT_VERSION}
volumes:
- sites:/home/frappe/frappe-bench/sites
x-customizable-image:
image: frappe/erpnext:${ERPNEXT_VERSION}
x-depends-on-configurator:
depends_on:
configurator:
condition: service_completed_successfully
.env file:
ERPNEXT_VERSION=v14
DB_ROOT_USER=root
MYSQL_ROOT_PASSWORD=CHANGEMEf7t3c48wfbvh56e
SITE_NAME=changeme.example.org
once the stack is on, i need to create the site from within the console of the backend:
bench new-site changeme.example.org
and then
bench use changeme.example.org
bench enable-scheduler
then i installed the erpnext app:
bench --site changeme.example.org install-app erpnext
then i configured NPM to point to port 18080 and everything worked fine, i was able to use frappe and erpnext.
then i needed to have my own application where i use custom modules and create custom forms and doctypes, but my site stops as soon as i create it and install it:
bench new-app app-name
bench --site changeme.example.org install-app
i think i am missing some steps between the new-app command and install-app command where maybe i need to create some configuration to the app…
can anyone support in how to do this last step?