mirror of
https://github.com/frappe/frappe_docker.git
synced 2025-01-11 17:38:46 +00:00
Merge pull request #337 from revant/fix-bench-helper
This commit is contained in:
commit
d236d030f2
19
build/common/worker/bench
Executable file
19
build/common/worker/bench
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
#!/home/frappe/frappe-bench/env/bin/python
|
||||||
|
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
bench_dir = os.path.join(os.sep, 'home', 'frappe', 'frappe-bench')
|
||||||
|
sites_dir = os.path.join(bench_dir, 'sites')
|
||||||
|
bench_helper = os.path.join(
|
||||||
|
bench_dir, 'apps', 'frappe',
|
||||||
|
'frappe', 'utils', 'bench_helper.py',
|
||||||
|
)
|
||||||
|
cwd = os.getcwd()
|
||||||
|
os.chdir(sites_dir)
|
||||||
|
subprocess.check_call(
|
||||||
|
[sys.executable, bench_helper, 'frappe'] + sys.argv[1:],
|
||||||
|
)
|
@ -201,15 +201,8 @@ elif [ "$1" = 'restore-backup' ]; then
|
|||||||
&& python /home/frappe/frappe-bench/commands/restore_backup.py"
|
&& python /home/frappe/frappe-bench/commands/restore_backup.py"
|
||||||
exit
|
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
|
else
|
||||||
|
|
||||||
exec su frappe -c "$@"
|
exec $@
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
@ -57,6 +57,7 @@ USER root
|
|||||||
COPY build/common/commands/* /home/frappe/frappe-bench/commands/
|
COPY build/common/commands/* /home/frappe/frappe-bench/commands/
|
||||||
COPY build/common/common_site_config.json.template /opt/frappe/common_site_config.json.template
|
COPY build/common/common_site_config.json.template /opt/frappe/common_site_config.json.template
|
||||||
COPY build/common/worker/install_app.sh /usr/local/bin/install_app
|
COPY build/common/worker/install_app.sh /usr/local/bin/install_app
|
||||||
|
COPY build/common/worker/bench /usr/local/bin/bench
|
||||||
|
|
||||||
# Setup docker-entrypoint
|
# Setup docker-entrypoint
|
||||||
COPY build/common/worker/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
COPY build/common/worker/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
||||||
|
@ -212,6 +212,7 @@ To execute commands using bench helper.
|
|||||||
docker run \
|
docker run \
|
||||||
-v <project-name>_sites-vol:/home/frappe/frappe-bench/sites \
|
-v <project-name>_sites-vol:/home/frappe/frappe-bench/sites \
|
||||||
--network <project-name>_default \
|
--network <project-name>_default \
|
||||||
|
--user frappe \
|
||||||
frappe/frappe-worker:$VERSION bench --help
|
frappe/frappe-worker:$VERSION bench --help
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -221,7 +222,11 @@ Example command to clear cache
|
|||||||
docker run \
|
docker run \
|
||||||
-v <project-name>_sites-vol:/home/frappe/frappe-bench/sites \
|
-v <project-name>_sites-vol:/home/frappe/frappe-bench/sites \
|
||||||
--network <project-name>_default \
|
--network <project-name>_default \
|
||||||
|
--user frappe \
|
||||||
frappe/frappe-worker:$VERSION bench --site erp.mysite.com clear-cache
|
frappe/frappe-worker:$VERSION bench --site erp.mysite.com clear-cache
|
||||||
```
|
```
|
||||||
|
|
||||||
Use it to install/uninstall custom apps, add system manager user, etc.
|
Notes:
|
||||||
|
|
||||||
|
- Use it to install/uninstall custom apps, add system manager user, etc.
|
||||||
|
- To run the command as non root user add the command option `--user frappe`.
|
||||||
|
@ -413,4 +413,5 @@ echo -e "\e[1m\e[4mCheck bench --help\e[0m"
|
|||||||
docker run \
|
docker run \
|
||||||
-v frappebench00_sites-vol:/home/frappe/frappe-bench/sites \
|
-v frappebench00_sites-vol:/home/frappe/frappe-bench/sites \
|
||||||
--network frappebench00_default \
|
--network frappebench00_default \
|
||||||
|
--user frappe \
|
||||||
frappe/erpnext-worker:edge bench --help
|
frappe/erpnext-worker:edge bench --help
|
||||||
|
@ -23,7 +23,6 @@ services:
|
|||||||
|
|
||||||
erpnext-nginx:
|
erpnext-nginx:
|
||||||
image: frappe/erpnext-nginx:edge
|
image: frappe/erpnext-nginx:edge
|
||||||
restart: on-failure
|
|
||||||
environment:
|
environment:
|
||||||
- FRAPPE_PY=erpnext-python
|
- FRAPPE_PY=erpnext-python
|
||||||
- FRAPPE_PY_PORT=8000
|
- FRAPPE_PY_PORT=8000
|
||||||
|
Loading…
Reference in New Issue
Block a user