什么是 ERPNext ?
ERPNext 是一种免费的、开源的企业资源规划(ERP)软件,它提供了一套完整的企业解决方案,包括会计、采购、销售、库存、制造、CRM 等功能。ERPNext 旨在为中小型企业提供一种简单、易用、灵活的 ERP 系统,以帮助企业管理业务流程、优化运营效率、提高生产力和盈利能力。ERPNext 建立在 Frappe 框架之上,这是一个使用 Python 和 JavaScript 构建的全栈 web 应用程序框架。
erpnext(v15.64.0.64.0)
可以无需环境配置文件 env ,直接将所需的配置信息保存至 .yml 文件。在执行前需要先创建对应的目录文件,否则在启动时存在报错的情况。
cd /data/nexterp
mkdir {logs,sites,db-data}
docker-compose -f erpnext.yml up -d
erpnext-15.64.0.yml
也可以直接点击这里下载该文件erpnext.yml。启动后 erpnext 默认的访问端口是 8080 用户名和密码分别是 Administrator 和 admin
version: "3"
services:
backend:
image: frappe/erpnext:latest
networks:
- frappe_network
deploy:
restart_policy:
condition: on-failure
volumes:
- sites:/home/frappe/frappe-bench/sites
- logs:/home/frappe/frappe-bench/logs
environment:
DB_HOST: db
DB_PORT: "3306"
MYSQL_ROOT_PASSWORD: admin
MARIADB_ROOT_PASSWORD: admin
configurator:
image: frappe/erpnext:latest
networks:
- frappe_network
deploy:
restart_policy:
condition: none
entrypoint:
- bash
- -c
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;
environment:
DB_HOST: db
DB_PORT: "3306"
REDIS_CACHE: redis-cache:6379
REDIS_QUEUE: redis-queue:6379
SOCKETIO_PORT: "9000"
volumes:
- sites:/home/frappe/frappe-bench/sites
- logs:/home/frappe/frappe-bench/logs
create-site:
image: frappe/erpnext:latest
networks:
- frappe_network
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 120 db:3306;
wait-for-it -t 120 redis-cache:6379;
wait-for-it -t 120 redis-queue: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 --mariadb-user-host-login-scope='%' --admin-password=admin --db-root-username=root --db-root-password=admin --install-app erpnext --set-default frontend;
db:
image: mariadb:10.6
networks:
- frappe_network
healthcheck:
test: mysqladmin ping -h localhost --password=admin
interval: 1s
retries: 20
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
MARIADB_ROOT_PASSWORD: admin
volumes:
- db-data:/var/lib/mysql
frontend:
image: frappe/erpnext:latest
networks:
- frappe_network
depends_on:
- websocket
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: 127.0.0.1
UPSTREAM_REAL_IP_HEADER: X-Forwarded-For
UPSTREAM_REAL_IP_RECURSIVE: "off"
PROXY_READ_TIMEOUT: 120
CLIENT_MAX_BODY_SIZE: 50m
volumes:
- sites:/home/frappe/frappe-bench/sites
- logs:/home/frappe/frappe-bench/logs
ports:
- "8080:8080"
queue-long:
image: frappe/erpnext:latest
networks:
- frappe_network
deploy:
restart_policy:
condition: on-failure
command:
- bench
- worker
- --queue
- long,default,short
volumes:
- sites:/home/frappe/frappe-bench/sites
- logs:/home/frappe/frappe-bench/logs
queue-short:
image: frappe/erpnext:latest
networks:
- frappe_network
deploy:
restart_policy:
condition: on-failure
command:
- bench
- worker
- --queue
- short,default
volumes:
- sites:/home/frappe/frappe-bench/sites
- logs:/home/frappe/frappe-bench/logs
redis-queue:
image: redis:6.2-alpine
networks:
- frappe_network
deploy:
restart_policy:
condition: on-failure
volumes:
- redis-queue-data:/data
redis-cache:
image: redis:6.2-alpine
networks:
- frappe_network
deploy:
restart_policy:
condition: on-failure
scheduler:
image: frappe/erpnext:latest
networks:
- frappe_network
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:latest
networks:
- frappe_network
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:
db-data:
driver: local
driver_opts:
type: none
o: bind
device: /data/erpnext/db-data
redis-queue-data:
sites:
driver: local
driver_opts:
type: none
o: bind
device: /data/erpnext/sites
logs:
driver: local
driver_opts:
type: none
o: bind
device: /data/erpnext/logs
networks:
frappe_network:
driver: bridge
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
参考
- ERPNext: Free and Open Source Cloud ERP Software 地址:https://erpnext.com/
- frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP) 地址:https://github.com/frappe/erpnext
- frappe/frappe_docker: Docker images for production and development setups of the Frappe framework and ERPNext 地址:https://github.com/frappe/frappe_docker
Home 地址:https://docs.erpnext.com/

添加评论