2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2024-09-16 17:19:03 +00:00

refactor: prepare for v15 (#1243)

* chore: resolve merge conflict

* ci: changes for version 15

* chore: upgrade python and nodejs

* ci: fix v15 build

* fix: add redis_socketio for backward compatibility

* ci: fix v15 build

* ci: fix test endpoint

changed to erpnext.templates.pages.search_help.get_help_results_sections
This commit is contained in:
Revant Nandgaonkar 2023-10-20 18:40:10 +05:30 committed by GitHub
parent ab5f985536
commit f605addb71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 79 additions and 193 deletions

View File

@ -9,7 +9,7 @@ import sys
from typing import Literal from typing import Literal
Repo = Literal["frappe", "erpnext"] Repo = Literal["frappe", "erpnext"]
MajorVersion = Literal["12", "13", "14", "develop"] MajorVersion = Literal["12", "13", "14", "15", "develop"]
def get_latest_tag(repo: Repo, version: MajorVersion) -> str: def get_latest_tag(repo: Repo, version: MajorVersion) -> str:
@ -57,7 +57,7 @@ def main(_args: list[str]) -> int:
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("--repo", choices=["frappe", "erpnext"], required=True) parser.add_argument("--repo", choices=["frappe", "erpnext"], required=True)
parser.add_argument( parser.add_argument(
"--version", choices=["12", "13", "14", "develop"], required=True "--version", choices=["12", "13", "14", "15", "develop"], required=True
) )
args = parser.parse_args(_args) args = parser.parse_args(_args)

View File

@ -26,8 +26,8 @@ jobs:
repo: erpnext repo: erpnext
version: develop version: develop
push: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }} push: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
python_version: 3.11.4 python_version: 3.11.6
node_version: 18.16.1 node_version: 18.18.2
secrets: secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

View File

@ -30,26 +30,26 @@ on:
workflow_dispatch: workflow_dispatch:
jobs: jobs:
v13:
uses: ./.github/workflows/docker-build-push.yml
with:
repo: erpnext
version: "13"
push: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
python_version: 3.9.17
node_version: 14.21.3
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
v14: v14:
uses: ./.github/workflows/docker-build-push.yml uses: ./.github/workflows/docker-build-push.yml
with: with:
repo: erpnext repo: erpnext
version: "14" version: "14"
push: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }} push: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
python_version: 3.10.12 python_version: 3.10.13
node_version: 16.20.1 node_version: 16.20.2
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
v15:
uses: ./.github/workflows/docker-build-push.yml
with:
repo: erpnext
version: "15"
push: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
python_version: 3.11.6
node_version: 18.18.2
secrets: secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
@ -58,7 +58,7 @@ jobs:
name: Update example.env and pwd.yml name: Update example.env and pwd.yml
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }} if: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
needs: v14 needs: v15
steps: steps:
- name: Checkout - name: Checkout
@ -70,7 +70,7 @@ jobs:
python-version: "3.10" python-version: "3.10"
- name: Get latest versions - name: Get latest versions
run: python3 ./.github/scripts/get_latest_tags.py --repo erpnext --version 14 run: python3 ./.github/scripts/get_latest_tags.py --repo erpnext --version 15
- name: Update - name: Update
run: | run: |
@ -96,7 +96,7 @@ jobs:
name: Release Helm name: Release Helm
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }} if: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
needs: v14 needs: v15
steps: steps:
- name: Setup deploy key - name: Setup deploy key
@ -113,4 +113,4 @@ jobs:
run: | run: |
git clone git@github.com:frappe/helm.git && cd helm git clone git@github.com:frappe/helm.git && cd helm
pip install -r release_wizard/requirements.txt pip install -r release_wizard/requirements.txt
./release_wizard/wizard 14 patch --remote origin --ci ./release_wizard/wizard 15 patch --remote origin --ci

View File

