diff --git a/.env b/.env index ee8d44a..0369861 100644 --- a/.env +++ b/.env @@ -1,3 +1,10 @@ +APP_PORT=9001 +APP_NAME=erpnext +DB_MARIA_PASSWORD=LFVKy9ra9Njy2E + + + + # Reference: https://github.com/frappe/frappe_docker/blob/main/docs/images-and-compose-files.md FRAPPE_VERSION=v13.30.0 @@ -5,7 +12,7 @@ FRAPPE_VERSION=v13.30.0 # Only with ERPNext override ERPNEXT_VERSION=v13.31.1 -DB_PASSWORD=123 +DB_PASSWORD=$DB_MARIA_PASSWORD # Only if you use external database DB_HOST= diff --git a/Notes.md b/Notes.md index 1ef9311..1d153bf 100644 --- a/Notes.md +++ b/Notes.md @@ -1,6 +1,5 @@ # ERPNext -<<<<<<< HEAD ## About Install 官方非常及时的更新了安装所需的镜像,且提供了灵活多变的 docker compose 文件以供用户使用。 @@ -29,8 +28,15 @@ password: admin #### ERPNext 镜像与 Frappe 镜像有什么区别? 有待研究,实验中发现 ERPNext 不会出现图片乱码问题 -======= -* docs: https://github.com/frappe/frappe_docker -* versions: 11, 12, 13 ->>>>>>> b56db58d7c833ed9f471f35d255895db33f81d5b + +#### 与URL有关的变量有那些? + +``` +echo "ROUTER=custom-one-example" > ~/gitops/custom-one-example.env +echo "SITES=\`custom-one.example.com\`" >> ~/gitops/custom-one-example.env +echo "BASE_SITE=one.example.com" >> ~/gitops/custom-one-example.env +echo "BENCH_NETWORK=erpnext-one" >> ~/gitops/custom-one-example.env +``` + +https://github.com/frappe/frappe_docker/blob/main/docs/single-server-example.md#create-custom-domain-to-existing-site \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 7ac9d4a..65ddc46 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -30,6 +30,7 @@ services: frontend: image: frappe/frappe-nginx:${FRAPPE_VERSION} + container_name: $APP_NAME environment: BACKEND: backend:8000 SOCKETIO: websocket:9000 diff --git a/src/compose.yaml b/src/compose.yaml new file mode 100644 index 0000000..2916c38 --- /dev/null +++ b/src/compose.yaml @@ -0,0 +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: diff --git a/src/example.env b/src/example.env new file mode 100644 index 0000000..47c176d --- /dev/null +++ b/src/example.env @@ -0,0 +1,1665 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + frappe_docker/example.env at main · frappe/frappe_docker · GitHub + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Skip to content + + + + + + + + + + +
+ +
+ + + + + + + +
+ + + +
+ + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + +
+ + + + + + +
+ + +
+ + + + + + + + +Permalink + +
+ +
+
+ + + main + + + + +
+
+
+ Switch branches/tags + +
+ + + +
+ +
+ +
+ + +
+ +
+ + + + + + + + + + + + + + + +
+ + +
+
+
+
+ +
+ +
+ + + Go to file + + +
+ + + + + +
+
+
+ + + + + + + + + +
+ +
+
+ + + +
+
+ github-actions + + + chore: Update example.env + +
+ + + + + +
+
+ + Latest commit + 38ed43f + May 27, 2022 + + + + + + History + + +
+
+ +
+ +
+
+ + + 2 + + contributors + + +
+ +

+ Users who have contributed to this file +

