odoo / docker

Other
932 stars 1.52k forks source link

Database odoo not initialized #370

Open kamarya opened 3 years ago

kamarya commented 3 years ago

I receive Database odoo not initialized errot once I access Odoo 14.0 web entry right after fresh containers are up. On the browser it shows up as "Server Internal Error" Many people (and the error message) have suggested to run the following /usr/bin/python3 /usr/bin/odoo --db_host 0.0.0.0 --db_port 5432 --db_user odoo --db_password odoo -i Base -p 2233 --stop-after-init -i Base

I did so (I run the above command in the container shell session) but the error persists. I have tried this with different versions of PostgreSQL docker images like 10 and 13 and the result does not change.

2021-05-20T06:27:23.778317388-04:00 2021-05-20 10:27:23,778 1 INFO ? odoo: Odoo version 14.0-20210330 
2021-05-20T06:27:23.778378882-04:00 2021-05-20 10:27:23,778 1 INFO ? odoo: Using configuration file at /etc/odoo/odoo.conf 
2021-05-20T06:27:23.778454814-04:00 2021-05-20 10:27:23,778 1 INFO ? odoo: addons paths: ['/usr/lib/python3/dist-packages/odoo/addons', '/var/lib/odoo/addons/14.0', '/mnt/extra-addons'] 
2021-05-20T06:27:23.778498264-04:00 2021-05-20 10:27:23,778 1 INFO ? odoo: database: odoo@0.0.0.0:5432 
2021-05-20T06:27:23.910280854-04:00 2021-05-20 10:27:23,910 1 INFO ? odoo.addons.base.models.ir_actions_report: Will use the Wkhtmltopdf binary at /usr/local/bin/wkhtmltopdf 
2021-05-20T06:27:24.019151768-04:00 2021-05-20 10:27:24,019 1 INFO ? odoo.service.server: HTTP service (werkzeug) running on odoo-pod:8069 
2021-05-20T06:28:24.668205832-04:00 2021-05-20 10:28:24,668 1 INFO ? odoo.http: HTTP Configuring static files 
2021-05-20T06:28:24.683588756-04:00 2021-05-20 10:28:24,683 1 ERROR odoo odoo.modules.loading: Database odoo not initialized, you can force it with `-i base` 
2021-05-20T06:28:24.684797171-04:00 2021-05-20 10:28:24,684 1 INFO odoo werkzeug: 10.0.2.100 - - [20/May/2021 10:28:24] "GET / HTTP/1.1" 500 - 10 0.007 0.009
2021-05-20T06:28:24.688217634-04:00 2021-05-20 10:28:24,688 1 ERROR odoo werkzeug: Error on request:
2021-05-20T06:28:24.688217634-04:00 Traceback (most recent call last):
2021-05-20T06:28:24.688217634-04:00   File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 270, in run_wsgi
2021-05-20T06:28:24.688217634-04:00     execute(self.server.app)
2021-05-20T06:28:24.688217634-04:00   File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 258, in execute
2021-05-20T06:28:24.688217634-04:00     application_iter = app(environ, start_response)
2021-05-20T06:28:24.688217634-04:00   File "/usr/lib/python3/dist-packages/odoo/service/server.py", line 440, in app
2021-05-20T06:28:24.688217634-04:00     return self.app(e, s)
2021-05-20T06:28:24.688217634-04:00   File "/usr/lib/python3/dist-packages/odoo/service/wsgi_server.py", line 124, in application
2021-05-20T06:28:24.688217634-04:00     return application_unproxied(environ, start_response)
2021-05-20T06:28:24.688217634-04:00   File "/usr/lib/python3/dist-packages/odoo/service/wsgi_server.py", line 99, in application_unproxied
2021-05-20T06:28:24.688217634-04:00     result = odoo.http.root(environ, start_response)
2021-05-20T06:28:24.688217634-04:00   File "/usr/lib/python3/dist-packages/odoo/http.py", line 1295, in __call__
2021-05-20T06:28:24.688217634-04:00     return self.dispatch(environ, start_response)
2021-05-20T06:28:24.688217634-04:00   File "/usr/lib/python3/dist-packages/odoo/http.py", line 1263, in __call__
2021-05-20T06:28:24.688217634-04:00     return self.app(environ, start_wrapped)
2021-05-20T06:28:24.688217634-04:00   File "/usr/lib/python3/dist-packages/werkzeug/wsgi.py", line 766, in __call__
2021-05-20T06:28:24.688217634-04:00     return self.app(environ, start_response)
2021-05-20T06:28:24.688217634-04:00   File "/usr/lib/python3/dist-packages/odoo/http.py", line 1452, in dispatch
2021-05-20T06:28:24.688217634-04:00     ir_http = request.registry['ir.http']
2021-05-20T06:28:24.688217634-04:00   File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 177, in __getitem__
2021-05-20T06:28:24.688217634-04:00     return self.models[model_name]
2021-05-20T06:28:24.688217634-04:00 KeyError: 'ir.http' - - -
2021-05-20T06:28:24.801199132-04:00 2021-05-20 10:28:24,801 1 INFO odoo werkzeug: 10.0.2.100 - - [20/May/2021 10:28:24] "GET /favicon.ico HTTP/1.1" 500 - 2 0.001 0.005
2021-05-20T06:28:24.803776276-04:00 2021-05-20 10:28:24,803 1 ERROR odoo werkzeug: Error on request:
2021-05-20T06:28:24.803776276-04:00 Traceback (most recent call last):
2021-05-20T06:28:24.803776276-04:00   File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 270, in run_wsgi
2021-05-20T06:28:24.803776276-04:00     execute(self.server.app)
2021-05-20T06:28:24.803776276-04:00   File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 258, in execute
2021-05-20T06:28:24.803776276-04:00     application_iter = app(environ, start_response)
2021-05-20T06:28:24.803776276-04:00   File "/usr/lib/python3/dist-packages/odoo/service/server.py", line 440, in app
2021-05-20T06:28:24.803776276-04:00     return self.app(e, s)
2021-05-20T06:28:24.803776276-04:00   File "/usr/lib/python3/dist-packages/odoo/service/wsgi_server.py", line 124, in application
2021-05-20T06:28:24.803776276-04:00     return application_unproxied(environ, start_response)
2021-05-20T06:28:24.803776276-04:00   File "/usr/lib/python3/dist-packages/odoo/service/wsgi_server.py", line 99, in application_unproxied
2021-05-20T06:28:24.803776276-04:00     result = odoo.http.root(environ, start_response)
2021-05-20T06:28:24.803776276-04:00   File "/usr/lib/python3/dist-packages/odoo/http.py", line 1295, in __call__
2021-05-20T06:28:24.803776276-04:00     return self.dispatch(environ, start_response)
2021-05-20T06:28:24.803776276-04:00   File "/usr/lib/python3/dist-packages/odoo/http.py", line 1263, in __call__
2021-05-20T06:28:24.803776276-04:00     return self.app(environ, start_wrapped)
2021-05-20T06:28:24.803776276-04:00   File "/usr/lib/python3/dist-packages/werkzeug/wsgi.py", line 766, in __call__
2021-05-20T06:28:24.803776276-04:00     return self.app(environ, start_response)
2021-05-20T06:28:24.803776276-04:00   File "/usr/lib/python3/dist-packages/odoo/http.py", line 1452, in dispatch
2021-05-20T06:28:24.803776276-04:00     ir_http = request.registry['ir.http']
2021-05-20T06:28:24.803776276-04:00   File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 177, in __getitem__
2021-05-20T06:28:24.803776276-04:00     return self.models[model_name]
2021-05-20T06:28:24.803776276-04:00 KeyError: 'ir.http' - - -
2021-05-20T06:28:25.078632955-04:00 2021-05-20 10:28:25,078 1 ERROR odoo odoo.sql_db: bad query: SELECT latest_version FROM ir_module_module WHERE name='base'
2021-05-20T06:28:25.078632955-04:00 ERROR: relation "ir_module_module" does not exist
2021-05-20T06:28:25.078632955-04:00 LINE 1: SELECT latest_version FROM ir_module_module WHERE name='base...
2021-05-20T06:28:25.078632955-04:00                                    ^
2021-05-20T06:28:25.078632955-04:00  
2021-05-20T06:28:25.078863809-04:00 2021-05-20 10:28:25,078 1 WARNING ? odoo.addons.base.models.ir_cron: Tried to poll an undefined table on database odoo. 
2021-05-20T06:29:24.140507400-04:00 2021-05-20 10:29:24,140 1 ERROR odoo odoo.sql_db: bad query: SELECT latest_version FROM ir_module_module WHERE name='base'
2021-05-20T06:29:24.140507400-04:00 ERROR: relation "ir_module_module" does not exist
2021-05-20T06:29:24.140507400-04:00 LINE 1: SELECT latest_version FROM ir_module_module WHERE name='base...
2021-05-20T06:29:24.140507400-04:00                                    ^
2021-05-20T06:29:24.140507400-04:00
mrad-bilel commented 3 years ago

