Install geoip2 python library for Odoo 15 on Kubernetes

241 Views Asked by At

Hi I have installed Odoo 15 on Kubernetes (using Bitnami chart) and I would like to use the geoip database functionality. To do so, I need to install the geoip2 python library in my Odoo containers before the Odoo server starts.

Installing the geoip2 library is as simple as running pip install geoip2 (or pip3). The problem is that this needs to be done before the Odoo server starts and without ssh-ing into the container (we would like deployments to be entirely automated - no manual interaction).

I've tried InitContainers but they're not a solution because they run in their own container and any library installed in the InitContainer will not be installed in the Odoo container (I am guessing that sidecars would be the same).

Using Lifecyle -> poststart in the deployment yaml does not work either and I suspect that this is because the poststart is executed after the Odoo server is started.

I've tried to use the command: element of the deployment yaml file to first run the install of geoip2 and then the entrypoint of the Odoo image but for some reason this does not seem to work. Maybe this could be a solution if someone can get this to work?

Would anyone have a simple solution, ideally that does not require creating our own image for installing Odoo.

Thanks

1

There are 1 best solutions below

1
Kranthiveer Dontineni On

Like what David Maze suggested, the simplest and easiest way to get this done is creating a new container image or editing your current container image because all solutions like kubectl or kube jobs or CICD will execute commands inside the container only once the container is brought up. One more option is that you can install geoip2 package and then restart the dependent odoo service but you are saying that this is not working. So, you can edit the existing container image and install geoip2, input your config and commit the image to the registry for creating your deployment.