Excel ERP Next v13 - excelbd/Excel-ERP-Production-Setup GitHub Wiki

ERPNEXT_VERSION : 13.0.0

FRAPPE_VERSION : 13.0.0

SITES = dev-erp.arcapps.org

version: "3.7"

services:
  backend:
    image: registry.gitlab.com/castlecraft/excel_erpnext/excel-erpnext-worker:${ERPNEXT_VERSION?Variable ERPNEXT_VERSION not 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: registry.gitlab.com/castlecraft/excel_erpnext/excel-erpnext-nginx:${ERPNEXT_VERSION?Variable ERPNEXT_VERSION not set}
    deploy:
      restart_policy:
        condition: on-failure
      labels:
        traefik.docker.network: traefik-public
        traefik.enable: "true"
        traefik.constraint-label: traefik-public
        # 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: https-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
        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/assets
    networks:
      - mariadb-network
      - bench-network
      - traefik-public

  queue-default:
    image: registry.gitlab.com/castlecraft/excel_erpnext/excel-erpnext-worker:${ERPNEXT_VERSION?Variable ERPNEXT_VERSION not set}
    deploy:
      restart_policy:
        condition: on-failure
    command:
      - bench
      - worker
      - --queue
      - default
    volumes:
      - sites:/home/frappe/frappe-bench/sites
    networks:
      - mariadb-network
      - bench-network

  queue-long:
    image: registry.gitlab.com/castlecraft/excel_erpnext/excel-erpnext-worker:${ERPNEXT_VERSION?Variable ERPNEXT_VERSION not set}
    deploy:
      restart_policy:
        condition: on-failure
    command:
      - bench
      - worker
      - --queue
      - long
    volumes:
      - sites:/home/frappe/frappe-bench/sites
    networks:
      - mariadb-network
      - bench-network

  queue-short:
    image: registry.gitlab.com/castlecraft/excel_erpnext/excel-erpnext-worker:${ERPNEXT_VERSION?Variable ERPNEXT_VERSION not set}
    deploy:
      restart_policy:
        condition: on-failure
    command:
      - bench
      - worker
      - --queue
      - short
    volumes:
      - sites:/home/frappe/frappe-bench/sites
    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: registry.gitlab.com/castlecraft/excel_erpnext/excel-erpnext-worker:${ERPNEXT_VERSION?Variable ERPNEXT_VERSION not set}

    deploy:
      restart_policy:
        condition: on-failure
    command:
      - bench
      - schedule
    volumes:
      - sites:/home/frappe/frappe-bench/sites
    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
    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}
  #   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-vol:/data/assets:rw
  #     - sites-vol:/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