Skip to content

Commit

Permalink
refactor: prepare for v15 (#1243)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
revant authored Oct 20, 2023
1 parent ab5f985 commit f605add
Show file tree
Hide file tree
Showing 26 changed files with 73 additions and 187 deletions.
4 changes: 2 additions & 2 deletions .github/scripts/get_latest_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from typing import Literal

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:
Expand Down Expand Up @@ -57,7 +57,7 @@ def main(_args: list[str]) -> int:
parser = argparse.ArgumentParser()
parser.add_argument("--repo", choices=["frappe", "erpnext"], required=True)
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)

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build_develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ jobs:
repo: erpnext
version: develop
push: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
python_version: 3.11.4
node_version: 18.16.1
python_version: 3.11.6
node_version: 18.18.2
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
24 changes: 12 additions & 12 deletions .github/workflows/build_stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,26 @@ on:
workflow_dispatch:

jobs:
v13:
v14:
uses: ./.github/workflows/docker-build-push.yml
with:
repo: erpnext
version: "13"
version: "14"
push: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
python_version: 3.9.17
node_version: 14.21.3
python_version: 3.10.13
node_version: 16.20.2
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

v14:
v15:
uses: ./.github/workflows/docker-build-push.yml
with:
repo: erpnext
version: "14"
version: "15"
push: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
python_version: 3.10.12
node_version: 16.20.1
python_version: 3.11.6
node_version: 18.18.2
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
Expand All @@ -58,7 +58,7 @@ jobs:
name: Update example.env and pwd.yml
runs-on: ubuntu-latest
if: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
needs: v14
needs: v15

steps:
- name: Checkout
Expand All @@ -70,7 +70,7 @@ jobs:
python-version: "3.10"

- 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
run: |
Expand All @@ -96,7 +96,7 @@ jobs:
name: Release Helm
runs-on: ubuntu-latest
if: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
needs: v14
needs: v15

steps:
- name: Setup deploy key
Expand All @@ -113,4 +113,4 @@ jobs:
run: |
git clone [email protected]:frappe/helm.git && cd helm
pip install -r release_wizard/requirements.txt
./release_wizard/wizard 14 patch --remote origin --ci
./release_wizard/wizard 15 patch --remote origin --ci
8 changes: 2 additions & 6 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ services:
entrypoint:
- bash
- -c
# 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_SOCKETIO";
bench set-config -g redis_socketio "redis://$$REDIS_QUEUE";
bench set-config -gp socketio_port $$SOCKETIO_PORT;
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: {}

Expand Down Expand Up @@ -72,10 +72,6 @@ services:
<<: *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
Expand Down
3 changes: 0 additions & 3 deletions devcontainer-example/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ services:
redis-queue:
image: redis:alpine

redis-socketio:
image: redis:alpine

frappe:
image: frappe/bench:latest
command: sleep infinity
Expand Down
2 changes: 1 addition & 1 deletion development/apps-example.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"url": "https://github.com/frappe/erpnext.git",
"branch": "version-14"
"branch": "version-15"
}
]
25 changes: 11 additions & 14 deletions development/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ def get_args_parser():
"--frappe-branch",
action="store",
type=str,
help="frappe repo to use, default: version-14", # noqa: E501
default="version-14",
help="frappe repo to use, default: version-15", # noqa: E501
default="version-15",
)
parser.add_argument(
"-p",
Expand All @@ -97,6 +97,14 @@ def get_args_parser():
action="store_true",
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


Expand Down Expand Up @@ -156,17 +164,6 @@ def init_bench_if_not_exist(args):
],
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)
subprocess.call(
["bench", "set-config", "-gp", "developer_mode", "1"],
Expand All @@ -182,7 +179,7 @@ def create_site_in_bench(args):
"new-site",
"--no-mariadb-socket",
"--mariadb-root-password=123",
"--admin-password=admin",
f"--admin-password={args.admin_password}",
]
apps = os.listdir(f"{os.getcwd()}/{args.bench_name}/apps")
apps.remove("frappe")
Expand Down
12 changes: 0 additions & 12 deletions development/vscode-example/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,6 @@
"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",
"type": "python",
Expand Down
4 changes: 2 additions & 2 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ variable "REGISTRY_USER" {
}

variable PYTHON_VERSION {
default = "3.11.4"
default = "3.11.6"
}
variable NODE_VERSION {
default = "18.16.1"
default = "18.18.2"
}

variable "FRAPPE_VERSION" {
Expand Down
10 changes: 5 additions & 5 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ PYENV_VERSION=3.10.12 bench init --skip-redis-config-generation --frappe-branch
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
nvm use v14
Expand All @@ -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 redis_cache redis://redis-cache: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.
Expand All @@ -112,8 +111,7 @@ For any reason the above commands fail, set the values in `common_site_config.js
{
"db_host": "mariadb",
"redis_cache": "redis://redis-cache:6379",
"redis_queue": "redis://redis-queue:6379",
"redis_socketio": "redis://redis-socketio:6379"
"redis_queue": "redis://redis-queue:6379"
}
```

Expand Down Expand Up @@ -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.

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.

Expand Down Expand Up @@ -269,6 +267,8 @@ options:
-n NODE_VERSION, --node-version NODE_VERSION
node version, default: Not Set
-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.
Expand Down
6 changes: 1 addition & 5 deletions docs/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ Hostname for redis server to store cache. Set only if external service for redis

### `REDIS_QUEUE`

Hostname for redis server to store queue data. 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.
Hostname for redis server to store queue data and socketio. Set only if external service for redis is used.

### `ERPNEXT_VERSION`

Expand Down
2 changes: 1 addition & 1 deletion docs/list-of-containers.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
- `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).
- `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/).

## Overrides
Expand Down
3 changes: 0 additions & 3 deletions docs/migrate-from-multi-image-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,12 @@ configurator:
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"
# ... removed for brevity
```
Expand All @@ -95,7 +93,6 @@ create-site:
wait-for-it -t 120 db:3306;
wait-for-it -t 120 redis-cache:6379;
wait-for-it -t 120 redis-queue:6379;
wait-for-it -t 120 redis-socketio: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"` ]] && \
Expand Down
6 changes: 2 additions & 4 deletions docs/setup-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

In this case make sure you've set `DB_HOST`, `DB_PORT`, `REDIS_CACHE`, `REDIS_QUEUE` and `REDIS_SOCKETIO`
environment variables or the `configurator` will fail.
In this case make sure you've set `DB_HOST`, `DB_PORT`, `REDIS_CACHE` and `REDIS_QUEUE` environment variables or the `configurator` will fail.

```sh
# Generate YAML
Expand All @@ -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

In this case make sure you've set `DB_HOST`, `DB_PORT`, `REDIS_CACHE`, `REDIS_QUEUE` and `REDIS_SOCKETIO`
environment variables or the `configurator` will fail.
In this case make sure you've set `DB_HOST`, `DB_PORT`, `REDIS_CACHE` and `REDIS_QUEUE` environment variables or the `configurator` will fail.

```sh
# Generate YAML
Expand Down
Loading

0 comments on commit f605add

Please sign in to comment.