@ -20,6 +20,7 @@ services:
entrypoint: entrypoint:
- bash - bash
- -c - -c
# add redis_socketio for backward compatibility
command: command:
- > - >
ls -1 apps > sites/apps.txt; ls -1 apps > sites/apps.txt;
@ -27,14 +28,13 @@ services:
bench set-config -gp db_port $$DB_PORT; bench set-config -gp db_port $$DB_PORT;
bench set-config -g redis_cache "redis://$$REDIS_CACHE"; bench set-config -g redis_cache "redis://$$REDIS_CACHE";
bench set-config -g redis_queue "redis://$$REDIS_QUEUE"; bench set-config -g redis_queue "redis://$$REDIS_QUEUE";
bench set-config -g redis_socketio "redis://$$REDIS_SOCKETIO"; bench set-config -g redis_socketio "redis://$$REDIS_QUEUE";
bench set-config -gp socketio_port $$SOCKETIO_PORT; bench set-config -gp socketio_port $$SOCKETIO_PORT;
environment: environment:
DB_HOST: ${DB_HOST} DB_HOST: ${DB_HOST}
DB_PORT: ${DB_PORT} DB_PORT: ${DB_PORT}
REDIS_CACHE: ${REDIS_CACHE} REDIS_CACHE: ${REDIS_CACHE}
REDIS_QUEUE: ${REDIS_QUEUE} REDIS_QUEUE: ${REDIS_QUEUE}
REDIS_SOCKETIO: ${REDIS_SOCKETIO}
SOCKETIO_PORT: 9000 SOCKETIO_PORT: 9000
depends_on: {} depends_on: {}
@ -72,10 +72,6 @@ services:
<<: *backend_defaults <<: *backend_defaults
command: bench worker --queue short command: bench worker --queue short
queue-default:
<<: *backend_defaults
command: bench worker --queue default
queue-long: queue-long:
<<: *backend_defaults <<: *backend_defaults
command: bench worker --queue long command: bench worker --queue long

View File

@ -26,9 +26,6 @@ services:
redis-queue: redis-queue:
image: redis:alpine image: redis:alpine
redis-socketio:
image: redis:alpine
frappe: frappe:
image: frappe/bench:latest image: frappe/bench:latest
command: sleep infinity command: sleep infinity

View File

@ -1,6 +1,6 @@
[ [
{ {
"url": "https://github.com/frappe/erpnext.git", "url": "https://github.com/frappe/erpnext.git",
"branch": "version-14" "branch": "version-15"
} }
] ]

View File

@ -72,8 +72,8 @@ def get_args_parser():
"--frappe-branch", "--frappe-branch",
action="store", action="store",
type=str, type=str,
help="frappe repo to use, default: version-14", # noqa: E501 help="frappe repo to use, default: version-15", # noqa: E501
default="version-14", default="version-15",
) )
parser.add_argument( parser.add_argument(
"-p", "-p",
@ -97,6 +97,14 @@ def get_args_parser():
action="store_true", action="store_true",
help="verbose output", # noqa: E501 help="verbose output", # noqa: E501
) )
parser.add_argument(
"-a",
"--admin-password",
action="store",
type=str,
help="admin password for site, default: admin", # noqa: E501
default="admin",
)
return parser return parser
@ -156,17 +164,6 @@ def init_bench_if_not_exist(args):
], ],
cwd=os.getcwd() + "/" + args.bench_name, cwd=os.getcwd() + "/" + args.bench_name,
) )
cprint("Set redis_socketio to redis://redis-socketio:6379", level=3)
subprocess.call(
[
"bench",
"set-config",
"-g",
"redis_socketio",
"redis://redis-socketio:6379",
],
cwd=os.getcwd() + "/" + args.bench_name,
)
cprint("Set developer_mode", level=3) cprint("Set developer_mode", level=3)
subprocess.call( subprocess.call(
["bench", "set-config", "-gp", "developer_mode", "1"], ["bench", "set-config", "-gp", "developer_mode", "1"],
@ -182,7 +179,7 @@ def create_site_in_bench(args):
"new-site", "new-site",
"--no-mariadb-socket", "--no-mariadb-socket",
"--mariadb-root-password=123", "--mariadb-root-password=123",
"--admin-password=admin", f"--admin-password={args.admin_password}",
] ]
apps = os.listdir(f"{os.getcwd()}/{args.bench_name}/apps") apps = os.listdir(f"{os.getcwd()}/{args.bench_name}/apps")
apps.remove("frappe") apps.remove("frappe")

View File