Any update for this issue

kamarya commented 3 years ago

Any update for this issue

I have not been able to resolve it by myself.

kamarya commented 3 years ago

@d-fence @ryv-odoo @xmo-odoo @Yenthe666 would you please check this out

d-fence commented 3 years ago

Hello. Could you please explain how to reproduce the issue ?

Here, it seems that you ask us to debug a command that is supposed to fix your problem. The command that you pasted cannot work:

I hope this help

kamarya commented 3 years ago

Thank you for your reply. Repeating -i Base is a typo. I use podman and I run PostgreSQL and Odoo in a Pod and it seems without specifying db_host as 0.0.0.0 Odoo can not connect to the database.

After I run odoo -d odoo -p 5674 --stop-after-init -i base in the container (I specify -p in order to avoid opening the same port as the running instance) I get the following logs (resulting from initialization). I still get the above error. What is the right way to initialize Odoo and Odoo database? The Docker documentation seems to be insufficient.

root@odoo-pod:/# odoo -d odoo -p 5674 --stop-after-init -i base
Running as user 'root' is a security risk.
2021-06-01 12:03:06,846 10 INFO ? odoo: Odoo version 14.0-20210330 
2021-06-01 12:03:06,846 10 INFO ? odoo: Using configuration file at /etc/odoo/odoo.conf 
2021-06-01 12:03:06,846 10 INFO ? odoo: addons paths: ['/usr/lib/python3/dist-packages/odoo/addons', '/var/lib/odoo/addons/14.0', '/mnt/extra-addons'] 
2021-06-01 12:03:06,846 10 INFO ? odoo: database: odoo@0.0.0.0:5432 
2021-06-01 12:03:06,970 10 INFO ? odoo.addons.base.models.ir_actions_report: Will use the Wkhtmltopdf binary at /usr/local/bin/wkhtmltopdf 
2021-06-01 12:03:07,063 10 INFO ? odoo.modules.loading: init db 
2021-06-01 12:03:07,448 10 INFO odoo odoo.modules.loading: loading 1 modules... 
2021-06-01 12:03:07,449 10 INFO odoo odoo.modules.loading: Loading module base (1/1) 
2021-06-01 12:03:07,511 10 INFO odoo odoo.modules.registry: module base: creating or updating database tables 
2021-06-01 12:03:08,047 10 INFO odoo odoo.models: Storing computed values of ir.module.module.menus_by_module 
2021-06-01 12:03:08,048 10 INFO odoo odoo.models: Storing computed values of ir.module.module.reports_by_module 
2021-06-01 12:03:08,048 10 INFO odoo odoo.models: Storing computed values of ir.module.module.views_by_module 
2021-06-01 12:03:08,049 10 INFO odoo odoo.models: Storing computed values of res.partner.display_name 
2021-06-01 12:03:08,049 10 INFO odoo odoo.models: Storing computed values of res.partner.partner_share 
2021-06-01 12:03:08,049 10 INFO odoo odoo.models: Storing computed values of res.partner.commercial_partner_id 
2021-06-01 12:03:08,049 10 INFO odoo odoo.models: Storing computed values of res.partner.commercial_company_name 
2021-06-01 12:03:08,049 10 INFO odoo odoo.models: Storing computed values of res.currency.decimal_places 
2021-06-01 12:03:08,051 10 INFO odoo odoo.models: Storing computed values of res.company.logo_web 
2021-06-01 12:03:08,053 10 INFO odoo odoo.models: Storing computed values of res.users.share 
2021-06-01 12:03:08,466 10 INFO odoo odoo.modules.loading: loading base/data/res.lang.csv 
2021-06-01 12:03:08,505 10 INFO odoo odoo.modules.loading: loading base/data/res_lang_data.xml 
2021-06-01 12:03:08,521 10 INFO odoo odoo.modules.loading: loading base/data/res_partner_data.xml 
2021-06-01 12:03:08,572 10 INFO odoo odoo.modules.loading: loading base/data/res_company_data.xml 
2021-06-01 12:03:08,582 10 INFO odoo odoo.modules.loading: loading base/data/res_users_data.xml 
2021-06-01 12:03:08,661 10 INFO odoo odoo.modules.loading: loading base/data/report_paperformat_data.xml 
2021-06-01 12:03:08,668 10 INFO odoo odoo.modules.loading: loading base/data/res_currency_data.xml 
2021-06-01 12:03:08,856 10 INFO odoo odoo.modules.loading: loading base/data/res_country_data.xml 
2021-06-01 12:03:09,198 10 INFO odoo odoo.modules.loading: loading base/data/ir_demo_data.xml 
2021-06-01 12:03:09,284 10 INFO odoo odoo.modules.loading: loading base/security/base_groups.xml 
2021-06-01 12:03:09,511 10 INFO odoo odoo.modules.loading: loading base/security/base_security.xml 
2021-06-01 12:03:09,623 10 INFO odoo odoo.modules.loading: loading base/views/base_menus.xml 
2021-06-01 12:03:09,685 10 INFO odoo odoo.modules.loading: loading base/views/decimal_precision_views.xml 
2021-06-01 12:03:09,705 10 INFO odoo odoo.modules.loading: loading base/views/res_config_views.xml 
2021-06-01 12:03:09,724 10 INFO odoo odoo.modules.loading: loading base/data/res.country.state.csv 
2021-06-01 12:03:10,379 10 INFO odoo odoo.modules.loading: loading base/views/ir_actions_views.xml 
2021-06-01 12:03:10,529 10 INFO odoo odoo.modules.loading: loading base/views/ir_config_parameter_views.xml 
2021-06-01 12:03:10,558 10 INFO odoo odoo.modules.loading: loading base/views/ir_cron_views.xml 
2021-06-01 12:03:10,606 10 INFO odoo odoo.modules.loading: loading base/views/ir_filters_views.xml 
2021-06-01 12:03:10,637 10 INFO odoo odoo.modules.loading: loading base/views/ir_mail_server_views.xml 
2021-06-01 12:03:10,664 10 INFO odoo odoo.modules.loading: loading base/views/ir_model_views.xml 
2021-06-01 12:03:10,867 10 INFO odoo odoo.modules.loading: loading base/views/ir_attachment_views.xml 
2021-06-01 12:03:10,910 10 INFO odoo odoo.modules.loading: loading base/views/ir_rule_views.xml 
2021-06-01 12:03:10,946 10 INFO odoo odoo.modules.loading: loading base/views/ir_sequence_views.xml 
2021-06-01 12:03:10,981 10 INFO odoo odoo.modules.loading: loading base/views/ir_translation_views.xml 
2021-06-01 12:03:11,032 10 INFO odoo odoo.modules.loading: loading base/views/ir_ui_menu_views.xml 
2021-06-01 12:03:11,061 10 INFO odoo odoo.modules.loading: loading base/views/ir_ui_view_views.xml 
2021-06-01 12:03:11,139 10 INFO odoo odoo.modules.loading: loading base/views/ir_default_views.xml 
2021-06-01 12:03:11,170 10 INFO odoo odoo.modules.loading: loading base/data/ir_cron_data.xml 
2021-06-01 12:03:11,176 10 INFO odoo odoo.modules.loading: loading base/report/ir_model_report.xml 
2021-06-01 12:03:11,182 10 INFO odoo odoo.modules.loading: loading base/report/ir_model_templates.xml 
2021-06-01 12:03:11,194 10 INFO odoo odoo.modules.loading: loading base/views/ir_logging_views.xml 
2021-06-01 12:03:11,224 10 INFO odoo odoo.modules.loading: loading base/views/ir_qweb_widget_templates.xml 
2021-06-01 12:03:11,236 10 INFO odoo odoo.modules.loading: loading base/views/ir_module_views.xml 
2021-06-01 12:03:11,317 10 INFO odoo odoo.modules.loading: loading base/data/ir_module_category_data.xml 
2021-06-01 12:03:11,373 10 INFO odoo odoo.modules.loading: loading base/data/ir_module_module.xml 
2021-06-01 12:03:11,418 10 INFO odoo odoo.modules.loading: loading base/report/ir_module_reports.xml 
2021-06-01 12:03:11,422 10 INFO odoo odoo.modules.loading: loading base/report/ir_module_report_templates.xml 
2021-06-01 12:03:11,438 10 INFO odoo odoo.modules.loading: loading base/wizard/base_module_update_views.xml 
2021-06-01 12:03:11,457 10 INFO odoo odoo.modules.loading: loading base/wizard/base_language_install_views.xml 
2021-06-01 12:03:11,475 10 INFO odoo odoo.modules.loading: loading base/wizard/base_import_language_views.xml 
2021-06-01 12:03:11,490 10 INFO odoo odoo.modules.loading: loading base/wizard/base_module_upgrade_views.xml 
2021-06-01 12:03:11,513 10 INFO odoo odoo.modules.loading: loading base/wizard/base_module_uninstall_views.xml 
2021-06-01 12:03:11,524 10 INFO odoo odoo.modules.loading: loading base/wizard/base_export_language_views.xml 
2021-06-01 12:03:11,544 10 INFO odoo odoo.modules.loading: loading base/wizard/base_update_translations_views.xml 
2021-06-01 12:03:11,559 10 INFO odoo odoo.modules.loading: loading base/wizard/base_partner_merge_views.xml 
2021-06-01 12:03:11,579 10 INFO odoo odoo.modules.loading: loading base/data/ir_actions_data.xml 
2021-06-01 12:03:11,583 10 INFO odoo odoo.modules.loading: loading base/data/ir_demo_failure_data.xml 
2021-06-01 12:03:11,599 10 INFO odoo odoo.modules.loading: loading base/views/res_company_views.xml 
2021-06-01 12:03:11,631 10 INFO odoo odoo.modules.loading: loading base/views/res_lang_views.xml 
2021-06-01 12:03:11,664 10 INFO odoo odoo.modules.loading: loading base/views/res_partner_views.xml 
2021-06-01 12:03:11,826 10 INFO odoo odoo.modules.loading: loading base/views/res_bank_views.xml 
2021-06-01 12:03:11,883 10 INFO odoo odoo.modules.loading: loading base/views/res_country_views.xml 
2021-06-01 12:03:11,947 10 INFO odoo odoo.modules.loading: loading base/views/res_currency_views.xml 
2021-06-01 12:03:12,011 10 INFO odoo odoo.modules.loading: loading base/views/res_users_views.xml 
2021-06-01 12:03:12,189 10 INFO odoo odoo.modules.loading: loading base/views/ir_property_views.xml 
2021-06-01 12:03:12,220 10 INFO odoo odoo.modules.loading: loading base/views/res_config_settings_views.xml 
2021-06-01 12:03:12,232 10 INFO odoo odoo.modules.loading: loading base/views/report_paperformat_views.xml 
2021-06-01 12:03:12,259 10 INFO odoo odoo.modules.loading: loading base/views/onboarding_views.xml 
2021-06-01 12:03:12,301 10 INFO odoo odoo.modules.loading: loading base/security/ir.model.access.csv 
2021-06-01 12:03:12,498 10 INFO odoo odoo.modules.loading: Module base: loading demo 
2021-06-01 12:03:12,498 10 INFO odoo odoo.modules.loading: loading base/data/res_company_demo.xml 
2021-06-01 12:03:12,503 10 INFO odoo odoo.modules.loading: loading base/data/res_users_demo.xml 
2021-06-01 12:03:12,609 10 INFO odoo odoo.modules.loading: loading base/data/res_partner_bank_demo.xml 
2021-06-01 12:03:12,614 10 INFO odoo odoo.modules.loading: loading base/data/res_currency_rate_demo.xml 
2021-06-01 12:03:12,786 10 INFO odoo odoo.modules.loading: loading base/data/res_bank_demo.xml 
2021-06-01 12:03:12,789 10 INFO odoo odoo.modules.loading: loading base/data/res_partner_demo.xml 
2021-06-01 12:03:12,954 10 INFO odoo odoo.modules.loading: loading base/data/res_partner_image_demo.xml 
2021-06-01 12:03:13,248 10 INFO odoo odoo.modules.loading: Module base loaded in 5.80s, 10775 queries 
2021-06-01 12:03:13,248 10 INFO odoo odoo.modules.loading: 1 modules loaded in 5.80s, 10775 queries (+0 extra) 
2021-06-01 12:03:13,256 10 INFO odoo odoo.modules.loading: updating modules list 
2021-06-01 12:03:13,257 10 INFO odoo odoo.addons.base.models.ir_module: ALLOW access to module.update_list on [] to user __system__ #1 via n/a 
2021-06-01 12:03:13,568 10 INFO odoo odoo.modules.loading: loading 7 modules... 
2021-06-01 12:03:13,568 10 INFO odoo odoo.modules.loading: Loading module web (2/7) 
2021-06-01 12:03:13,644 10 INFO odoo odoo.modules.registry: module web: creating or updating database tables 
2021-06-01 12:03:13,977 10 INFO odoo odoo.modules.loading: loading web/security/ir.model.access.csv 
2021-06-01 12:03:13,989 10 INFO odoo odoo.modules.loading: loading web/views/webclient_templates.xml 
2021-06-01 12:03:14,209 10 INFO odoo odoo.modules.loading: loading web/views/report_templates.xml 
2021-06-01 12:03:14,363 10 INFO odoo odoo.modules.loading: loading web/views/base_document_layout_views.xml 
2021-06-01 12:03:14,380 10 INFO odoo odoo.modules.loading: loading web/data/report_layout.xml 
2021-06-01 12:03:14,416 10 INFO odoo odoo.modules.loading: Module web: loading demo 
2021-06-01 12:03:14,427 10 INFO odoo odoo.modules.loading: Module web loaded in 0.86s, 1302 queries 
2021-06-01 12:03:14,427 10 INFO odoo odoo.modules.loading: Loading module auth_totp (3/7) 
2021-06-01 12:03:14,452 10 INFO odoo odoo.modules.registry: module auth_totp: creating or updating database tables 
2021-06-01 12:03:14,491 10 INFO odoo odoo.modules.loading: loading auth_totp/security/security.xml 
2021-06-01 12:03:14,500 10 INFO odoo odoo.modules.loading: loading auth_totp/views/user_preferences.xml 
2021-06-01 12:03:14,564 10 INFO odoo odoo.modules.loading: loading auth_totp/views/templates.xml 
2021-06-01 12:03:14,579 10 INFO odoo odoo.modules.loading: Module auth_totp: loading demo 
2021-06-01 12:03:14,587 10 INFO odoo odoo.modules.loading: Module auth_totp loaded in 0.16s, 207 queries 
2021-06-01 12:03:14,587 10 INFO odoo odoo.modules.loading: Loading module base_import (4/7) 
2021-06-01 12:03:14,681 10 INFO odoo odoo.modules.registry: module base_import: creating or updating database tables 
2021-06-01 12:03:15,102 10 INFO odoo odoo.modules.loading: loading base_import/security/ir.model.access.csv 
2021-06-01 12:03:15,142 10 INFO odoo odoo.modules.loading: loading base_import/views/base_import_templates.xml 
2021-06-01 12:03:15,159 10 INFO odoo odoo.modules.loading: Module base_import: loading demo 
2021-06-01 12:03:15,168 10 INFO odoo odoo.modules.loading: Module base_import loaded in 0.58s, 835 queries 
2021-06-01 12:03:15,168 10 INFO odoo odoo.modules.loading: Loading module web_editor (5/7) 
2021-06-01 12:03:15,222 10 INFO odoo odoo.modules.registry: module web_editor: creating or updating database tables 
2021-06-01 12:03:15,293 10 INFO odoo odoo.modules.loading: loading web_editor/security/ir.model.access.csv 
2021-06-01 12:03:15,305 10 INFO odoo odoo.modules.loading: loading web_editor/views/editor.xml 
2021-06-01 12:03:15,402 10 INFO odoo odoo.modules.loading: loading web_editor/views/snippets.xml 
2021-06-01 12:03:15,442 10 INFO odoo odoo.modules.loading: Module web_editor: loading demo 
2021-06-01 12:03:15,451 10 INFO odoo odoo.modules.loading: Module web_editor loaded in 0.28s, 478 queries 
2021-06-01 12:03:15,451 10 INFO odoo odoo.modules.loading: Loading module web_kanban_gauge (6/7) 
2021-06-01 12:03:15,480 10 INFO odoo odoo.modules.loading: loading web_kanban_gauge/views/web_kanban_gauge_templates.xml 
2021-06-01 12:03:15,508 10 INFO odoo odoo.modules.loading: Module web_kanban_gauge: loading demo 
2021-06-01 12:03:15,516 10 INFO odoo odoo.modules.loading: Module web_kanban_gauge loaded in 0.07s, 63 queries 
2021-06-01 12:03:15,516 10 INFO odoo odoo.modules.loading: Loading module web_tour (7/7) 
2021-06-01 12:03:15,541 10 INFO odoo odoo.modules.registry: module web_tour: creating or updating database tables 
2021-06-01 12:03:15,570 10 INFO odoo odoo.modules.loading: loading web_tour/security/ir.model.access.csv 
2021-06-01 12:03:15,582 10 INFO odoo odoo.modules.loading: loading web_tour/security/ir.rule.csv 
2021-06-01 12:03:15,593 10 INFO odoo odoo.modules.loading: loading web_tour/views/tour_templates.xml 
2021-06-01 12:03:15,630 10 INFO odoo odoo.modules.loading: loading web_tour/views/tour_views.xml 
2021-06-01 12:03:15,652 10 INFO odoo odoo.modules.loading: Module web_tour: loading demo 
2021-06-01 12:03:15,652 10 INFO odoo odoo.modules.loading: loading web_tour/data/web_tour_demo.xml 
2021-06-01 12:03:15,670 10 INFO odoo odoo.modules.loading: Module web_tour loaded in 0.15s, 231 queries 
2021-06-01 12:03:15,670 10 INFO odoo odoo.modules.loading: 7 modules loaded in 2.10s, 3116 queries (+0 extra) 
2021-06-01 12:03:15,820 10 INFO odoo odoo.modules.loading: Modules loaded. 
2021-06-01 12:03:15,821 10 INFO odoo odoo.service.server: Initiating shutdown 
2021-06-01 12:03:15,821 10 INFO odoo odoo.service.server: Hit CTRL-C again or send a second signal to force the shutdown.
rcarrillo commented 3 years ago

@kamarya can you post the commands used to run the containers?

I came across the same error, it was caused by setting the environment variable POSTGRES_DB to a value different than postgres for the PostgreSQL container.

By doing that the PostgreSQL container created an empty (hence uninitialized) database, which in turn was the one the Odoo container tried to connect to.

To fix it you have to set POSTGRES_DB to postgres, or do not set it at all

kamarya commented 3 years ago

@rcarrillo I have the right value set for POSTGRES_DB as you have mentioned. The problem is that the image does not work out of the box (without having a previously set-up database). There is nothing useful regarding the initialization of a new installation with Docker or Podman.

I could partially resolve the issue by overriding the entry point with --entrypoint option. However I would leave this issue open so the contributors find a way to improve the documentation or modify the entry point in a proper way.

rcarrillo commented 3 years ago

@kamarya if you have the right POSTGRES_DB set, then that empty or non-Odoo database was created by some other way.

Keep in mind that PostgreSQL databases are stored persistently in volumes, so once created, Odoo will keep trying to connect to it even after restarting Docker.

As an alternate solution you could drop that database so Odoo won't try to connect to it. Using a --db-filter could be a solution too.

The containers as per the documentation work out-of-the box as there is no initial database created at all. When you access through the browser, it just shows the database management page with no database whatsoever.

As your Odoo container is trying to connect to a empty or non-Odoo database, this seems to be a problem specific to your deployment.

kamarya commented 3 years ago

@rcarrillo I am aware of that. I launch the containers like they have never been launched ever so there is no remaining PostgreSQL databases from the past.

When I access it from the browser it shows me an error message (see above).

Suggestion: the entry-point script or Odoo shall check if the database is there (specified in the config) and if it is not there it should be created and initialized with something, either demo data or empty. Or as you mentioned one should see the management page.

netfxtech commented 2 years ago

For existing database and config I use the following in docker-compose command: odoo -u all -d mydbname

For new dev env: command: odoo -i base -d demo

Keep in mind your DB name needs to match the dbname located inside of /var/lib/odoo/filestore/mydbname

-or- /var/lib/odoo/filestore/demo

based off my 2 examples above. The filestore matching was a source of quite a bit of pain for me when I renamed my databases to use dbfilter

joemash commented 2 years ago

Facing a similar issue while trying to deploy to GKE(Google Kubernetes Engine (GKE))

netfxtech commented 2 years ago

What is the error you’re receiving? In my opinion, this Dockerfile is really setup for a very plain, vanilla community install. It doesn’t say this anywhere but just a heads up, Odoo is expecting your database to be found at host “db”. It will not start if your Postgres container is at any other host unless you create your own odoo.conf or start Odoo with the command option I gave above