+
+ + + + + + +
+
+ + + @revant + + @vrslev + + + +
+
+ + + + + + + + +
+ +
+ + +
+ + 40 lines (29 sloc) + + 1.55 KB +
+ +
+ + + + +
+ + + + + + + +
+
+ +
+ +
+
+ + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
# Reference: https://github.com/frappe/frappe_docker/blob/main/docs/images-and-compose-files.md
+
FRAPPE_VERSION=v13.30.0
+
# Only with ERPNext override
ERPNEXT_VERSION=v13.31.1
+
DB_PASSWORD=123
+
# Only if you use external database
DB_HOST=
DB_PORT=
+
# Only if you use external Redis
REDIS_CACHE=
REDIS_QUEUE=
REDIS_SOCKETIO=
+
# Only with HTTPS override
LETSENCRYPT_EMAIL=mail@example.com
+
# These environment variables are not required.
+
# Default value is `$$host` which resolves site by host. For example, if your host is `example.com`,
# site's name should be `example.com`, or if host is `127.0.0.1` (local debugging), it should be `127.0.0.1`.
# This variable allows to override described behavior. Let's say you create site named `mysite`
# and do want to access it by `127.0.0.1` host. Than you would set this variable to `mysite`.
FRAPPE_SITE_NAME_HEADER=
+
# Default value is `127.0.0.1`. Set IP address as our trusted upstream address.
UPSTREAM_REAL_IP_ADDRESS=
+
# Default value is `X-Forwarded-For`. Set request header field whose value will be used to replace the client address
UPSTREAM_REAL_IP_HEADER=
+
# Allowed values are on|off. Default value is `off`. If recursive search is disabled,
# the original client address that matches one of the trusted addresses
# is replaced by the last address sent in the request header field defined by the real_ip_header directive.
# If recursive search is enabled, the original client address that matches one of the trusted addresses is replaced by the last non-trusted address sent in the request header field.
UPSTREAM_REAL_IP_RECURSIVE=
+
+ + + +
+ +
+ + + + +
+ + +
+ + +
+
+ + +
+ +
+ + +
+ + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/src/filelist b/src/filelist index 088e0d8..fc69f9a 100644 --- a/src/filelist +++ b/src/filelist @@ -1,2 +1,4 @@ -docker-compose.yml -installation \ No newline at end of file +# https://github.com/frappe/frappe_docker +compose.yaml +example.env +overrides \ No newline at end of file diff --git a/src/overrides/compose.erpnext.yaml b/src/overrides/compose.erpnext.yaml new file mode 100644 index 0000000..36f10ad --- /dev/null +++ b/src/overrides/compose.erpnext.yaml @@ -0,0 +1,24 @@ +x-erpnext-backend-image: &erpnext_backend_image + image: frappe/erpnext-worker:${ERPNEXT_VERSION:?No ERPNext version set} + +services: + configurator: + <<: *erpnext_backend_image + + backend: + <<: *erpnext_backend_image + + frontend: + image: frappe/erpnext-nginx:${ERPNEXT_VERSION} + + queue-short: + <<: *erpnext_backend_image + + queue-default: + <<: *erpnext_backend_image + + queue-long: + <<: *erpnext_backend_image + + scheduler: + <<: *erpnext_backend_image diff --git a/src/overrides/compose.mariadb.yaml b/src/overrides/compose.mariadb.yaml new file mode 100644 index 0000000..cd719b6 --- /dev/null +++ b/src/overrides/compose.mariadb.yaml @@ -0,0 +1,27 @@ +services: + configurator: + environment: + DB_HOST: db + DB_PORT: 3306 + depends_on: + db: + condition: service_healthy + + db: + image: mariadb:10.6 + healthcheck: + test: mysqladmin ping -h localhost --password=${DB_PASSWORD} + interval: 1s + retries: 15 + 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_PASSWORD:?No db password set} + volumes: + - db-data:/var/lib/mysql + +volumes: + db-data: diff --git a/src/overrides/compose.noproxy.yaml b/src/overrides/compose.noproxy.yaml new file mode 100644 index 0000000..6a4af81 --- /dev/null +++ b/src/overrides/compose.noproxy.yaml @@ -0,0 +1,4 @@ +services: + frontend: + ports: + - $APP_PORT:8080 diff --git a/src/overrides/compose.redis.yaml b/src/overrides/compose.redis.yaml new file mode 100644 index 0000000..5bd3a0a --- /dev/null +++ b/src/overrides/compose.redis.yaml @@ -0,0 +1,16 @@ +services: + configurator: + environment: + REDIS_CACHE: redis:6379/0 + REDIS_QUEUE: redis:6379/1 + REDIS_SOCKETIO: redis:6379/2 + depends_on: + - redis + + redis: + image: redis:6.2-alpine + volumes: + - redis-data:/data + +volumes: + redis-data: