diff --git a/build/common/worker/docker-entrypoint.sh b/build/common/worker/docker-entrypoint.sh index 2ad58b9c..171de971 100755 --- a/build/common/worker/docker-entrypoint.sh +++ b/build/common/worker/docker-entrypoint.sh @@ -201,6 +201,13 @@ elif [ "$1" = 'restore-backup' ]; then && python /home/frappe/frappe-bench/commands/restore_backup.py" exit +elif [ "$1" = 'bench' ]; then + + exec su frappe -c '/home/frappe/frappe-bench/env/bin/python \ + /home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py \ + frappe "$@"' + exit + else exec su frappe -c "$@" diff --git a/docs/custom-apps-for-production.md b/docs/custom-apps-for-production.md index cce67094..0f8a988c 100644 --- a/docs/custom-apps-for-production.md +++ b/docs/custom-apps-for-production.md @@ -20,6 +20,8 @@ RUN install_app [custom] https://github.com/[username]/[custom] [branch] # Only add the branch if you are using a specific tag or branch. ``` +**Note:** Replace `https://github.com/[username]/[custom]` above with your custom app's Git repository URL (may include credentials if needed). Your custom app Git repository **must** be named exactly as the custom app's name, and use the same branch name as Frappe/ERPNext branch name that you use. + Create a `Dockerfile` in `./build/[custom]-nginx` with the following content: ```Dockerfile @@ -27,7 +29,7 @@ FROM bitnami/node:12-prod COPY build/[custom]-nginx/install_app.sh /install_app -RUN /install_app [custom] https://github.com/[username]/[custom] +RUN /install_app [custom] https://github.com/[username]/[custom] [branch] FROM frappe/erpnext-nginx:edge @@ -53,4 +55,4 @@ Open up `./installation/docker-compose-custom.yml` and replace all instances of sed -i "s#\[app\]#[custom]#" ./installation/docker-compose-custom.yml ``` -Install like usual, except that when you set the `INSTALL_APPS` variable to `erpnext,[custom]`. \ No newline at end of file +Install like usual, except that when you set the `INSTALL_APPS` variable to `erpnext,[custom]`. diff --git a/docs/site-operations.md b/docs/site-operations.md index 1a05525f..6807b2f4 100644 --- a/docs/site-operations.md +++ b/docs/site-operations.md @@ -203,3 +203,25 @@ Additional services can be pinged as part of health check with option `-p` or `- This check ensures that given service should be connected along with services in common_site_config.json. If connection to service(s) fails, the command fails with exit code 1. + +## Frappe internal commands using bench helper + +To execute commands using bench helper. + +```shell + docker run \ + -v _sites-vol:/home/frappe/frappe-bench/sites \ + --network _default \ + frappe/frappe-worker:$VERSION bench --help +``` + +Example command to clear cache + +```shell + docker run \ + -v _sites-vol:/home/frappe/frappe-bench/sites \ + --network _default \ + frappe/frappe-worker:$VERSION bench --site erp.mysite.com clear-cache +``` + +Use it to install/uninstall custom apps, add system manager user, etc. diff --git a/tests/docker-test.sh b/tests/docker-test.sh index 48c16e21..d81e2b0b 100755 --- a/tests/docker-test.sh +++ b/tests/docker-test.sh @@ -408,3 +408,9 @@ docker run \ -v frappebench00_sites-vol:/home/frappe/frappe-bench/sites \ --network frappebench00_default \ frappe/erpnext-worker:edge console pgsql.localhost + +echo -e "\e[1m\e[4mCheck bench --help\e[0m" +docker run \ + -v frappebench00_sites-vol:/home/frappe/frappe-bench/sites \ + --network frappebench00_default \ + frappe/erpnext-worker:edge bench --help