Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion apps/erpnext/.env
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
W9_REPO=frappe/erpnext
W9_DIST=community
W9_VERSION=v15.34.1
W9_VERSION=v16.7.3
W9_HRMS_BRANCH=version-16

W9_ID=erpnext
W9_POWER_PASSWORD=1PrMxExC45LsCT
Expand Down
17 changes: 14 additions & 3 deletions apps/erpnext/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# CHANGELOG
# Changelog

## Release
### Fixes and Enhancements
All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project follows Semantic Versioning.

## [16.0.0] - 2026-03-12

### Changed

- Upgraded ERPNext to v16.

### Added

- Added the HR module introduced in ERPNext v16.

5 changes: 5 additions & 0 deletions apps/erpnext/Notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ password: admin
这是怎么回事呢?通过官方的论坛中研究,发现这是文档更新不及时导致,也就是说overrides中的安装在文档中还没有体现,虽然它更具有效率。


### 安装完成后执行命令,同步hrms资源,解决图片不显示
```
docker compose exec frontend bash -lc 'set -euxo pipefail; cd /home/frappe/frappe-bench; id; ls -ld apps/hrms/hrms/public; mkdir -p sites/assets/hrms; cp -a apps/hrms/hrms/public/. sites/assets/hrms/; ls -lah sites/assets/hrms; ls -lah sites/assets/hrms/images/frappe-hr-logo.svg'
```

#### 与URL有关的变量有那些?

