I want persistent data via docker-compose. So I change the original pwd.yml
as follow:
version: "3"
services:
backend:
image: frappe/erpnext:v14.13.0
deploy:
restart_policy:
condition: on-failure
volumes:
- /home/new/apps/erpnextfinal/erp-data/sites:/home/frappe/frappe-bench/sites
- /home/new/apps/erpnextfinal/erp-data/logs:/home/frappe/frappe-bench/logs
configurator:
image: frappe/erpnext:v14.13.0
deploy:
restart_policy:
condition: none
entrypoint:
- bash
- -c
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:
- /home/new/apps/erpnextfinal/erp-data/sites:/home/frappe/frappe-bench/sites
- /home/new/apps/erpnextfinal/erp-data/logs:/home/frappe/frappe-bench/logs
db:
image: mariadb:10.6
healthcheck:
test: mysqladmin ping -h localhost --password=m823ah321bb
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: m823ah321bb
volumes:
- /home/new/apps/erpnextfinal/erp-data/db-data:/var/lib/mysql
frontend:
image: frappe/erpnext:v14.13.0
deploy:
restart_policy:
condition: on-failure
command:
- nginx-entrypoint.sh
environment:
BACKEND: backend:8000
FRAPPE_SITE_NAME_HEADER: 101.33.233.228
SOCKETIO: websocket:9000
UPSTREAM_REAL_IP_ADDRESS:
UPSTREAM_REAL_IP_HEADER:
UPSTREAM_REAL_IP_RECURSIVE: "off"
PROXY_READ_TIMOUT: 120
CLIENT_MAX_BODY_SIZE: 50m
volumes:
- /home/new/apps/erpnextfinal/erp-data/sites:/home/frappe/frappe-bench/sites
- /home/new/apps/erpnextfinal/erp-data/logs:/home/frappe/frappe-bench/logs
ports:
- "8600:8080"
queue-default:
image: frappe/erpnext:v14.13.0
deploy:
restart_policy:
condition: on-failure
command:
- bench
- worker
- --queue
- default
volumes:
- /home/new/apps/erpnextfinal/erp-data/sites:/home/frappe/frappe-bench/sites
- /home/new/apps/erpnextfinal/erp-data/logs:/home/frappe/frappe-bench/logs
queue-long:
image: frappe/erpnext:v14.13.0
deploy:
restart_policy:
condition: on-failure
command:
- bench
- worker
- --queue
- long
volumes:
- /home/new/apps/erpnextfinal/erp-data/sites:/home/frappe/frappe-bench/sites
- /home/new/apps/erpnextfinal/erp-data/logs:/home/frappe/frappe-bench/logs
queue-short:
image: frappe/erpnext:v14.13.0
deploy:
restart_policy:
condition: on-failure
command:
- bench
- worker
- --queue
- short
volumes:
- /home/new/apps/erpnextfinal/erp-data/sites:/home/frappe/frappe-bench/sites
- /home/new/apps/erpnextfinal/erp-data/logs:/home/frappe/frappe-bench/logs
redis-queue:
image: redis:6.2-alpine
deploy:
restart_policy:
condition: on-failure
volumes:
- /home/new/apps/erpnextfinal/erp-data/redis-queue-data:/data
redis-cache:
image: redis:6.2-alpine
deploy:
restart_policy:
condition: on-failure
volumes:
- /home/new/apps/erpnextfinal/erp-data/redis-cache-data:/data
redis-socketio:
image: redis:6.2-alpine
deploy:
restart_policy:
condition: on-failure
volumes:
- /home/new/apps/erpnextfinal/erp-data/redis-socketio-data:/data
scheduler:
image: frappe/erpnext:v14.13.0
deploy:
restart_policy:
condition: on-failure
command:
- bench
- schedule
volumes:
- /home/new/apps/erpnextfinal/erp-data/sites:/home/frappe/frappe-bench/sites
- /home/new/apps/erpnextfinal/erp-data/logs:/home/frappe/frappe-bench/logs
websocket:
image: frappe/erpnext:v14.13.0
deploy:
restart_policy:
condition: on-failure
command:
- node
- /home/frappe/frappe-bench/apps/frappe/socketio.js
volumes:
- /home/new/apps/erpnextfinal/erp-data/sites:/home/frappe/frappe-bench/sites
- /home/new/apps/erpnextfinal/erp-data/logs:/home/frappe/frappe-bench/logs
It start correctly. However it display the following error when I run the command to create the site:
docker-compose --project-name erpa exec backend \
bench new-site example.top \
--mariadb-root-password xxh321bb \
--admin-password adnux \
--no-mariadb-socket \
--install-app erpnext
It shows:
Traceback (most recent call last):
File "/usr/local/bin/bench", line 8, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.10/site-packages/bench/cli.py", line 76, in cli
logger = setup_logging()
File "/usr/local/lib/python3.10/site-packages/bench/utils/__init__.py", line 185, in setup_logging
hdlr = logging.FileHandler(log_file)
File "/usr/local/lib/python3.10/logging/__init__.py", line 1169, in __init__
StreamHandler.__init__(self, self._open())
File "/usr/local/lib/python3.10/logging/__init__.py", line 1201, in _open
return open_func(self.baseFilename, self.mode,
PermissionError: [Errno 13] Permission denied: '/home/frappe/frappe-bench/logs/bench.log'
How to resolve the problem under the docker environment?
Best regards.
My System is Ubuntu 20.04 LTS
My docker version:
Docker version 20.10.22, build 3a2c30b
Docker Compose version v2.13.0