I use the Helm Chart from Bitnami https://bitnami.com/stack/odoo/helm for the Odoo installation. The chart works without problems. But what I do not manage is that I can download addons using git and an init container. I have tried the following.
My init Container
initContainers:
- name: git-hr-attendance
image: bitnami/odoo
command: ["/bin/sh","-c"
args: ['apt-get -y update && apt-get -y install git && git clone https://github.com/OCA/hr-attendance /bitnami/odoo']
volumeMounts:
- name: odoo-data
mountPath: /bitnami/odoo
#subPath: addons
Output Logs
fatal: destination path '/bitnami/odoo' already exists and is not an empty directory.
What I also tried is to load the git repo into the /tmp folder but this has another effect the data is not copied from the /tmp
folder to the /bitnami/odoo/addons
folder.
But the folder /bitnami/odoo
will be displayed in /tmp.
After that I adjusted the init container.
init container
initContainers:
- name: git-hr-attendance
image: bitnami/odoo
command: ["/bin/sh","-c"
args: ['apt-get -y update && apt-get -y install git && git clone https://github.com/OCA/hr-attendance /bitnami/odoo/addons']
volumeMounts:
- name: odoo-data
mountPath: /bitnami/odoo
subPath: addons
Output Logs
Cloning into '/bitnami/odoo/addons'...
The data is now copied but after that the config file is no longer available.
odoo 11:45:27.24
odoo 11:45:27.24 Welcome to the Bitnami odoo container
odoo 11:45:27.24 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-odoo
odoo 11:45:27.24 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-odoo/issues
odoo 11:45:27.24
odoo 11:45:27.26 INFO ==> Validating settings in POSTGRESQL_CLIENT_* env vars
odoo 11:45:27.32 INFO ==> Restoring persisted Odoo installation
odoo 11:45:27.36 INFO ==> Trying to connect to the database server
grep: /opt/bitnami/odoo/conf/odoo.conf: No such file or directory
Does anyone have an idea or experience with Odoo what to do about this. So that I can download my addons via git per init container.
The problem you are seeing is related to the way the Odoo image verifies if it should initialize the app or instead restore an old installation at the setup stage. If it finds that the /bitnami/odoo/
directory is not empty it will do the latter (link), and so the
grep: /opt/bitnami/odoo/conf/odoo.conf: No such file or directory
is displayed because it tries to find files that should have being created from a previous installation (there are symlinks between some folders in /opt/bitnami/odoo
and /bitnami/odoo
).
You can modify the image at this point to add your custom logic.