From 09060341c77d703712aa6904baf93ef91a9815c6 Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Mon, 7 Mar 2022 12:30:23 +0530 Subject: [PATCH] fix: make changes for backward compat make changes for refactor to work on existing setups --- docker-compose.yml | 37 ++++++++++++------------------------- docs/single-bench.md | 20 ++++++++++++++++++++ 2 files changed, 32 insertions(+), 25 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index d6fd92d9..92213260 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -38,6 +38,13 @@ services: - FRAPPE_SOCKETIO=frappe-socketio - SOCKETIO_PORT=9000 - SKIP_NGINX_TEMPLATE_GENERATION=${SKIP_NGINX_TEMPLATE_GENERATION} + # For refactored images + - BACKEND=erpnext-python:8000 + - SOCKETIO=frappe-socketio: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} labels: - "traefik.enable=true" - "traefik.http.routers.erpnext-nginx.rule=Host(${SITES})" @@ -75,7 +82,7 @@ services: erpnext-worker-default: image: frappe/erpnext-worker:${ERPNEXT_VERSION} restart: on-failure - command: worker + command: ["bench", "worker", "--queue", "default"] depends_on: - redis-queue - redis-cache @@ -86,9 +93,7 @@ services: erpnext-worker-short: image: frappe/erpnext-worker:${ERPNEXT_VERSION} restart: on-failure - command: worker - environment: - - WORKER_TYPE=short + command: ["bench", "worker", "--queue", "short"] depends_on: - redis-queue - redis-cache @@ -99,9 +104,7 @@ services: erpnext-worker-long: image: frappe/erpnext-worker:${ERPNEXT_VERSION} restart: on-failure - command: worker - environment: - - WORKER_TYPE=long + command: ["bench", "worker", "--queue", "long"] depends_on: - redis-queue - redis-cache @@ -111,7 +114,7 @@ services: erpnext-schedule: image: frappe/erpnext-worker:${ERPNEXT_VERSION} restart: on-failure - command: schedule + command: ["bench", "schedule"] depends_on: - redis-queue - redis-cache @@ -147,28 +150,12 @@ services: - --skip-innodb-read-only-compressed # Temporary fix for MariaDB 10.6 environment: - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} - # Sometimes db initialization takes longer than 10 seconds and site-creator goes away. + # Sometimes db initialization takes longer than 10 seconds and site creation can cause error. # Frappe doesn't use CONVERT_TZ() function that requires time zone info, so we can just skip it. - MYSQL_INITDB_SKIP_TZINFO=1 volumes: - mariadb-vol:/var/lib/mysql - site-creator: - image: frappe/erpnext-worker:${ERPNEXT_VERSION} - restart: "no" - command: new - depends_on: - - erpnext-python - environment: - - SITE_NAME=${SITE_NAME} - - DB_ROOT_USER=${DB_ROOT_USER} - - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} - - ADMIN_PASSWORD=${ADMIN_PASSWORD} - - INSTALL_APPS=${INSTALL_APPS} - volumes: - - sites-vol:/home/frappe/frappe-bench/sites:rw - - logs-vol:/home/frappe/frappe-bench/logs:rw - volumes: mariadb-vol: redis-cache-vol: diff --git a/docs/single-bench.md b/docs/single-bench.md index b1487516..ecc74219 100644 --- a/docs/single-bench.md +++ b/docs/single-bench.md @@ -82,6 +82,26 @@ Notes: - The local deployment is for testing and REST API development purpose only - A complete development environment is available [here](../development) +## Create Site + +Set environment variables + +```sh +export $(cat .env | xargs) +``` + +Create site as per use and install apps optionally. + +```sh +docker-compose exec erpnext-python bench new-site ${SITE_NAME} --mariadb-root-username=${DB_ROOT_USER} --mariadb-root-password=${MYSQL_ROOT_PASSWORD} --admin-password=${ADMIN_PASSWORD} --install-app=${INSTALL_APPS} --db-type=mariadb --no-mariadb-socket +``` + +If this is the first site created then remove `currentsite.txt` to unset default site. + +```sh +docker-compose exec erpnext-python rm -f currentsite.txt +``` + ## Docker containers The docker-compose file contains following services: