Skip to Content
Menu
This question has been flagged

I have a deployment of odoo community 16 on kubernetes (microk8s specifically) with postgres db . Both pods are in the same namespace and can communicate, but the odoo pod logs are showing an issue. I dont think this is a kubernetes issue I'm just setting the scene.


I'm assuming I've set this up incorrectly. The logs show this:

Running as user 'root' is a security risk.
2023-07-10 01:02:48,790 1 INFO ? odoo: Odoo version 16.0
2023-07-10 01:02:48,790 1 INFO ? odoo: addons paths: ['/usr/src/app/odoo/addons', '/root/.local/share/Odoo/addons/16.0', '/usr/src/app/addons']
2023-07-10 01:02:48,790 1 INFO ? odoo: database: odoo@postgres-service:5432
2023-07-10 01:02:48,993 1 INFO ? odoo.addons.base.models.ir_actions_report: You need Wkhtmltopdf to print a pdf version of the reports.
2023-07-10 01:02:49,349 1 INFO ? odoo.service.server: HTTP service (werkzeug) running on odoo-58c548cdff-jwvbd:8069
2023-07-10 01:02:53,168 1 ERROR ? odoo.modules.loading: Database odoo not initialized, you can force it with `-i base`
2023-07-10 01:02:53,168 1 INFO ? odoo.modules.registry: Registry loaded in 0.015s
2023-07-10 01:02:53,169 1 ERROR odoo odoo.http: Exception during request handling.
Traceback (most recent call last):
File "/usr/src/app/odoo/http.py", line 1584, in _serve_db
return service_model.retrying(self._serve_ir_http, self.env)
File "/usr/src/app/odoo/service/model.py", line 133, in retrying
result = func()
File "/usr/src/app/odoo/http.py", line 1596, in _serve_ir_http
ir_http = self.registry['ir.http']
File "/usr/src/app/odoo/modules/registry.py", line 190, in __getitem__
return self.models[model_name]
KeyError: 'ir.http'

It repeats this error for a while and then starts to show this one:

File "/usr/src/app/odoo/http.py", line 1588, in _serve_db
exc.error_response = self.registry['ir.http']._handle_error(exc)
File "/usr/src/app/odoo/modules/registry.py", line 190, in __getitem__
return self.models[model_name]
KeyError: 'ir.http'
2023-07-10 01:03:08,721 1 INFO odoo werkzeug: 192.168.1.19 - - [10/Jul/2023 01:03:08] "GET /favicon.ico HTTP/1.1" 500 - 2 0.002 0.011
2023-07-10 01:03:49,419 1 ERROR odoo odoo.sql_db: bad query:
SELECT latest_version
FROM ir_module_module
WHERE name='base'

ERROR: relation "ir_module_module" does not exist
LINE 3: FROM ir_module_module
^


My Dockerfile for building Odoo Community 16 from source is this:

# Use a base image with Python and other dependenciesFROMpython:3.9-slim
# Set the working directory in the container

WORKDIR /usr/src/app
# Install build dependencies

RUN apt-getupdate && apt-getinstall-y \

apt-utils\

gcc\

libldap2-dev\

libsasl2-dev\

libssl-dev
# Copy the Odoo requirements code into the container

COPY ./odoo/requirements.txt requirements.txt
# Update pip for good measure

RUN pip install --upgradepip
# Avoid pip blowing up by fixing problematic library

RUN pip install psycopg2-binary
# Install Odoo dependencies

RUN pip install -r requirements.txt
# Copy the Odoo source code into the container

COPY ./odoo.
# Enable odoo-bin to be run

RUN chmod u+x /usr/src/app/odoo-bin
# Expose the default Odoo port

EXPOSE8069
# Set the entrypoint command to start Odoo

# This will specify the default addons path and initialise the database and not load any demo data

CMD["/usr/src/app/odoo-bin","--addons-path=/usr/src/app/addons","-iall--without-demo=all"]


When I deploy with microk8s I give both odoo and postgres services the same env variables for db log on and db name etc. (From my deployment.yaml file) I've exec'd into the odoo pod, installed psql and verified that I can connect to the db using the same details that odoo reported when the pod started also:
database: odoo@postgres-service:5432  

env:- name:PGUSERvalue: odoo

name:PGPASSWORDvalue:odoo

name:PGDATABASEvalue:odoo

name:PGPORTvalue:5432

name:PGHOSTvalue:postgres-service

I can't understand the issue here, I had it running on baremetal a few months ago. Any help would be great, I'm hoping it's a silly mistake in my configuration.


Also when I exec into the odoo pod can connect to the PostgreSQL db it seems to connect correctly: 

root@odoo-58c548cdff-hsnlq:/usr/src/app# psql

psql (15.3 (Debian 15.3-0+deb12u1), server 14.8 (Debian 14.8-1.pgdg120+1)) Type "help" for help. 

doo=# \conninfo 

You are connected to database "odoo" as user "odoo" on host "postgres-service" (address "10.152.183.201") at port "5432".

Avatar
Discard
Best Answer

Hi,
Could you try upgrading base module in your database or try creating a new database from command line and see if this resolves the issue.

Odoo Command-line interface:  https://www.odoo.com/documentation/16.0/developer/reference/cli.html

Thanks & Regards

Walnut Software Solutions

Avatar
Discard
Related Posts Replies Views Activity
1
Nov 22
4140
0
Apr 21
38
2
Feb 25
2729
0
Jan 25
512
2
Nov 24
21888