2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-04 22:55:25 +00:00

Merge pull request #1592 from revant/easy-build

This commit is contained in:
Md Hussain Nagaria 2024-12-03 15:00:33 +05:30 committed by GitHub
commit 1bf53b4e7c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 865 additions and 304 deletions

View File

@ -28,7 +28,7 @@ jobs:
- name: Perform production easy install
run: |
python3 ${GITHUB_WORKSPACE}/easy-install.py -p -n actions_test --email test@frappe.io
python3 ${GITHUB_WORKSPACE}/easy-install.py build --deploy --tag=custom-apps:latest --project=actions_test --email=test@frappe.io --image=custom-apps --version=latest --app=erpnext
docker compose -p actions_test exec backend bench version --format json
docker compose -p actions_test exec backend bench --site site1.localhost list-apps --format json
result=$(curl -H "Host: site1.localhost" -sk https://127.0.0.1/api/method/ping | jq -r ."message")

150
README.md
View File

@ -87,7 +87,7 @@ Download the Easy Install script and execute it:
```sh
$ wget https://raw.githubusercontent.com/frappe/bench/develop/easy-install.py
$ python3 easy-install.py --prod --email your@email.tld
$ python3 easy-install.py deploy --email=user@domain.tld --sitename=subdomain.domain.tld --app=erpnext
```
This script will install docker on your system and will fetch the required containers, setup bench and a default ERPNext instance.
@ -101,20 +101,150 @@ When the setup is complete, you will be able to access the system at `http://<yo
Here are the arguments for the easy-install script
```txt
usage: easy-install.py [-h] [-p] [-d] [-s SITENAME] [-n PROJECT] [--email EMAIL]
**Build custom images**
Install Frappe with Docker
```txt
usage: easy-install.py build [-h] [-n PROJECT] [-i IMAGE] [-q] [-m HTTP_PORT] [-v VERSION] [-a APPS] [-s SITES] [-e EMAIL]
[-p] [-r FRAPPE_PATH] [-b FRAPPE_BRANCH] [-j APPS_JSON] [-t TAGS] [-c CONTAINERFILE]
[-y PYTHON_VERSION] [-d NODE_VERSION] [-x] [-u]
options:
-h, --help show this help message and exit
-p, --prod Setup Production System
-d, --dev Setup Development System
-s SITENAME, --sitename SITENAME The Site Name for your production site
-n PROJECT, --project PROJECT Project Name
--email EMAIL Add email for the SSL.
-h, --help show this help message and exit
-n PROJECT, --project PROJECT
Project Name
-i IMAGE, --image IMAGE
Full Image Name
-q, --no-ssl No https
-m HTTP_PORT, --http-port HTTP_PORT
Http port in case of no-ssl
-v VERSION, --version VERSION
ERPNext version to install, defaults to latest stable
-a APPS, --app APPS list of app(s) to be installed
-s SITES, --sitename SITES
Site Name(s) for your production bench
-e EMAIL, --email EMAIL
Add email for the SSL.
-p, --push Push the built image to registry
-r FRAPPE_PATH, --frappe-path FRAPPE_PATH
Frappe Repository to use, default: https://github.com/frappe/frappe
-b FRAPPE_BRANCH, --frappe-branch FRAPPE_BRANCH
Frappe branch to use, default: version-15
-j APPS_JSON, --apps-json APPS_JSON
Path to apps json, default: frappe_docker/development/apps-example.json
-t TAGS, --tag TAGS Full Image Name(s), default: custom-apps:latest
-c CONTAINERFILE, --containerfile CONTAINERFILE
Path to Containerfile: images/layered/Containerfile
-y PYTHON_VERSION, --python-version PYTHON_VERSION
Python Version, default: 3.11.6
-d NODE_VERSION, --node-version NODE_VERSION
NodeJS Version, default: 18.18.2
-x, --deploy Deploy after build
-u, --upgrade Upgrade after build
```
**Deploy using compose**
```txt
usage: easy-install.py deploy [-h] [-n PROJECT] [-i IMAGE] [-q] [-m HTTP_PORT] [-v VERSION] [-a APPS] [-s SITES] [-e EMAIL]
options:
-h, --help show this help message and exit
-n PROJECT, --project PROJECT
Project Name
-i IMAGE, --image IMAGE
Full Image Name
-q, --no-ssl No https
-m HTTP_PORT, --http-port HTTP_PORT
Http port in case of no-ssl
-v VERSION, --version VERSION
ERPNext version to install, defaults to latest stable
-a APPS, --app APPS list of app(s) to be installed
-s SITES, --sitename SITES
Site Name(s) for your production bench
-e EMAIL, --email EMAIL
Add email for the SSL.
```
**Upgrade existing project**
```txt
usage: easy-install.py upgrade [-h] [-n PROJECT] [-i IMAGE] [-q] [-m HTTP_PORT] [-v VERSION]
options:
-h, --help show this help message and exit
-n PROJECT, --project PROJECT
Project Name
-i IMAGE, --image IMAGE
Full Image Name
-q, --no-ssl No https
-m HTTP_PORT, --http-port HTTP_PORT
Http port in case of no-ssl
-v VERSION, --version VERSION
ERPNext or image version to install, defaults to latest stable
```
**Development setup using compose**
```txt
usage: easy-install.py develop [-h] [-n PROJECT]
options:
-h, --help show this help message and exit
-n PROJECT, --project PROJECT
Compose project name
```
**Exec into existing project**
```txt
usage: easy-install.py exec [-h] [-n PROJECT]
options:
-h, --help show this help message and exit
-n PROJECT, --project PROJECT
Project Name
```
To use custom apps, you need to create a json file with list of apps and pass it to build command.
Example apps.json
```json
[
{
"url": "https://github.com/frappe/wiki.git",
"branch": "master"
}
]
```
Execute following command to build and deploy above apps:
```sh
$ python3 easy-install.py build \
--tag=ghcr.io/org/repo/custom-apps:latest \
--push \
--image=ghcr.io/org/repo/custom-apps \
--version=latest \
--deploy \
--project=actions_test \
--email=test@frappe.io \
--apps-json=apps.json \
--app=wiki
```
Note:
- `--tag`, tag to set for built image, can be multiple.
- `--push`, push the built image.
- `--image`, the image to use when starting docker compose project.
- `--version`, the version to use when starting docker compose project.
- `--app`, app to install on site creation, can be multiple.
- `--deploy`, flag to deploy after build/push is complete
- `--project=actions_test`, name of the project, compose file with project name will be stored in user home directory.
- `--email=test@frappe.io`, valid email for letsencrypt certificate expiry notification.
- `--apps-json`, path to json file with list of apps to be added to bench.
#### Troubleshooting
In case the setup fails, the log file is saved under `$HOME/easy-install.log`. You may then

File diff suppressed because it is too large Load Diff