```
Expand Down
2 changes: 1 addition & 1 deletion apps/erpnext/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This is an **[Docker Compose template](https://github.com/Websoft9/docker-library)** powered by [Websoft9](https://www.websoft9.com) based on Docker for ERPNext:


- community: v15, v14, v13
- community: v16, v15, v14


## System Requirements
Expand Down
78 changes: 59 additions & 19 deletions apps/erpnext/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
# new image: https://hub.docker.com/r/frappe/erpnext/tags
# docs: https://github.com/frappe/frappe_docker/blob/main/pwd.yml

version: '3.8'

services:
backend:
image: $W9_REPO:$W9_VERSION
container_name: $W9_ID-backend
depends_on:
create-site:
condition: service_completed_successfully
restart: unless-stopped
volumes:
- apps:/home/frappe/frappe-bench/apps
- env:/home/frappe/frappe-bench/env
- sites:/home/frappe/frappe-bench/sites
- logs:/home/frappe/frappe-bench/logs

Expand All @@ -23,20 +26,16 @@ services:
# add redis_socketio for backward compatibility
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;
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: $W9_ID-mariadb
DB_PORT: "3306"
REDIS_CACHE: $W9_ID-redis-cache:6379
REDIS_QUEUE: $W9_ID-redis-queue:6379
SOCKETIO_PORT: "9000"
volumes:
- apps:/home/frappe/frappe-bench/apps
- env:/home/frappe/frappe-bench/env
- sites:/home/frappe/frappe-bench/sites
- logs:/home/frappe/frappe-bench/logs

Expand All @@ -45,18 +44,16 @@ services:
container_name: $W9_ID-create-site
restart: none
volumes:
- apps:/home/frappe/frappe-bench/apps
- env:/home/frappe/frappe-bench/env
- sites:/home/frappe/frappe-bench/sites
- logs:/home/frappe/frappe-bench/logs
entrypoint:
- bash
- -c
command:
- >
wait-for-it -t 120 $W9_ID-mariadb:3306;
wait-for-it -t 120 $W9_ID-redis-cache:6379;
wait-for-it -t 120 $W9_ID-redis-queue:6379;
export start=`date +%s`;
until [[ -n `grep -hs ^ sites/common_site_config.json | jq -r ".db_host // empty"` ]] && \
set -e; wait-for-it -t 120 $W9_ID-mariadb:3306; wait-for-it -t 120 $W9_ID-redis-cache:6379; wait-for-it -t 120 $W9_ID-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
Expand All @@ -66,9 +63,24 @@ services:
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 --no-mariadb-socket --admin-password=$W9_LOGIN_PASSWORD --db-root-password=$W9_LOGIN_PASSWORD --install-app erpnext --set-default frontend;
done; echo "sites/common_site_config.json found"; if [ ! -d sites/frontend ]; then
bench new-site --mariadb-user-host-login-scope='%' --admin-password=$W9_LOGIN_PASSWORD --db-root-username=root --db-root-password=$W9_LOGIN_PASSWORD --install-app erpnext --set-default frontend;
else
echo "Site frontend already exists, skip new-site";
fi; if [ ! -d apps/hrms ]; then
bench get-app --branch $W9_HRMS_BRANCH hrms;
fi; bench pip install -e apps/hrms; ls -1 apps > sites/apps.txt; if ! bench --site frontend list-apps | grep -qx hrms; then
bench --site frontend install-app hrms;
else
echo "HRMS already installed on frontend";
fi; mkdir -p sites/assets; rm -rf sites/assets/hrms; cp -a /home/frappe/frappe-bench/apps/hrms/hrms/public sites/assets/hrms; if command -v node >/dev/null 2>&1; then
bench build --app hrms;
else
echo "node not found, skip bench build --app hrms";
fi; if [ ! -f sites/assets/hrms/images/frappe-hr-logo.svg ]; then
echo "ERROR: HRMS asset missing after build: sites/assets/hrms/images/frappe-hr-logo.svg";
exit 1;
fi; bench --site frontend migrate; bench --site frontend clear-cache; bench --site frontend clear-website-cache;

mariadb:
image: mariadb:$W9_DB_VERSION
Expand All @@ -92,9 +104,12 @@ services:
image: $W9_REPO:$W9_VERSION
container_name: $W9_ID
depends_on:
- websocket
create-site:
condition: service_completed_successfully
websocket:
condition: service_started
restart: unless-stopped
env_file:
env_file:
- .env
command:
- nginx-entrypoint.sh
Expand All @@ -108,6 +123,8 @@ services:
PROXY_READ_TIMEOUT: 120
CLIENT_MAX_BODY_SIZE: 50m
volumes:
- apps:/home/frappe/frappe-bench/apps
- env:/home/frappe/frappe-bench/env
- sites:/home/frappe/frappe-bench/sites
- logs:/home/frappe/frappe-bench/logs
ports:
Expand All @@ -116,26 +133,36 @@ services:
queue-long:
image: $W9_REPO:$W9_VERSION
container_name: $W9_ID-queue-long
depends_on:
create-site:
condition: service_completed_successfully
restart: unless-stopped
command:
- bench
- worker
- --queue
- long,default,short
volumes:
- apps:/home/frappe/frappe-bench/apps
- env:/home/frappe/frappe-bench/env
- sites:/home/frappe/frappe-bench/sites
- logs:/home/frappe/frappe-bench/logs

queue-short:
image: $W9_REPO:$W9_VERSION
container_name: $W9_ID-queue-short
depends_on:
create-site:
condition: service_completed_successfully
restart: unless-stopped
command:
- bench
- worker
- --queue
- short,default
volumes:
- apps:/home/frappe/frappe-bench/apps
- env:/home/frappe/frappe-bench/env
- sites:/home/frappe/frappe-bench/sites
- logs:/home/frappe/frappe-bench/logs

Expand All @@ -156,32 +183,45 @@ services:
scheduler:
image: $W9_REPO:$W9_VERSION
container_name: $W9_ID-scheduler
depends_on:
create-site:
condition: service_completed_successfully
restart: unless-stopped
command:
- bench
- schedule
volumes:
- apps:/home/frappe/frappe-bench/apps
- env:/home/frappe/frappe-bench/env
- sites:/home/frappe/frappe-bench/sites
- logs:/home/frappe/frappe-bench/logs

websocket:
image: $W9_REPO:$W9_VERSION
container_name: $W9_ID-websocket
depends_on:
create-site:
condition: service_completed_successfully
restart: unless-stopped
command:
- node
- /home/frappe/frappe-bench/apps/frappe/socketio.js
volumes:
- apps:/home/frappe/frappe-bench/apps
- env:/home/frappe/frappe-bench/env
- sites:/home/frappe/frappe-bench/sites
- logs:/home/frappe/frappe-bench/logs

volumes:
apps:
env:
db-data:
redis-queue-data:
redis-cache-data:
sites:
logs:


networks:
default:
name: $W9_NETWORK
Expand Down
2 changes: 1 addition & 1 deletion apps/erpnext/src/after_up.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1 +1 @@

144 changes: 72 additions & 72 deletions apps/erpnext/src/compose.yaml
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,72 +1,72 @@
x-depends-on-configurator: &depends_on_configurator
depends_on:
configurator:
condition: service_completed_successfully

x-backend-defaults: &backend_defaults
<<: *depends_on_configurator
image: frappe/frappe-worker:${FRAPPE_VERSION:?No Frappe version set}
volumes:
- sites:/home/frappe/frappe-bench/sites

services:
configurator:
<<: *backend_defaults
command: configure.py
environment:
DB_HOST: ${DB_HOST}
DB_PORT: ${DB_PORT}
REDIS_CACHE: ${REDIS_CACHE}
REDIS_QUEUE: ${REDIS_QUEUE}
REDIS_SOCKETIO: ${REDIS_SOCKETIO}
SOCKETIO_PORT: 9000
depends_on: {}

backend:
<<: *backend_defaults
volumes:
- sites:/home/frappe/frappe-bench/sites
- assets:/home/frappe/frappe-bench/sites/assets:ro

frontend:
image: frappe/frappe-nginx:${FRAPPE_VERSION}
environment:
BACKEND: backend:8000
SOCKETIO: websocket:9000
FRAPPE_SITE_NAME_HEADER: ${FRAPPE_SITE_NAME_HEADER:-$$host}
UPSTREAM_REAL_IP_ADDRESS: ${UPSTREAM_REAL_IP_ADDRESS:-127.0.0.1}
UPSTREAM_REAL_IP_HEADER: ${UPSTREAM_REAL_IP_HEADER:-X-Forwarded-For}
UPSTREAM_REAL_IP_RECURSIVE: ${UPSTREAM_REAL_IP_RECURSIVE:-off}
volumes:
- sites:/usr/share/nginx/html/sites
- assets:/usr/share/nginx/html/assets
depends_on:
- backend
- websocket

websocket:
<<: *depends_on_configurator
image: frappe/frappe-socketio:${FRAPPE_VERSION}
volumes:
- sites:/home/frappe/frappe-bench/sites

queue-short:
<<: *backend_defaults
command: bench worker --queue short

queue-default:
<<: *backend_defaults
command: bench worker --queue default

queue-long:
<<: *backend_defaults
command: bench worker --queue long

scheduler:
<<: *backend_defaults
command: bench schedule

# ERPNext requires local assets access (Frappe does not)
volumes:
sites:
assets:
x-depends-on-configurator: &depends_on_configurator
depends_on:
configurator:
condition: service_completed_successfully
x-backend-defaults: &backend_defaults
<<: *depends_on_configurator
image: frappe/frappe-worker:${FRAPPE_VERSION:?No Frappe version set}
volumes:
- sites:/home/frappe/frappe-bench/sites
services:
configurator:
<<: *backend_defaults
command: configure.py
environment:
DB_HOST: ${DB_HOST}
DB_PORT: ${DB_PORT}
REDIS_CACHE: ${REDIS_CACHE}
REDIS_QUEUE: ${REDIS_QUEUE}
REDIS_SOCKETIO: ${REDIS_SOCKETIO}
SOCKETIO_PORT: 9000
depends_on: {}
backend:
<<: *backend_defaults
volumes:
- sites:/home/frappe/frappe-bench/sites
- assets:/home/frappe/frappe-bench/sites/assets:ro
frontend:
image: frappe/frappe-nginx:${FRAPPE_VERSION}
environment:
BACKEND: backend:8000
SOCKETIO: websocket:9000
FRAPPE_SITE_NAME_HEADER: ${FRAPPE_SITE_NAME_HEADER:-$$host}
UPSTREAM_REAL_IP_ADDRESS: ${UPSTREAM_REAL_IP_ADDRESS:-127.0.0.1}
UPSTREAM_REAL_IP_HEADER: ${UPSTREAM_REAL_IP_HEADER:-X-Forwarded-For}
UPSTREAM_REAL_IP_RECURSIVE: ${UPSTREAM_REAL_IP_RECURSIVE:-off}
volumes:
- sites:/usr/share/nginx/html/sites
- assets:/usr/share/nginx/html/assets
depends_on:
- backend
- websocket
websocket:
<<: *depends_on_configurator
image: frappe/frappe-socketio:${FRAPPE_VERSION}
volumes:
- sites:/home/frappe/frappe-bench/sites
queue-short:
<<: *backend_defaults
command: bench worker --queue short
queue-default:
<<: *backend_defaults
command: bench worker --queue default
queue-long:
<<: *backend_defaults
command: bench worker --queue long
scheduler:
<<: *backend_defaults
command: bench schedule
# ERPNext requires local assets access (Frappe does not)
volumes:
sites:
assets:
Loading
Loading