erpnext部署

部署

version: "3"
​
services:
  backend:
    image: harbor.nail.com.cn/base/erpnext_oob:v14.0.2
    deploy:
      restart_policy:
        condition: on-failure
    volumes:
      - ./erpnext_oob_sites:/home/frappe/frappe-bench/sites
      - ./erpnext_oob_logs:/home/frappe/frappe-bench/logs
​
  configurator:
    image: harbor.nail.com.cn/base/erpnext_oob:v14.0.2
    entrypoint:
      - bash
      - -c
    links:
      - redis-cache
      - redis-queue
      - redis-socketio
      - db
    depends_on:
      - redis-cache
      - redis-queue
      - redis-socketio
      - db
    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;
    environment:
      DB_HOST: db
      DB_PORT: "3306"
      REDIS_CACHE: redis-cache:6379
      REDIS_QUEUE: redis-queue:6379
      REDIS_SOCKETIO: redis-socketio:6379
      SOCKETIO_PORT: "9000"
    volumes:
      - ./erpnext_oob_sites:/home/frappe/frappe-bench/sites
      - ./erpnext_oob_logs:/home/frappe/frappe-bench/logs
​
  create-site:
    image: harbor.nail.com.cn/base/erpnext_oob:v14.0.2
    volumes:
      - ./erpnext_oob_sites:/home/frappe/frappe-bench/sites
      - ./erpnext_oob_logs:/home/frappe/frappe-bench/logs
    entrypoint:
      - bash
      - -c
    command:
      - >
        wait-for-it -t 120 db:3306;
        wait-for-it -t 120 redis-cache:6379;
        wait-for-it -t 120 redis-queue:6379;
        wait-for-it -t 120 redis-socketio:6379;
        export start=`date +%s`;
        until [[ -n `grep -hs ^ sites/common_site_config.json | jq -r ".db_host // empty"` ]] && \
          [[ -n `grep -hs ^ sites/common_site_config.json | jq -r ".redis_cache // empty"` ]] && \
          [[ -n `grep -hs ^ sites/common_site_config.json | jq -r ".redis_queue // empty"` ]];
        do
          echo "Waiting for sites/common_site_config.json to be created";
          sleep 5;
          if (( `date +%s`-start > 120 )); then
            echo "could not find sites/common_site_config.json with required keys";
            exit 1
          fi
        done;
        echo "sites/common_site_config.json found";        
        bench new-site frontend.localhost --no-mariadb-socket --admin-password=admin --db-root-password=admin --set-default \
          --install-app payments --install-app erpnext --install-app erpnext_chinese --install-app erpnext_oob --install-app zelin_permission ;
        echo frappe > sites/apps.txt;
        echo payments >> sites/apps.txt;
        echo erpnext >> sites/apps.txt;
        echo erpnext_chinese >> sites/apps.txt;
        echo erpnext_oob >> sites/apps.txt;
        echo zelin_permission >> sites/apps.txt;
​
  db:
    image: harbor.nail.com.cn/base/mariadb:10.6
    healthcheck:
      test: mysqladmin ping -h localhost --password=admin
      interval: 1s
      retries: 15
    deploy:
      restart_policy:
        condition: on-failure
    command:
      - --character-set-server=utf8mb4
      - --collation-server=utf8mb4_unicode_ci
      - --skip-character-set-client-handshake
      - --skip-innodb-read-only-compressed # Temporary fix for MariaDB 10.6
    environment:
      MYSQL_ROOT_PASSWORD: admin
    volumes:
      - ./erpnext_oob_db-data:/var/lib/mysql
​
  frontend:
    image: harbor.nail.com.cn/base/erpnext_oob:v14.0.2
    deploy:
      restart_policy:
        condition: on-failure
    command:
      - nginx-entrypoint.sh
    environment:
      BACKEND: backend:8000
      FRAPPE_SITE_NAME_HEADER: frontend.localhost
      SOCKETIO: websocket:9000
      UPSTREAM_REAL_IP_ADDRESS: 127.0.0.1
      UPSTREAM_REAL_IP_HEADER: X-Forwarded-For
      UPSTREAM_REAL_IP_RECURSIVE: "off"
      PROXY_READ_TIMOUT: 120
      CLIENT_MAX_BODY_SIZE: 50m
    volumes:
      - ./erpnext_oob_sites:/home/frappe/frappe-bench/sites
      - ./erpnext_oob_logs:/home/frappe/frappe-bench/logs
    ports:
      - "8080:8080"
