ERPNext breaks when installing apps to docker production container

Hi all,
I’ve been following this guide, back when it still existed, to setup ERPNext in production containers:
single server example.
So far so good. Nowe I’m experiencing issues with external apps: Since HR is needed, I installed hrms in the container with bench get-app hrms and then bench --site oursite.com install-app hrms, it was working just fine. However, as soon as I do a docker compose down && docker compose up -d providing the erpnext docker compose yml, this setup seems somehow to break, and I’m constantly getting internal server errors, logging that the module hrms could not be found.
The isecase is: I need to setup a second instance on another server and domain, with the data from the first instance (added to it via bench backup and restore).
What I already tried:

  • get-app afterwards, then install with --force
  • move the docker volume directly to the new server
  • Doing a bench migrate
  • bench build --force && bench restart
    Nothing helped, I can’t get passed this error. However, a bench list-apps on the given site lists the app just fine, even after restart.
    What am I missing here? How to safely backup/restore the data to the other instance and prevent problems?
    Thanks in advance for any advice.

Hello @fcnjd

When you do a docker compose down and then docker compose up you are going back the used image initial state. Which does not have the App (=before the bench get-app hrms).

So, what you have now:

DB - has the hrms data (db container and db image are not changing and have persistent storage for the data).

Frappe setup that has Frappe and ERPNext but not hrms.

The solution I recommend:

  • Build your image with hrms baked into the image. Or use knimer/erpnext docker image which include hrms and many other Apps.
  • Just do a normal docker compose up -d
  • Do a docker exec -it <backend-container>
  • Put the setup in Maintenance mode: bench –site <site_name> set-maintenance-mode off
  • Then do a bench –site <site_name> install-app hrms
  • Then bench –site <site_name> migrate
  • And both:
    bench –site <site_name> clear-cache
    bench –site <site_name> clear-website-cache

–> Make sure the “install-app” command works and finishes successfully.

Do not run: bench build in a docker setup.

Tell us how it goes.
Share commands output and as much details of errors and setup if it does not work… hopefully it will.

@fcnjd For multi-site multi-app installs use: - Creating new custom app in the dockerized instance is not possible · Issue #1640 · frappe/frappe_docker · GitHub

If you are going to touch core code (especially css in bench build) use: -

Hope it helps