@ -23,18 +23,6 @@
"DEV_SERVER": "1" "DEV_SERVER": "1"
} }
}, },
{
"name": "Bench Default Worker",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/frappe-bench/apps/frappe/frappe/utils/bench_helper.py",
"args": ["frappe", "worker", "--queue", "default"],
"pythonPath": "${workspaceFolder}/frappe-bench/env/bin/python",
"cwd": "${workspaceFolder}/frappe-bench/sites",
"env": {
"DEV_SERVER": "1"
}
},
{ {
"name": "Bench Short Worker", "name": "Bench Short Worker",
"type": "python", "type": "python",

View File

@ -6,10 +6,10 @@ variable "REGISTRY_USER" {
} }
variable PYTHON_VERSION { variable PYTHON_VERSION {
default = "3.11.4" default = "3.11.6"
} }
variable NODE_VERSION { variable NODE_VERSION {
default = "18.16.1" default = "18.18.2"
} }
variable "FRAPPE_VERSION" { variable "FRAPPE_VERSION" {

View File

@ -87,7 +87,7 @@ PYENV_VERSION=3.10.12 bench init --skip-redis-config-generation --frappe-branch
cd frappe-bench cd frappe-bench
``` ```
To setup frappe framework version 13 bench set `PYENV_VERSION` environment variable to `3.9.9` and use NodeJS version 14, To setup frappe framework version 13 bench set `PYENV_VERSION` environment variable to `3.9.17` and use NodeJS version 14,
```shell ```shell
nvm use v14 nvm use v14
@ -103,7 +103,6 @@ We need to tell bench to use the right containers instead of localhost. Run the
bench set-config -g db_host mariadb bench set-config -g db_host mariadb
bench set-config -g redis_cache redis://redis-cache:6379 bench set-config -g redis_cache redis://redis-cache:6379
bench set-config -g redis_queue redis://redis-queue:6379 bench set-config -g redis_queue redis://redis-queue:6379
bench set-config -g redis_socketio redis://redis-socketio:6379
``` ```
For any reason the above commands fail, set the values in `common_site_config.json` manually. For any reason the above commands fail, set the values in `common_site_config.json` manually.
@ -112,8 +111,7 @@ For any reason the above commands fail, set the values in `common_site_config.js
{ {
"db_host": "mariadb", "db_host": "mariadb",
"redis_cache": "redis://redis-cache:6379", "redis_cache": "redis://redis-cache:6379",
"redis_queue": "redis://redis-queue:6379", "redis_queue": "redis://redis-queue:6379"
"redis_socketio": "redis://redis-socketio:6379"
} }
``` ```
@ -236,7 +234,7 @@ Note: To start bench with debugger refer section for debugging.
Most developers work with numerous clients and versions. Moreover, apps may be required to be installed by everyone on the team working for a client. Most developers work with numerous clients and versions. Moreover, apps may be required to be installed by everyone on the team working for a client.
This is simplified using a script to automate the process of creating a new bench / site and installing the required apps. This is simplified using a script to automate the process of creating a new bench / site and installing the required apps. `Administrator` password is for created sites is `admin`.
Sample `apps-example.json` is used by default, it installs erpnext on current stable release. To install custom apps, copy the `apps-example.json` to custom json file and make changes to list of apps. Pass this file to the `installer.py` script. Sample `apps-example.json` is used by default, it installs erpnext on current stable release. To install custom apps, copy the `apps-example.json` to custom json file and make changes to list of apps. Pass this file to the `installer.py` script.
@ -269,6 +267,8 @@ options:
-n NODE_VERSION, --node-version NODE_VERSION -n NODE_VERSION, --node-version NODE_VERSION
node version, default: Not Set node version, default: Not Set
-v, --verbose verbose output -v, --verbose verbose output
-a ADMIN_PASSWORD, --admin-password ADMIN_PASSWORD
admin password for site, default: admin
``` ```
A new bench and / or site is created for the client with following defaults. A new bench and / or site is created for the client with following defaults.

View File

@ -39,11 +39,7 @@ Hostname for redis server to store cache. Set only if external service for redis
### `REDIS_QUEUE` ### `REDIS_QUEUE`
Hostname for redis server to store queue data. Set only if external service for redis is used. Hostname for redis server to store queue data and socketio. Set only if external service for redis is used.
### `REDIS_SOCKETIO`
Hostname for redis server to store socketio data. Set only if external service for redis is used.
### `ERPNEXT_VERSION` ### `ERPNEXT_VERSION`

View File

@ -30,7 +30,7 @@ All services are described in `compose.yaml`
- `frontend`. [nginx](https://www.nginx.com) server that serves JS/CSS assets and routes incoming requests. - `frontend`. [nginx](https://www.nginx.com) server that serves JS/CSS assets and routes incoming requests.
- `proxy`. [Traefik](https://traefik.io/traefik/) proxy. It is here for complicated setups or HTTPS override (with `overrides/compose.https.yaml`). - `proxy`. [Traefik](https://traefik.io/traefik/) proxy. It is here for complicated setups or HTTPS override (with `overrides/compose.https.yaml`).
- `websocket`. Node server that runs [Socket.IO](https://socket.io). - `websocket`. Node server that runs [Socket.IO](https://socket.io).
- `queue-short`, `queue-default`, `queue-long`. Python servers that run job queues using [rq](https://python-rq.org). - `queue-short`, `queue-long`. Python servers that run job queues using [rq](https://python-rq.org).
- `scheduler`. Python server that runs tasks on schedule using [schedule](https://schedule.readthedocs.io/en/stable/). - `scheduler`. Python server that runs tasks on schedule using [schedule](https://schedule.readthedocs.io/en/stable/).
## Overrides ## Overrides

View File

@ -62,14 +62,12 @@ configurator:
bench set-config -gp db_port $$DB_PORT; bench set-config -gp db_port $$DB_PORT;
bench set-config -g redis_cache "redis://$$REDIS_CACHE"; bench set-config -g redis_cache "redis://$$REDIS_CACHE";
bench set-config -g redis_queue "redis://$$REDIS_QUEUE"; 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; bench set-config -gp socketio_port $$SOCKETIO_PORT;
environment: environment:
DB_HOST: db DB_HOST: db
DB_PORT: "3306" DB_PORT: "3306"
REDIS_CACHE: redis-cache:6379 REDIS_CACHE: redis-cache:6379
REDIS_QUEUE: redis-queue:6379 REDIS_QUEUE: redis-queue:6379
REDIS_SOCKETIO: redis-socketio:6379
SOCKETIO_PORT: "9000" SOCKETIO_PORT: "9000"
# ... removed for brevity # ... removed for brevity
``` ```
@ -95,7 +93,6 @@ create-site:
wait-for-it -t 120 db:3306; wait-for-it -t 120 db:3306;
wait-for-it -t 120 redis-cache:6379; wait-for-it -t 120 redis-cache:6379;
wait-for-it -t 120 redis-queue:6379; wait-for-it -t 120 redis-queue:6379;
wait-for-it -t 120 redis-socketio:6379;
export start=`date +%s`; export start=`date +%s`;
until [[ -n `grep -hs ^ sites/common_site_config.json | jq -r ".db_host // empty"` ]] && \ 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_cache // empty"` ]] && \

View File

@ -40,8 +40,7 @@ Instead of `docker compose config`, you can directly use `docker compose up` to
### Setup Frappe without proxy and external MariaDB and Redis ### Setup Frappe without proxy and external MariaDB and Redis
In this case make sure you've set `DB_HOST`, `DB_PORT`, `REDIS_CACHE`, `REDIS_QUEUE` and `REDIS_SOCKETIO` In this case make sure you've set `DB_HOST`, `DB_PORT`, `REDIS_CACHE` and `REDIS_QUEUE` environment variables or the `configurator` will fail.
environment variables or the `configurator` will fail.
```sh ```sh
# Generate YAML # Generate YAML
@ -53,8 +52,7 @@ docker compose --project-name <project-name> -f ~/gitops/docker-compose.yml up -
### Setup ERPNext with proxy and external MariaDB and Redis ### Setup ERPNext with proxy and external MariaDB and Redis
In this case make sure you've set `DB_HOST`, `DB_PORT`, `REDIS_CACHE`, `REDIS_QUEUE` and `REDIS_SOCKETIO` In this case make sure you've set `DB_HOST`, `DB_PORT`, `REDIS_CACHE` and `REDIS_QUEUE` environment variables or the `configurator` will fail.
environment variables or the `configurator` will fail.
```sh ```sh
# Generate YAML # Generate YAML

View File

@ -15,7 +15,7 @@ version: "3"
services: services:
backend: backend:
image: frappe/erpnext:v14.27.1 image: frappe/erpnext:v14
platform: linux/amd64 platform: linux/amd64
deploy: deploy:
restart_policy: restart_policy:
@ -25,7 +25,7 @@ services:
- logs:/home/frappe/frappe-bench/logs - logs:/home/frappe/frappe-bench/logs
configurator: configurator:
image: frappe/erpnext:v14.27.1 image: frappe/erpnext:v14
platform: linux/amd64 platform: linux/amd64
deploy: deploy:
restart_policy: restart_policy:
@ -40,21 +40,19 @@ services:
bench set-config -gp db_port $$DB_PORT; bench set-config -gp db_port $$DB_PORT;
bench set-config -g redis_cache "redis://$$REDIS_CACHE"; bench set-config -g redis_cache "redis://$$REDIS_CACHE";
bench set-config -g redis_queue "redis://$$REDIS_QUEUE"; 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; bench set-config -gp socketio_port $$SOCKETIO_PORT;
environment: environment:
DB_HOST: db DB_HOST: db
DB_PORT: "3306" DB_PORT: "3306"
REDIS_CACHE: redis-cache:6379 REDIS_CACHE: redis-cache:6379
REDIS_QUEUE: redis-queue:6379 REDIS_QUEUE: redis-queue:6379
REDIS_SOCKETIO: redis-socketio:6379
SOCKETIO_PORT: "9000" SOCKETIO_PORT: "9000"
volumes: volumes:
- sites:/home/frappe/frappe-bench/sites - sites:/home/frappe/frappe-bench/sites
- logs:/home/frappe/frappe-bench/logs - logs:/home/frappe/frappe-bench/logs
create-site: create-site:
image: frappe/erpnext:v14.27.1 image: frappe/erpnext:v14
platform: linux/amd64 platform: linux/amd64
deploy: deploy:
restart_policy: restart_policy:
@ -70,7 +68,6 @@ services:
wait-for-it -t 120 db:3306; wait-for-it -t 120 db:3306;
wait-for-it -t 120 redis-cache:6379; wait-for-it -t 120 redis-cache:6379;
wait-for-it -t 120 redis-queue:6379; wait-for-it -t 120 redis-queue:6379;
wait-for-it -t 120 redis-socketio:6379;
export start=`date +%s`; export start=`date +%s`;
until [[ -n `grep -hs ^ sites/common_site_config.json | jq -r ".db_host // empty"` ]] && \ 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_cache // empty"` ]] && \
@ -107,7 +104,7 @@ services:
- db-data:/var/lib/mysql - db-data:/var/lib/mysql
frontend: frontend:
image: frappe/erpnext:v14.27.1 image: frappe/erpnext:v14
platform: linux/amd64 platform: linux/amd64
deploy: deploy:
restart_policy: restart_policy:
@ -129,23 +126,8 @@ services:
ports: ports:
- "8080:8080" - "8080:8080"
queue-default:
image: frappe/erpnext:v14.27.1
platform: linux/amd64
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: queue-long:
image: frappe/erpnext:v14.27.1 image: frappe/erpnext:v14
platform: linux/amd64 platform: linux/amd64
deploy: deploy:
restart_policy: restart_policy:
@ -160,7 +142,7 @@ services:
- logs:/home/frappe/frappe-bench/logs - logs:/home/frappe/frappe-bench/logs
queue-short: queue-short:
image: frappe/erpnext:v14.27.1 image: frappe/erpnext:v14
platform: linux/amd64 platform: linux/amd64
deploy: deploy:
restart_policy: restart_policy:
@ -192,17 +174,8 @@ services:
volumes: volumes:
- redis-cache-data:/data - redis-cache-data:/data
redis-socketio:
image: redis:6.2-alpine
platform: linux/amd64
deploy:
restart_policy:
condition: on-failure
volumes:
- redis-socketio-data:/data
scheduler: scheduler:
image: frappe/erpnext:v14.27.1 image: frappe/erpnext:v14
platform: linux/amd64 platform: linux/amd64
deploy: deploy:
restart_policy: restart_policy:
@ -215,7 +188,7 @@ services:
- logs:/home/frappe/frappe-bench/logs - logs:/home/frappe/frappe-bench/logs
websocket: websocket:
image: frappe/erpnext:v14.27.1 image: frappe/erpnext:v14
platform: linux/amd64 platform: linux/amd64
deploy: deploy:
restart_policy: restart_policy:
@ -231,7 +204,6 @@ volumes:
db-data: db-data:
redis-queue-data: redis-queue-data:
redis-cache-data: redis-cache-data:
redis-socketio-data:
sites: sites:
logs: logs:
``` ```

View File

@ -8,7 +8,6 @@ This setup is a very simple single compose file that does everything to start re
- backend, serves gunicorn backend - backend, serves gunicorn backend
- frontend, serves static assets through nginx frontend reverse proxies websocket and gunicorn. - frontend, serves static assets through nginx frontend reverse proxies websocket and gunicorn.
- queue-default, default rq worker.
- queue-long, long rq worker. - queue-long, long rq worker.
- queue-short, short rq worker. - queue-short, short rq worker.
- schedule, event scheduler. - schedule, event scheduler.
@ -23,8 +22,7 @@ This setup is a very simple single compose file that does everything to start re
- db, mariadb, container with frappe specific configuration. - db, mariadb, container with frappe specific configuration.
- redis-cache, redis for cache data. - redis-cache, redis for cache data.
- redis-queue, redis for rq data. - redis-queue, redis for rq data and pub/sub.
- redis-socketio, redis for socketio pubsub.
## Volumes ## Volumes

View File

@ -11,7 +11,6 @@ DB_PORT=
# Only if you use external Redis # Only if you use external Redis
REDIS_CACHE= REDIS_CACHE=
REDIS_QUEUE= REDIS_QUEUE=
REDIS_SOCKETIO=
# Only with HTTPS override # Only with HTTPS override
LETSENCRYPT_EMAIL=mail@example.com LETSENCRYPT_EMAIL=mail@example.com

View File

@ -95,21 +95,18 @@ USER frappe
WORKDIR /home/frappe WORKDIR /home/frappe
# Install Python via pyenv # Install Python via pyenv
ENV PYTHON_VERSION_V13=3.9.17 ENV PYTHON_VERSION_V14=3.10.13
ENV PYTHON_VERSION_DEVELOP=3.11.4 ENV PYTHON_VERSION=3.11.6
ENV PYTHON_VERSION=3.10.12
ENV PYENV_ROOT /home/frappe/.pyenv ENV PYENV_ROOT /home/frappe/.pyenv
ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
# From https://github.com/pyenv/pyenv#basic-github-checkout # From https://github.com/pyenv/pyenv#basic-github-checkout
RUN git clone --depth 1 https://github.com/pyenv/pyenv.git .pyenv \ RUN git clone --depth 1 https://github.com/pyenv/pyenv.git .pyenv \
&& pyenv install $PYTHON_VERSION_V13 \ && pyenv install $PYTHON_VERSION_V14 \
&& pyenv install $PYTHON_VERSION_DEVELOP \
&& pyenv install $PYTHON_VERSION \ && pyenv install $PYTHON_VERSION \
&& PYENV_VERSION=$PYTHON_VERSION_V13 pip install --no-cache-dir virtualenv \ && PYENV_VERSION=$PYTHON_VERSION_V14 pip install --no-cache-dir virtualenv \
&& PYENV_VERSION=$PYTHON_VERSION_DEVELOP pip install --no-cache-dir virtualenv \
&& PYENV_VERSION=$PYTHON_VERSION pip install --no-cache-dir virtualenv \ && PYENV_VERSION=$PYTHON_VERSION pip install --no-cache-dir virtualenv \
&& pyenv global $PYTHON_VERSION $PYTHON_VERSION_v13 \ && pyenv global $PYTHON_VERSION $PYTHON_VERSION_v14 \
&& sed -Ei -e '/^([^#]|$)/ {a export PYENV_ROOT="/home/frappe/.pyenv" a export PATH="$PYENV_ROOT/bin:$PATH" a ' -e ':a' -e '$!{n;ba};}' ~/.profile \ && sed -Ei -e '/^([^#]|$)/ {a export PYENV_ROOT="/home/frappe/.pyenv" a export PATH="$PYENV_ROOT/bin:$PATH" a ' -e ':a' -e '$!{n;ba};}' ~/.profile \
&& echo 'eval "$(pyenv init --path)"' >>~/.profile \ && echo 'eval "$(pyenv init --path)"' >>~/.profile \
&& echo 'eval "$(pyenv init -)"' >>~/.bashrc && echo 'eval "$(pyenv init -)"' >>~/.bashrc
@ -125,19 +122,15 @@ RUN git clone ${GIT_REPO} --depth 1 -b ${GIT_BRANCH} .bench \
&& echo "export BENCH_DEVELOPER=1" >>/home/frappe/.bashrc && echo "export BENCH_DEVELOPER=1" >>/home/frappe/.bashrc
# Install Node via nvm # Install Node via nvm
ENV NODE_VERSION_13=14.21.3 ENV NODE_VERSION_14=16.20.2
ENV NODE_VERSION_DEVELOP=18.12.0 ENV NODE_VERSION=18.18.2
ENV NODE_VERSION=16.20.1
ENV NVM_DIR /home/frappe/.nvm ENV NVM_DIR /home/frappe/.nvm
ENV PATH ${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH} ENV PATH ${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH}
RUN wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash \ RUN wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash \
&& . ${NVM_DIR}/nvm.sh \ && . ${NVM_DIR}/nvm.sh \
&& nvm install ${NODE_VERSION_13} \ && nvm install ${NODE_VERSION_14} \
&& nvm use v${NODE_VERSION_13} \ && nvm use v${NODE_VERSION_14} \
&& npm install -g yarn \
&& nvm install ${NODE_VERSION_DEVELOP} \
&& nvm use v${NODE_VERSION_DEVELOP} \
&& npm install -g yarn \ && npm install -g yarn \
&& nvm install ${NODE_VERSION} \ && nvm install ${NODE_VERSION} \
&& nvm use v${NODE_VERSION} \ && nvm use v${NODE_VERSION} \

View File

@ -1,4 +1,4 @@
ARG PYTHON_VERSION=3.11.4 ARG PYTHON_VERSION=3.11.6
ARG DEBIAN_BASE=bookworm ARG DEBIAN_BASE=bookworm
FROM python:${PYTHON_VERSION}-slim-${DEBIAN_BASE} AS base FROM python:${PYTHON_VERSION}-slim-${DEBIAN_BASE} AS base
@ -7,7 +7,7 @@ COPY resources/nginx-entrypoint.sh /usr/local/bin/nginx-entrypoint.sh
ARG WKHTMLTOPDF_VERSION=0.12.6.1-3 ARG WKHTMLTOPDF_VERSION=0.12.6.1-3
ARG WKHTMLTOPDF_DISTRO=bookworm ARG WKHTMLTOPDF_DISTRO=bookworm
ARG NODE_VERSION=18.16.1 ARG NODE_VERSION=18.18.2
ENV NVM_DIR=/home/frappe/.nvm ENV NVM_DIR=/home/frappe/.nvm
ENV PATH ${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH} ENV PATH ${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH}
@ -36,7 +36,7 @@ RUN useradd -ms /bin/bash frappe \
jq \ jq \
# NodeJS # NodeJS
&& mkdir -p ${NVM_DIR} \ && mkdir -p ${NVM_DIR} \
&& curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash \ && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash \
&& . ${NVM_DIR}/nvm.sh \ && . ${NVM_DIR}/nvm.sh \
&& nvm install ${NODE_VERSION} \ && nvm install ${NODE_VERSION} \
&& nvm use v${NODE_VERSION} \ && nvm use v${NODE_VERSION} \
@ -103,7 +103,7 @@ RUN if [ -n "${APPS_JSON_BASE64}" ]; then \
USER frappe USER frappe
ARG FRAPPE_BRANCH=version-14 ARG FRAPPE_BRANCH=version-15
ARG FRAPPE_PATH=https://github.com/frappe/frappe ARG FRAPPE_PATH=https://github.com/frappe/frappe
RUN export APP_INSTALL_ARGS="" && \ RUN export APP_INSTALL_ARGS="" && \
if [ -n "${APPS_JSON_BASE64}" ]; then \ if [ -n "${APPS_JSON_BASE64}" ]; then \

View File

@ -1,10 +1,10 @@
ARG PYTHON_VERSION=3.11.4 ARG PYTHON_VERSION=3.11.6
ARG DEBIAN_BASE=bookworm ARG DEBIAN_BASE=bookworm
FROM python:${PYTHON_VERSION}-slim-${DEBIAN_BASE} AS base FROM python:${PYTHON_VERSION}-slim-${DEBIAN_BASE} AS base
ARG WKHTMLTOPDF_VERSION=0.12.6.1-3 ARG WKHTMLTOPDF_VERSION=0.12.6.1-3
ARG WKHTMLTOPDF_DISTRO=bookworm ARG WKHTMLTOPDF_DISTRO=bookworm
ARG NODE_VERSION=18.16.1 ARG NODE_VERSION=18.18.2
ENV NVM_DIR=/home/frappe/.nvm ENV NVM_DIR=/home/frappe/.nvm
ENV PATH ${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH} ENV PATH ${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH}
@ -33,7 +33,7 @@ RUN useradd -ms /bin/bash frappe \
jq \ jq \
# NodeJS # NodeJS
&& mkdir -p ${NVM_DIR} \ && mkdir -p ${NVM_DIR} \
&& curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash \ && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash \
&& . ${NVM_DIR}/nvm.sh \ && . ${NVM_DIR}/nvm.sh \
&& nvm install ${NODE_VERSION} \ && nvm install ${NODE_VERSION} \
&& nvm use v${NODE_VERSION} \ && nvm use v${NODE_VERSION} \
@ -95,10 +95,10 @@ RUN apt-get update \
USER frappe USER frappe
ARG FRAPPE_BRANCH=version-14 ARG FRAPPE_BRANCH=version-15
ARG FRAPPE_PATH=https://github.com/frappe/frappe ARG FRAPPE_PATH=https://github.com/frappe/frappe
ARG ERPNEXT_REPO=https://github.com/frappe/erpnext ARG ERPNEXT_REPO=https://github.com/frappe/erpnext
ARG ERPNEXT_BRANCH=version-14 ARG ERPNEXT_BRANCH=version-15
RUN bench init \ RUN bench init \
--frappe-branch=${FRAPPE_BRANCH} \ --frappe-branch=${FRAPPE_BRANCH} \
--frappe-path=${FRAPPE_PATH} \ --frappe-path=${FRAPPE_PATH} \

View File

@ -26,10 +26,6 @@ services:
networks: networks:
- bench-network - bench-network
- mariadb-network - mariadb-network
queue-default:
networks:
- bench-network
- mariadb-network
queue-short: queue-short:
networks: networks:
- bench-network - bench-network
@ -48,11 +44,6 @@ services:
- bench-network - bench-network
- mariadb-network - mariadb-network
redis-socketio:
networks:
- bench-network
- mariadb-network
networks: networks:
traefik-public: traefik-public:
external: true external: true

View File

@ -3,11 +3,9 @@ services:
environment: environment:
REDIS_CACHE: redis-cache:6379 REDIS_CACHE: redis-cache:6379
REDIS_QUEUE: redis-queue:6379 REDIS_QUEUE: redis-queue:6379
REDIS_SOCKETIO: redis-socketio:6379
depends_on: depends_on:
- redis-cache - redis-cache
- redis-queue - redis-queue
- redis-socketio
redis-cache: redis-cache:
image: redis:6.2-alpine image: redis:6.2-alpine
@ -19,12 +17,6 @@ services:
volumes: volumes:
- redis-queue-data:/data - redis-queue-data:/data
redis-socketio:
image: redis:6.2-alpine
volumes:
- redis-socketio-data:/data
volumes: volumes:
redis-cache-data: redis-cache-data:
redis-queue-data: redis-queue-data:
redis-socketio-data:

28
pwd.yml
View File

@ -18,6 +18,7 @@ services:
entrypoint: entrypoint:
- bash - bash
- -c - -c
# add redis_socketio for backward compatibility
command: command:
- > - >
ls -1 apps > sites/apps.txt; ls -1 apps > sites/apps.txt;
@ -25,14 +26,13 @@ services:
bench set-config -gp db_port $$DB_PORT; bench set-config -gp db_port $$DB_PORT;
bench set-config -g redis_cache "redis://$$REDIS_CACHE"; bench set-config -g redis_cache "redis://$$REDIS_CACHE";
bench set-config -g redis_queue "redis://$$REDIS_QUEUE"; bench set-config -g redis_queue "redis://$$REDIS_QUEUE";
bench set-config -g redis_socketio "redis://$$REDIS_SOCKETIO"; bench set-config -g redis_socketio "redis://$$REDIS_QUEUE";
bench set-config -gp socketio_port $$SOCKETIO_PORT; bench set-config -gp socketio_port $$SOCKETIO_PORT;
environment: environment:
DB_HOST: db DB_HOST: db
DB_PORT: "3306" DB_PORT: "3306"
REDIS_CACHE: redis-cache:6379 REDIS_CACHE: redis-cache:6379
REDIS_QUEUE: redis-queue:6379 REDIS_QUEUE: redis-queue:6379
REDIS_SOCKETIO: redis-socketio:6379
SOCKETIO_PORT: "9000" SOCKETIO_PORT: "9000"
volumes: volumes:
- sites:/home/frappe/frappe-bench/sites - sites:/home/frappe/frappe-bench/sites
@ -54,7 +54,6 @@ services:
wait-for-it -t 120 db:3306; wait-for-it -t 120 db:3306;
wait-for-it -t 120 redis-cache:6379; wait-for-it -t 120 redis-cache:6379;
wait-for-it -t 120 redis-queue:6379; wait-for-it -t 120 redis-queue:6379;
wait-for-it -t 120 redis-socketio:6379;
export start=`date +%s`; export start=`date +%s`;
until [[ -n `grep -hs ^ sites/common_site_config.json | jq -r ".db_host // empty"` ]] && \ 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_cache // empty"` ]] && \
@ -111,20 +110,6 @@ services:
ports: ports:
- "8080:8080" - "8080:8080"
queue-default:
image: frappe/erpnext:v14.44.1
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: queue-long:
image: frappe/erpnext:v14.44.1 image: frappe/erpnext:v14.44.1
deploy: deploy:
@ -169,14 +154,6 @@ services:
volumes: volumes:
- redis-cache-data:/data - redis-cache-data:/data
redis-socketio:
image: redis:6.2-alpine
deploy:
restart_policy:
condition: on-failure
volumes:
- redis-socketio-data:/data
scheduler: scheduler:
image: frappe/erpnext:v14.44.1 image: frappe/erpnext:v14.44.1
deploy: deploy:
@ -205,6 +182,5 @@ volumes:
db-data: db-data:
redis-queue-data: redis-queue-data:
redis-cache-data: redis-cache-data:
redis-socketio-data:
sites: sites:
logs: logs:

View File

@ -31,7 +31,7 @@ def get_redis_url(addr: str) -> Address:
def get_addresses(config: dict[str, Any]) -> Iterable[Address]: def get_addresses(config: dict[str, Any]) -> Iterable[Address]:
yield (config["db_host"], config["db_port"]) yield (config["db_host"], config["db_port"])
for key in ("redis_cache", "redis_queue", "redis_socketio"): for key in ("redis_cache", "redis_queue"):
yield get_redis_url(config[key]) yield get_redis_url(config[key])

View File

@ -14,9 +14,6 @@ services:
queue-short: queue-short:
image: localhost:5000/frappe/erpnext:${ERPNEXT_VERSION} image: localhost:5000/frappe/erpnext:${ERPNEXT_VERSION}
queue-default:
image: localhost:5000/frappe/erpnext:${ERPNEXT_VERSION}
queue-long: queue-long:
image: localhost:5000/frappe/erpnext:${ERPNEXT_VERSION} image: localhost:5000/frappe/erpnext:${ERPNEXT_VERSION}

View File

@ -10,7 +10,6 @@ from tests.utils import Compose, check_url_content
BACKEND_SERVICES = ( BACKEND_SERVICES = (
"backend", "backend",
"queue-short", "queue-short",
"queue-default",
"queue-long", "queue-long",
"scheduler", "scheduler",
) )
@ -127,7 +126,7 @@ class TestErpnext:
("url", "callback"), ("url", "callback"),
( (
( (
"/api/method/erpnext.templates.pages.product_search.get_product_list", "/api/method/erpnext.templates.pages.search_help.get_help_results_sections?text=help",
api_cb, api_cb,
), ),
("/assets/erpnext/js/setup_wizard.js", assets_cb), ("/assets/erpnext/js/setup_wizard.js", assets_cb),