I am running erpnext in docker, using a compose file based on pdw.yml.
I want to install non_profit app (which also involves installing payments app first).
How do I modify the docker file to do that automatically?
I have tried altering create-site thus:
create-site:
image: frappe/erpnext:v14.15.1
deploy:
restart_policy:
condition: none
volumes:
- ./volumes/sites:/home/frappe/frappe-bench/sites
- ./volumes/logs:/home/frappe/frappe-bench/logs
entrypoint:
- bash
- -c
command:
- >
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"` ]] && \
[[ -n `grep -hs ^ sites/common_site_config.json | jq -r ".redis_queue // empty"` ]];
do
echo "Waiting for sites/common_site_config.json to be created";
sleep 5;
if (( `date +%s`-start > 120 )); then
echo "could not find sites/common_site_config.json with required keys";
exit 1
fi
done;
echo "sites/common_site_config.json found";
echo "Getting payments";
bench get-app payments;
echo "Getting non_profit";
bench get-app non_profit;
echo "Creating site $FRAPPE_SITE_NAME_HEADER and installing erpnext";
bench new-site $FRAPPE_SITE_NAME_HEADER --no-mariadb-socket --admin-password=admin --db-root-password=admin --install-app erpnext --set-default;
echo "Installing payments";
bench --site $FRAPPE_SITE_NAME_HEADER install-app payments;
echo "Installing non_profit";
bench --site $FRAPPE_SITE_NAME_HEADER install-app non_profit;
However, downing and then upping the compose now results in Internal Server Error
in the browser, and the following logs from backend:
[2023-02-14 13:50:27 +0000] [1] [INFO] Starting gunicorn 20.1.0
[2023-02-14 13:50:27 +0000] [1] [INFO] Listening at: http://0.0.0.0:8000 (1)
[2023-02-14 13:50:27 +0000] [1] [INFO] Using worker: gthread
[2023-02-14 13:50:27 +0000] [7] [INFO] Booting worker with pid: 7
[2023-02-14 13:50:27 +0000] [8] [INFO] Booting worker with pid: 8
/usr/local/lib/python3.10/functools.py:981: UserWarning: The 'filters_config' hook used to ad
d custom operators is not yet implemented in frappe.db.query engine. Use db_query (frappe.get_list) instead.
val = self.func(instance)
[2023-02-14 15:38:09 +0000] [7] [ERROR] Error handling request /
Traceback (most recent call last):
File "/home/frappe/frappe-bench/apps/frappe/frappe/website/serve.py", line 17, in get_respo
nse
endpoint, renderer_instance = path_resolver.resolve()
File "/home/frappe/frappe-bench/apps/frappe/frappe/website/path_resolver.py", line 58, in r
esolve
renderer_instance = renderer(endpoint, 200)
File "/home/frappe/frappe-bench/apps/frappe/frappe/website/page_renderers/static_page.py",
line 19, in __init__
self.set_file_path()
File "/home/frappe/frappe-bench/apps/frappe/frappe/website/page_renderers/static_page.py",
line 26, in set_file_path
file_path = frappe.get_app_path(app, "www") + "/" + self.path
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1356, in get_app_path
return get_pymodule_path(app_name, *joins)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1373, in get_pymodule
_path
return os.path.join(os.path.dirname(get_module(scrub(modulename)).__file__ or ""), *joins
)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1327, in get_module
return importlib.import_module(modulename)
File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'payments'
If I exec all those bench commands inside the backend container, and then restart it, it starts working.
Not sure if I have to do them again in all the other containers (scheduler, the queues, etc.)? Or how to make this work without manual intervention if/when I rebuild the containers.