joemash commented 2 years ago

@netfxtech

The container is able to connect to the database and even when i navigate to mydomain.com

the database setup screen shows, once i fill the details and setup starts it does not complete successfully, on checking of the logs i get the following

   ERROR ? odoo.modules.loading: Database <my database> not initialized, you can force it with `-i base

note that the database is created successfully it fails at modules loading

netfxtech commented 2 years ago

Okay - I think I know what’s going on with yours. I’m not 100% since it’s been a while since I’ve seen this error but give this a try.

Do you have a copy of the odoo.conf that was generated when you created the database? If not, it’s needed.

I would just start fresh, download a copy of the odoo.conf and bind mount it to /etc/odoo/odoo.conf

command: odoo -i base -c /etc/odoo/odoo.conf Volumes:

I forget the UserID that Odoo runs as so just chmod -R 777 odoo.conf ./data

for the initial setup so Odoo can write your database info to the config. Once that is done and it’s starting and stopping like it’s supposed to then you can fix the permissions on the data folder and config file.

Im curious if that fixes your issue, if you only want demo data then you can run the command like this

command: odoo -i base -u all -d demo -c /etc/odoo/odoo.conf

I think most of the issues people have in this repo comes down to the config file and the entrypoint so I have this command line figured out. Let me know what happens. I can send you my compose file if you still have issues and you can make it work for you on GKE

joemash commented 2 years ago

Thanks for reaching out. Let me provide more context. I believe the fix will be somewhere in the docker file my current one is as below

FROM odoo:14.0

ARG HOST
ENV HOST=${HOST}
ARG USER
ENV USER=${USER}
ARG PASSWORD
ENV PASSWORD=${PASSWORD}

COPY /addons  /mnt/extra-addons

COPY ./odoo.conf /etc/odoo
  1. For this command COPY /addons /mnt/extra-addons I have a custom module in my addons directory that is why I am
    copying it as i rebuild the image.

    1. For this command COPY ./odoo.conf /etc/odoo I also want odoo to connect to a database i have created in advance rather than creating it from the installation wizard. When i check logs for this step odoo is able to connect to the specified database in the modified odoo.conf

The deployment is orchastereted via CICD and helm charts and part of the deployment extract is as below:

template:
    metadata:
      labels:
        app: {{ .Values.app.name }}
        group: {{ .Values.app.group }}
    spec:
      containers:
        - name: {{ .Values.app.name }}
          image: "{{ .Values.app.image}}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          ports:
            - containerPort: {{ .Values.app.container.env.port }}
          env:
            - name: USER
              value: {{ .Values.app.container.env.db_user | quote }}
            - name: HOST
              value: {{ .Values.app.container.env.db_host | quote }}
            - name: PASSWORD
              value: {{ .Values.app.container.env.db_password | quote }}

I have a few questions

I would also appreciate if you could send me your compose file

Thanks

netfxtech commented 2 years ago

@joemash I'm having a difficult time bridging the gap between

  1. For this command COPY ./odoo.conf /etc/odoo I also want odoo to connect to a database i have created in advance rather than creating it from the installation wizard. When i check logs for this step odoo is able to connect to the specified database in the modified odoo.conf

and

  • Since i don't wan't to use the installation wizard, which username/email and password will be used to login or should i add more environment variables to support that. for example bitnami/odoo image requires one to specify ODOO_EMAIL and ODOO_PASSWORD as environment variables to support the same.

Since you would know what the username and password is that you set when you initially ran the image.

I just took a look at the Bitnami image and they are basically running the installation wizard for you if it's a new database. It will use the env variable "ODOO_EMAIL" and "ODOO_PASSWORD" for the initial install. This docker image does not include the scripts bitnami uses so those ENV variables will do nothing here. If you're somehow ending up at a login screen with this image then try using admin/admin, or whatever you filled out in "ODOO_EMAIL" and "ODOO_PASSWORD". This image basically requires you to go through the initial setup screen if you do not have a database already initialized/installed.

If you want to create your initial install in Bitnami, you can use this docker image afterwards. You'll just need to make sure that you have your data directory (filestore,addons,sessions) mapped to /var/lib/odoo and the config to /etc/odoo/odoo.conf

Finally, if you do use a custom odoo.conf, and you're using a database that has already been initialized/installed then make sure you have your odoo.conf "db_name = x, db_user = x, db_password = x" filled out.

joemash commented 2 years ago

Thanks for the reply but In the docker file how and where do i place the command odoo -i base -c /etc/odoo/odoo.conf

netfxtech commented 2 years ago

Here you go... This will work. I just tested it and was able to create a database and install modules.

image

joemash commented 2 years ago

@netfxtech

Thanks! I have confirmed your solution works!

spec:
      containers:
        - name: {{ .Values.app.name }}
          image: "{{ .Values.app.image}}"
          args:
          - odoo
          - -i
          - base 
          imagePullPolicy: {{ .Values.image.pullPolicy }}
DevDorrejo commented 1 year ago

Please fix this issue, is simple adding an init odoo -i ${db_name} in the build.