什么是 ERPNext ?

ERPNext 是一种免费的、开源的企业资源规划(ERP)软件,它提供了一套完整的企业解决方案,包括会计、采购、销售、库存、制造、CRM 等功能。ERPNext 旨在为中小型企业提供一种简单、易用、灵活的 ERP 系统,以帮助企业管理业务流程、优化运营效率、提高生产力和盈利能力。ERPNext 建立在 Frappe 框架之上,这是一个使用 Python 和 JavaScript 构建的全栈 web 应用程序框架。

env.txt

# ERPNext config
APP_NAME=erp
APP_VERSION=v14.23.0
APP_HTTP_IP=192.168.0.197
APP_HTTP_PORT=6380
APP_PASSWORD=admin

# MariaDB config
DB_HOST=db
DB_PASSWORD=twj9nwyoutRei9C4VV
DB_ROOT_PASSWORD=4aixKdghP3j56hPB8k
DB_PORT=3336

erpnext.yml

version: "3"

services:
  backend:
    image: frappe/erpnext:${APP_VERSION}
    container_name: ${APP_NAME}-backend
    deploy:
      restart_policy:
        condition: on-failure
    volumes:
      - sites:/home/frappe/frappe-bench/sites
      - logs:/home/frappe/frappe-bench/logs
      
  configurator:
    image: frappe/erpnext:${APP_VERSION}
    container_name: ${APP_NAME}-configurator
    deploy:
      restart_policy:
        condition: none
    entrypoint:
      - bash
      - -c
    depends_on:
      - db
    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_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:
      - sites:/home/frappe/frappe-bench/sites
      - logs:/home/frappe/frappe-bench/logs
      
  create-site:
    image: frappe/erpnext:${APP_VERSION}
    container_name: ${APP_NAME}-create-site
    depends_on:
      - configurator
    deploy:
      restart_policy:
        condition: none
    volumes:
      - sites:/home/frappe/frappe-bench/sites
      - logs:/home/frappe/frappe-bench/logs
    entrypoint:
      - bash
      - -c
    command:
      - >
        wait-for-it -t 240 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 --no-mariadb-socket --admin-password=${APP_PASSWORD} --db-root-password=${DB_ROOT_PASSWORD} --install-app erpnext --set-default;

  db:
    image: mariadb:10.6
    container_name: ${APP_NAME}-db
    healthcheck:
      test: mysqladmin ping -h localhost --password=${DB_PASSWORD}
      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: ${DB_ROOT_PASSWORD}
    volumes:
      - ./data:/var/lib/mysql
    #ports:
    #  - "${DB_PORT}:3306"

  frontend:
    image: frappe/erpnext:${APP_VERSION}
    container_name: ${APP_NAME}-frontend
    deploy:
      restart_policy:
        condition: on-failure
    command:
      - nginx-entrypoint.sh
    environment:
      BACKEND: backend:8000
      FRAPPE_SITE_NAME_HEADER: frontend
      SOCKETIO: websocket:9000
      UPSTREAM_REAL_IP_ADDRESS: ${APP_HTTP_IP}
      UPSTREAM_REAL_IP_HEADER: X-Forwarded-For
      UPSTREAM_REAL_IP_RECURSIVE: "off"
      PROXY_READ_TIMOUT: 120
      CLIENT_MAX_BODY_SIZE: 50m
    volumes:
      - sites:/home/frappe/frappe-bench/sites
      - logs:/home/frappe/frappe-bench/logs
    ports:
      - "${APP_HTTP_PORT}:8080"

  queue-default:
    image: frappe/erpnext:${APP_VERSION}
    container_name: ${APP_NAME}-queue-default
    deploy:
      restart_policy:
        condition: on-failure
    command:
      - bench
      - worker
      - --queue
      - default
    volumes:
      - sites:/home/frappe/frappe-bench/sites
      - logs:/home/frappe/frappe-bench/logs

  queue-long:
    image: frappe/erpnext:${APP_VERSION}
    container_name: ${APP_NAME}-queue-long
    deploy:
      restart_policy:
        condition: on-failure
    command:
      - bench
      - worker
      - --queue
      - long
    volumes:
      - sites:/home/frappe/frappe-bench/sites
      - logs:/home/frappe/frappe-bench/logs

  queue-short:
    image: frappe/erpnext:${APP_VERSION}
    container_name: ${APP_NAME}-queue-short
    deploy:
      restart_policy:
        condition: on-failure
    command:
      - bench
      - worker
      - --queue
      - short
    volumes:
      - sites:/home/frappe/frappe-bench/sites
      - logs:/home/frappe/frappe-bench/logs

  redis-queue:
    image: redis:6.2-alpine
    container_name: ${APP_NAME}-redis-queue
    deploy:
      restart_policy:
        condition: on-failure
    volumes:
      - ./redis-queue-data:/data

  redis-cache:
    image: redis:6.2-alpine
    container_name: ${APP_NAME}-redis-cache
    deploy:
      restart_policy:
        condition: on-failure
    volumes:
      - ./redis-cache-data:/data

  redis-socketio:
    image: redis:6.2-alpine
    container_name: ${APP_NAME}-redis-socketio
    deploy:
      restart_policy:
        condition: on-failure
    volumes:
      - ./redis-socketio-data:/data

  scheduler:
    image: frappe/erpnext:${APP_VERSION}
    container_name: ${APP_NAME}-scheduler
    deploy:
      restart_policy:
        condition: on-failure
    command:
      - bench
      - schedule
    volumes:
      - sites:/home/frappe/frappe-bench/sites
      - logs:/home/frappe/frappe-bench/logs
      
  websocket:
    image: frappe/erpnext:${APP_VERSION}
    container_name: ${APP_NAME}-websocket
    deploy:
      restart_policy:
        condition: on-failure
    command:
      - node
      - /home/frappe/frappe-bench/apps/frappe/socketio.js
    volumes:
      - sites:/home/frappe/frappe-bench/sites
      - logs:/home/frappe/frappe-bench/logs
      
volumes:
  logs:
  sites:

设置新站点

# 设置新站点
docker-compose --env-file env.txt exec backend bench new-site <site-name> --no-mariadb-socket --admin-password=<管理员密码> --db-root-password=<数据库root账户的密码> --install-app erpnext --set-default

# 示例
docker-compose --env-file env.txt exec backend bench new-site frontend --no-mariadb-socket --admin-password=admin --db-root-password=4aixKdghP3j56hPB8k --install-app erpnext --set-default

参考

  • 无标签

0 评论

你还没有登录。你所做的任何更改会将作者标记为匿名用户。 如果你已经拥有帐户,请登录