|
version: "3.7" |
|
|
|
services: |
|
backend: |
|
image: frappe/erpnext-worker:${VERSION:?No image version set} |
|
deploy: |
|
restart_policy: |
|
condition: on-failure |
|
volumes: |
|
- sites:/home/frappe/frappe-bench/sites |
|
- assets:/home/frappe/frappe-bench/sites/assets |
|
networks: |
|
- mariadb-network |
|
- bench-network |
|
|
|
frontend: |
|
image: frappe/erpnext-nginx:${VERSION} |
|
deploy: |
|
restart_policy: |
|
condition: on-failure |
|
labels: |
|
traefik.docker.network: traefik-public |
|
traefik.enable: "true" |
|
traefik.constraint-label: traefik-public |
|
traefik.http.middlewares.prod-redirect.redirectscheme.scheme: https |
|
# Change router name prefix from erpnext-v13 to the name of stack in case of multi bench setup |
|
traefik.http.routers.erpnext-v13-http.rule: Host(${SITES:?No sites set}) |
|
traefik.http.routers.erpnext-v13-http.entrypoints: http |
|
# Remove following lines in case of local setup |
|
traefik.http.routers.erpnext-v13-http.middlewares: prod-redirect |
|
traefik.http.routers.erpnext-v13-https.rule: Host(${SITES}) |
|
traefik.http.routers.erpnext-v13-https.entrypoints: https |
|
traefik.http.routers.erpnext-v13-https.tls: "true" |
|
traefik.http.routers.erpnext-v13-https.tls.certresolver: le |
|
# Remove above lines in case of local setup |
|
# Uncomment and change domain for non-www to www redirect |
|
# traefik.http.routers.erpnext-v13-https.middlewares: nonwwwtowww |
|
# traefik.http.middlewares.nonwwwtowww.redirectregex.regex: ^https?://(?:www\.)?(.*) |
|
# traefik.http.middlewares.nonwwwtowww.redirectregex.replacement: https://www.$$1 |
|
traefik.http.services.erpnext-v13.loadbalancer.server.port: "8080" |
|
environment: |
|
BACKEND: backend:8000 |
|
FRAPPE_SITE_NAME_HEADER: $$host |
|
SOCKETIO: websocket:9000 |
|
UPSTREAM_REAL_IP_ADDRESS: 127.0.0.1 |
|
UPSTREAM_REAL_IP_HEADER: X-Forwarded-For |
|
UPSTREAM_REAL_IP_RECURSIVE: "off" |
|
volumes: |
|
- sites:/usr/share/nginx/html/sites |
|
- assets:/usr/share/nginx/html/sites/assets |
|
networks: |
|
- mariadb-network |
|
- bench-network |
|
- traefik-public |
|
|
|
queue-default: |
|
image: frappe/erpnext-worker:${VERSION} |
|
deploy: |
|
restart_policy: |
|
condition: on-failure |
|
command: |
|
- bench |
|
- worker |
|
- --queue |
|
- default |
|
volumes: |
|
- sites:/home/frappe/frappe-bench/sites |
|
- assets:/home/frappe/frappe-bench/sites/assets |
|
networks: |
|
- mariadb-network |
|
- bench-network |
|
|
|
queue-long: |
|
image: frappe/erpnext-worker:${VERSION} |
|
deploy: |
|
restart_policy: |
|
condition: on-failure |
|
command: |
|
- bench |
|
- worker |
|
- --queue |
|
- long |
|
volumes: |
|
- sites:/home/frappe/frappe-bench/sites |
|
- assets:/home/frappe/frappe-bench/sites/assets |
|
networks: |
|
- mariadb-network |
|
- bench-network |
|
|
|
queue-short: |
|
image: frappe/erpnext-worker:${VERSION} |
|
deploy: |
|
restart_policy: |
|
condition: on-failure |
|
command: |
|
- bench |
|
- worker |
|
- --queue |
|
- short |
|
volumes: |
|
- sites:/home/frappe/frappe-bench/sites |
|
- assets:/home/frappe/frappe-bench/sites/assets |
|
networks: |
|
- mariadb-network |
|
- bench-network |
|
|
|
redis-cache: |
|
image: redis:6.2-alpine |
|
deploy: |
|
restart_policy: |
|
condition: on-failure |
|
volumes: |
|
- redis-cache-data:/data |
|
networks: |
|
- bench-network |
|
|
|
redis-queue: |
|
image: redis:6.2-alpine |
|
deploy: |
|
restart_policy: |
|
condition: on-failure |
|
volumes: |
|
- redis-queue-data:/data |
|
networks: |
|
- bench-network |
|
|
|
redis-socketio: |
|
image: redis:6.2-alpine |
|
deploy: |
|
restart_policy: |
|
condition: on-failure |
|
volumes: |
|
- redis-socketio-data:/data |
|
networks: |
|
- bench-network |
|
|
|
scheduler: |
|
image: frappe/erpnext-worker:${VERSION} |
|
deploy: |
|
restart_policy: |
|
condition: on-failure |
|
command: |
|
- bench |
|
- schedule |
|
volumes: |
|
- sites:/home/frappe/frappe-bench/sites |
|
- assets:/home/frappe/frappe-bench/sites/assets |
|
networks: |
|
- mariadb-network |
|
- bench-network |
|
|
|
websocket: |
|
image: frappe/frappe-socketio:${FRAPPE_VERSION:?No frappe image version set} |
|
deploy: |
|
restart_policy: |
|
condition: on-failure |
|
volumes: |
|
- sites:/home/frappe/frappe-bench/sites |
|
- assets:/home/frappe/frappe-bench/sites/assets |
|
networks: |
|
- mariadb-network |
|
- bench-network |
|
|
|
# Add migrate-sites-script.sh as migrate-sites-script config |
|
# and uncomment following to enable migration on stack (re)deloyment. |
|
|
|
# migration: |
|
# image: frappe/erpnext-worker:${VERSION} |
|
# deploy: |
|
# restart_policy: |
|
# condition: none |
|
# entrypoint: ["bash", "-c"] |
|
# command: |
|
# - | |
|
# for SITE in $$(/home/frappe/frappe-bench/env/bin/python -c "import frappe;print(' '.join(frappe.utils.get_sites()))") |
|
# do |
|
# bench --site $$SITE set-config -p maintenance_mode 1 |
|
# bench --site $$SITE set-config -p pause_scheduler 1 |
|
# bench --site $$SITE migrate |
|
# bench --site $$SITE set-config -p maintenance_mode 0 |
|
# bench --site $$SITE set-config -p pause_scheduler 0 |
|
# done |
|
# volumes: |
|
# - sites:/home/frappe/frappe-bench/sites |
|
# - assets:/home/frappe/frappe-bench/sites/assets |
|
# networks: |
|
# - mariadb-network |
|
# - bench-network |
|
|
|
# populate-assets: |
|
# image: frappe/erpnext-nginx:${VERSION} |
|
# deploy: |
|
# restart_policy: |
|
# condition: none |
|
# entrypoint: ["sh", "-c"] |
|
# command: |
|
# - > |
|
# cp -fR /usr/share/nginx/html/assets /data; |
|
# touch /data/sites/.build; |
|
# volumes: |
|
# - assets:/data/assets:rw |
|
# - sites:/data/sites:rw |
|
|
|
volumes: |
|
assets: |
|
db-data: |
|
redis-cache-data: |
|
redis-queue-data: |
|
redis-socketio-data: |
|
sites: |
|
|
|
networks: |
|
bench-network: |
|
# Change network name from erpnext-v13 to the name of stack in case of multi bench setup |
|
name: erpnext-v13 |
|
external: false |
|
mariadb-network: |
|
name: mariadb-network |
|
external: true |
|
traefik-public: |
|
name: traefik-public |
|
external: true |
|
|
|
# Note: set VERSION, FRAPPE_VERSION and SITES |
maintained version here: https://github.com/castlecraft/custom_containers/blob/main/docs/docker-swarm.md