[SOLVED] ERPNext Docker "App is not in apps.txt"

Hello,

I am trying to start in a docker a simple setup (version-12) with three custom apps.

I followed step by step the two following examples :

https://github.com/castlecraft/custom_frappe_docker/blob/main/docker-compose.yml

And in both cases I end up with a non starting instance (500 Internal Server Error).

In the logs of the site-creator, I get this weird message :

`Updating DocTypes for erpnext : [========================================]`

``

`Updating customizations for Address`

``

`Traceback (most recent call last):`

`File "/home/frappe/frappe-bench/commands/new.py", line 118, in <module>`

`main()`

`File "/home/frappe/frappe-bench/commands/new.py", line 70, in main`

`db_port=db_port,`

`File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py", line 90, in _new_site`

`_install_app(app, verbose=verbose, set_as_patched=not source_sql)`

`File "/home/frappe/frappe-bench/apps/frappe/frappe/installer.py", line 61, in install_app`

`raise Exception("App not in apps.txt")`

`Exception: App not in apps.txt`

I looked on the forums, even connected to the site-creator docker, apps are correctly set in the Apps.txt.

Moreover, I also see some issues in the erpnext-python docker :

erpnext-python_1          |   File "/home/frappe/frappe-bench/env/lib/python3.7/site-packages/pymysql/connections.py", line 684, in _read_packet
erpnext-python_1          |     packet.check_error()
erpnext-python_1          |   File "/home/frappe/frappe-bench/env/lib/python3.7/site-packages/pymysql/protocol.py", line 220, in check_error
erpnext-python_1          |     err.raise_mysql_exception(self._data)
erpnext-python_1          |   File "/home/frappe/frappe-bench/env/lib/python3.7/site-packages/pymysql/err.py", line 109, in raise_mysql_exception
erpnext-python_1          |     raise errorclass(errno, errval)
erpnext-python_1          | pymysql.err.OperationalError: (1045, "Access denied for user '_ca89ff92470ceefa'@'172.24.0.2' (using password: YES)") 

For that I saw some post where it is needed to grant access to the user to the whole database. Could it be related? If not, where to investigate why the site-creator docker is not going through the end.

Of course, in Development container, everything runs fine.

Thanks for you support.

Cheers,

Benoit

can you add it to the apps.txt manually? Or delete the apps.txt file and restart the python container, it’ll create the file again from the list of apps available in new image/container.

This may happen when, volume was created and frappe + erpnext was installed first and new image was added later.

Just tried.

Indeed the file is recreated. When I restart the docker, still the error 500. I fixed it by doing the commend grant all privileges on <db_name>.* to '<db_name>'@'%' identified by '<db_password>';

I can now connect to the website, no error 500. But my app were not installed.

What concerns me here is that the site creator didn’t go through the whole process. So I guess that everything is not installed correctly.

I could of course connect to the docker and reinstall the apps with the bench command. But I look for a solution that works from the docker compose command without any further interventions. This will run through a CD pipeline.

Tried the following, the same issue :

  • On docker python : bench reinstall : Apps not installed
  • On docker python : bench drop-site mysite.localhost then restarted the site-creator docker.

Still got the same issue after updating the customisation for address.

Will continue digging

did you set the environment variable INSTALL_APPS=erpnext,your_app_name for site-creator container?

to install it later,

bench --site site.name.com install-app your_app_name

Thanks for your answer.

I had a little trailing comma on the INSTALL_APPS environment variable that produced the installation of a blank name app, which is obviously not in the apps.txt

And as soon as the site-creator can do all it’s job, everything works fine. Event the privileges issues.

When trying to bench --site frontend install-app hrms I am getting this error. Can you please help? Thank you!

App erpnext already installed
An error occurred while installing hrms: App hrms not in apps.txt
Traceback with variables (most recent call last):
  File "apps/frappe/frappe/commands/site.py", line 484, in install_app
    _install_app(app, verbose=context.verbose, force=force)
      context = {'sites': ['frontend'], 'force': False, 'verbose': False, 'profile': False}
      apps = ('hrms',)
      force = False
      _install_app = <function install_app at 0x7fcb3f0d7b00>
      filelock = <function filelock at 0x7fcb3f0d5260>
      exit_code = 0
      site = 'frontend'
      app = 'hrms'
      err = Exception('App hrms not in apps.txt')
  File "apps/frappe/frappe/installer.py", line 294, in install_app
    raise Exception(f"App {name} not in apps.txt")
      name = 'hrms'
      verbose = False
      set_as_patched = True
      force = False
      sync_jobs = <function sync_jobs at 0x7fcb3e05ff60>
      sync_for = <function sync_for at 0x7fcb3e078ea0>
      sync_customizations = <function sync_customizations at 0x7fcb3f97f420>
      sync_fixtures = <function sync_fixtures at 0x7fcb3e0791c0>
      app_hooks = {'accounting_dimension_doctypes': ['Expense Claim', 'Expense Claim Detail', 'Expense Taxes and Charges', 'Payroll Entry', 'Leave Encashment'], 'add_to_apps_screen': [{'name': 'hrms', 'logo': '/assets/hrms/images/frappe-hr-logo.svg', 'title': 'Frappe HR', 'route': '/app/overview', 'has_permission': 'hrms.hr.utils.check_app_permission'}], 'advance_payment_payable_doctypes': ['Leave Encashment', 'Gratuity', 'Employee Advance'], 'after_app_install': ['hrms.setup.after_app_install'], 'after_install': ['hrms.install.after_install'], 'after_migrate': ['hrms.setup.update_select_perm_after_install'], 'app_description': ['Modern HR and Payroll Software'], 'app_email': ['contact@frappe.io'], 'app_home': ['/app/overview'], 'app_include_css': ['hrms.bundle.css'], 'app_include_js': ['hrms.bundle.js'], 'app_license': ['GNU General Public License (v3)'], 'app_logo_url': ['/assets/hrms/images/frappe-hr-logo.svg'], 'app_name': ['hrms'], 'app_publisher': ['Frappe Technologies Pvt. Ltd.'], 'app_title': ['...
      installed_apps = ['frappe', 'erpnext']
      app = 'frappe/erpnext'
      required_app = 'erpnext'
builtins.Exception: App hrms not in apps.txt

if you’re using custom image or image with hrms this should not happen.

if you added the app later, you can re-run the configuration service / task that re-generates apps.txt with new apps with command ls -1 apps > sites/apps.txt.