Search code examples
postgresqldockerodoo

Odoo app list in docker is not updated via odoo.conf file or when exec into the container


I have a docker-compose file with two services: odoo:latest and postgres:13. I try to update app list in debug mode http://localhost:8070/web?debug=1
but nothing happens. odoo service has volumes section:

    `volumes:
     - ./extra-addons:/mnt/extra-addons
     - data:/var/lib/odoo
     - ./config:/etc/odoo`

that corresponds to a this directory:

.
├── config
│   └── odoo.conf
├── docker-compose.yml
└── extra-addons
    ├── __init__.py
    └── __manifest__.py

Content of of oodo.conf file:

[options]
addons_path = /mnt/extra-addons
data_dir = /var/lib/odoo

Content of manifest.py


{
'name': 'estate',
'depends': [
  'base_setup',    
 ],
 "installable": True,
 "application": True,
 "auto_install": False,
}

I also tried to update app list in the terminal. When I exec in odoo service and issue this command:

/usr/bin/odoo -p 8071 --db_host=172.17.0.2 --db_user=odoo --db_password=odoo -d odoo -u estate

I get:

odoo: Odoo version 16.0-20221025 
odoo: Using configuration file at /etc/odoo/odoo.conf 
odoo: addons paths: ['/usr/lib/python3/dist-packages/odoo/addons', '/var/lib/odoo/addons/16.0', '/mnt/extra-addons'] 
odoo: database: [email protected]:default 
odoo.sql_db: Connection to the database failed 
Traceback (most recent call last):
  File "/usr/bin/odoo", line 8, in 
    odoo.cli.main()
  ...
  File "/usr/lib/python3/dist-packages/odoo/sql_db.py", line 638, in borrow
    result = psycopg2.connect(
  File "/usr/lib/python3/dist-packages/psycopg2/__init__.py", line 127, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: connection to server at "172.17.0.2", port 5432 failed: Connection timed out
    Is the server running on that host and accepting TCP/IP connections?

THANK YOU!


Solution

  • Every module needs it's own directory. As i see, you've put __init__.py and __manifest__.py inside extra_addons folder.

    extra_addons should contain module folders, so correct structure should be:

    .
    ├── config
    │   └── odoo.conf
    ├── docker-compose.yml
    └── extra-addons
        └── estate
          ├── __init__.py
          └── __manifest__.py
    

    where estate is your module code (which for best practice should be the same as "name" key in manifest dictionary)

    Furthermore, if you added ./extra-addons:/mnt/extra-addons volume after you ran your docker-compose, you should run it again.

    This will only re-create your odoo container since postgres container has not changed, meaning you won't lose any data.