​
  queue-default:
    image: harbor.nail.com.cn/base/erpnext_oob:v14.0.2
    deploy:
      restart_policy:
        condition: on-failure
    command:
      - bench
      - worker
      - --queue
      - default
    volumes:
      - ./erpnext_oob_sites:/home/frappe/frappe-bench/sites
      - ./erpnext_oob_logs:/home/frappe/frappe-bench/logs
​
  queue-long:
    image: harbor.nail.com.cn/base/erpnext_oob:v14.0.2
    deploy:
      restart_policy:
        condition: on-failure
    command:
      - bench
      - worker
      - --queue
      - long
    volumes:
      - ./erpnext_oob_sites:/home/frappe/frappe-bench/sites
      - ./erpnext_oob_logs:/home/frappe/frappe-bench/logs
​
  queue-short:
    image: harbor.nail.com.cn/base/erpnext_oob:v14.0.2
    deploy:
      restart_policy:
        condition: on-failure
    command:
      - bench
      - worker
      - --queue
      - short
    volumes:
      - ./erpnext_oob_sites:/home/frappe/frappe-bench/sites
      - ./erpnext_oob_logs:/home/frappe/frappe-bench/logs
​
  redis-queue:
    image: harbor.nail.com.cn/base/redis:6.2-alpine
    deploy:
      restart_policy:
        condition: on-failure
    volumes:
      - ./erpnext_oob_redis-queue-data:/data
​
  redis-cache:
    image: harbor.nail.com.cn/base/redis:6.2-alpine
    deploy:
      restart_policy:
        condition: on-failure
    volumes:
      - ./erpnext_oob_redis-cache-data:/data
​
  redis-socketio:
    image: harbor.nail.com.cn/base/redis:6.2-alpine
    deploy:
      restart_policy:
        condition: on-failure
    volumes:
      - ./erpnext_oob_redis-socketio-data:/data
​
  scheduler:
    image: harbor.nail.com.cn/base/erpnext_oob:v14.0.2
    deploy:
      restart_policy:
        condition: on-failure
    command:
      - bench
      - schedule
    volumes:
      - ./erpnext_oob_sites:/home/frappe/frappe-bench/sites
      - ./erpnext_oob_logs:/home/frappe/frappe-bench/logs
​
  websocket:
    image: harbor.nail.com.cn/base/erpnext_oob:v14.0.2
    deploy:
      restart_policy:
        condition: on-failure
    command:
      - node
      - /home/frappe/frappe-bench/apps/frappe/socketio.js
    volumes:
      - ./erpnext_oob_sites:/home/frappe/frappe-bench/sites
      - ./erpnext_oob_logs:/home/frappe/frappe-bench/logs

附 单配置文件内容介绍

此配置文件 pwd.yml 包括了全部系统进程,本容器部署方式取代单机正式运行中的supervisor进程管理机制

服务

bench服务进程

  • frontend 前端, nginx反向代理,响应html, js, css等静态资源请求, 动态资源请求转给后端与websocket.

  • backend 后端,

  • websocket, nodejs长连接(用于服务器实时推送单据变更通知).

  • schedule, 后台任务排程器.

  • queue-default, 后台任务-默认.

  • queue-long, 后台任务-长(执行时间长)

  • queue-short, 后台任务-短(执行时间短).

依赖的服务,即数据库与缓存数据库

  • db, mariadb, mariadb数据库.

  • redis-cache, 用于后端服务的redis缓存队列.

  • redis-queue, 用于后台任务的redis缓存列队.

  • redis-socketio, 用于websocket长连接的redis缓存队列.

仅运行一次的配置服务进程

  • configurator 配置服务, 基于common_site_config.json配置前、后端及后台任务使用的数据库与redis缓存服务(数据库连接参数).

  • create-site 创建站点, 创建一个数据库(站点).

  • 17
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

SuperGloo

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值