Hi everyone,
I’m trying to set up FrappeHR (latest version) on my server using Docker with Traefik as a reverse proxy. I need a working docker-compose.yaml
file suitable for a production environment. I would really appreciate it if someone could share a complete example that works in production. I can update the necessary environment variables (like passwords, domain, etc.) on my end. Thanks in advance for your help!
I followed the docs for setting up ERPNext using the single-server example. All the services start up, but the configurator
service exits right after starting. I’m not sure what I’m missing, so I’ll paste my docker-compose.yaml
below. If anyone can spot the issue or provide some guidance, that would be super helpful!
Thanks in advance!
name: erpnext-one
services:
backend:
depends_on:
configurator:
condition: service_completed_successfully
required: true
image: frappe/erpnext:v15.38.0
networks:
bench-network: null
platform: linux/amd64
pull_policy: always
volumes:
- type: volume
source: sites
target: /home/frappe/frappe-bench/sites
volume: {}
configurator:
command:
- |
ls -1 apps > sites/apps.txt; 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_QUEUE"; bench set-config -gp socketio_port $$SOCKETIO_PORT;
depends_on:
erpnext-mariadb:
condition: service_healthy
required: true
redis-cache:
condition: service_started
required: true
redis-queue:
condition: service_started
required: true
entrypoint:
- bash
- -c
environment:
DB_HOST: erpnext-mariadb
DB_PORT: "3306"
REDIS_CACHE: redis-cache:6379
REDIS_QUEUE: redis-queue:6379
SOCKETIO_PORT: "9000"
image: frappe/erpnext:v15.38.0
networks:
bench-network: null
platform: linux/amd64
pull_policy: always
volumes:
- type: volume
source: sites
target: /home/frappe/frappe-bench/sites
volume: {}
erpnext-mariadb:
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
- --skip-character-set-client-handshake
- --skip-innodb-read-only-compressed
container_name: erpnext-mariadb
environment:
MYSQL_ROOT_PASSWORD: randomPassword
healthcheck:
test:
- CMD-SHELL
- mysqladmin ping -h localhost --password=randomPassword
interval: 1s
retries: 15
image: mariadb:10.6
networks:
bench-network: null
volumes:
- type: volume
source: mariadb_data
target: /var/lib/mysql
volume: {}
frontend:
command:
- nginx-entrypoint.sh
depends_on:
backend:
condition: service_started
required: true
websocket:
condition: service_started
required: true
environment:
BACKEND: backend:8000
CLIENT_MAX_BODY_SIZE: 50m
FRAPPE_SITE_NAME_HEADER: $$host
PROXY_READ_TIMEOUT: "120"
SOCKETIO: websocket:9000
UPSTREAM_REAL_IP_ADDRESS: 127.0.0.1
UPSTREAM_REAL_IP_HEADER: X-Forwarded-For
UPSTREAM_REAL_IP_RECURSIVE: "off"
image: frappe/erpnext:v15.38.0
labels:
traefik.enable: "true"
traefik.http.routers.erpnext-one.entrypoints: web,websecure
traefik.http.routers.erpnext-one.rule: Host(`site1.domain.com,site2.domain.com`)
traefik.http.routers.erpnext-one.tls.certresolver: myresolver
traefik.http.services.erpnext-one.loadbalancer.server.port: "8080"
networks:
bench-network: null
traefik_network: null
platform: linux/amd64
pull_policy: always
volumes:
- type: volume
source: sites
target: /home/frappe/frappe-bench/sites
volume: {}
queue-long:
command:
- bench
- worker
- --queue
- long,default,short
depends_on:
configurator:
condition: service_completed_successfully
required: true
image: frappe/erpnext:v15.38.0
networks:
bench-network: null
platform: linux/amd64
pull_policy: always
volumes:
- type: volume
source: sites
target: /home/frappe/frappe-bench/sites
volume: {}
queue-short:
command:
- bench
- worker
- --queue
- short,default
depends_on:
configurator:
condition: service_completed_successfully
required: true
image: frappe/erpnext:v15.38.0
networks:
bench-network: null
platform: linux/amd64
pull_policy: always
volumes:
- type: volume
source: sites
target: /home/frappe/frappe-bench/sites
volume: {}
redis-cache:
image: redis:6.2-alpine
networks:
bench-network: null
volumes:
- type: volume
source: redis-cache-data
target: /data
volume: {}
redis-queue:
image: redis:6.2-alpine
networks:
bench-network: null
volumes:
- type: volume
source: redis-queue-data
target: /data
volume: {}
scheduler:
command:
- bench
- schedule
depends_on:
configurator:
condition: service_completed_successfully
required: true
image: frappe/erpnext:v15.38.0
networks:
bench-network: null
platform: linux/amd64
pull_policy: always
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
required: true
image: frappe/erpnext:v15.38.0
networks:
bench-network: null
platform: linux/amd64
pull_policy: always
volumes:
- type: volume
source: sites
target: /home/frappe/frappe-bench/sites
volume: {}
networks:
bench-network:
name: erpnext-one
traefik_network:
name: traefik_network
external: true
volumes:
mariadb_data:
name: erpnext-one_mariadb_data
redis-cache-data:
name: erpnext-one_redis-cache-data
redis-queue-data:
name: erpnext-one_redis-queue-data
sites:
name: erpnext-one_sites
x-backend-defaults:
depends_on:
configurator:
condition: service_completed_successfully
image: frappe/erpnext:v15.38.0
pull_policy: always
volumes:
- sites:/home/frappe/frappe-bench/sites
x-customizable-image:
image: frappe/erpnext:v15.38.0
pull_policy: always
x-depends-on-configurator:
depends_on:
configurator:
condition: service_completed_successfully
Also i’m getting 404 page not found for both sites