Easy Odoo installation in a Kubernetes Cluster with the Glasskube Kubernetes Operator.
Odoo is an open-source ERP ("Enterprise Resource Planning") system that provides numerous functions through the use of apps. For example, there are extensions for Customer Relationship Management (CRM), billing systems, employee management, time tracking systems, and many other apps.
Odoo was written in the Python programming language and is based on the following components:
github.com/odoo/odoo
Odoo regularly releases new Docker images (github.com/odoo/docker
) and publishes
them on Docker Hub. These images make it easy to install and try out Odoo quickly. However, for production use, some
adjustments and configuration settings are required:
In addition to the database, Odoo also stores data in the directory /var/lib/odoo/filestore
of the local file system.
This mainly includes files uploaded by users. The persistence of files in the /var/lib/odoo
directory can be achieved
through the use of volumes
.
Attention In the official Docker images, the major version tag (e.g., 16.0) is overwritten with each release of a minor version. Therefore, a change to the image can only be identified by the SHA256 hash.
This leads to several problems:
In order to solve these problems, Glasskube extends the official Odoo Docker image and publishes this new image using immutable tags.
The Dockerfile of Glasskube Odoo images can be found here:
github.com/glasskube/images/odoo
The Docker images are published on Docker Hub:
hub.docker.com/r/glasskube/odoo
Odoo generates asset bundles and images based on the Odoo version included in the Docker image, stores them in
the /var/lib/odoo
folder, and references these assets in the ir_attachment
database table. These asset bundles (
mainly JavaScript bundles) differ depending on the Odoo version for which they were built. If the Odoo version changes
but the persisted asset bundles are not regenerated, an incompatibility arises between the delivered bundles and the
Odoo version.
This leads to the user often seeing only a blank page after an Odoo upgrade. The following error message can be observed in the browser's JavaScript console:
UncaughtPromiseError > TypeError Uncaught Promise > parent is undefined TypeError: parent is undefined removeLine@odo....
In a blog entry by Holden Rehg different variants are described to regenerate the assets.
In the Glasskube Docker image the assets are regenerated directly by deleting the database entries on the first reload
if the Odoo version has changed. Among other things, the Shell
script run.sh
executes the following SQL command:
DELETE
FROM ir_attachment
WHERE res_model = 'ir.ui.view'
AND name LIKE '%assets_%';
To prevent this, the assets are intelligently regenerated in the Glasskube Odoo Docker image.
The question now arises as to how the Glasskube Odoo Docker images can be easily deployed in a Kubernetes cluster. The Glasskube Kubernetes Operator takes care of this task. It not only individualizes the initial installation to the customer's cloud infrastructure, but also solves the above-mentioned problems of the cached incompatible Docker images and takes over the operation of the database, its backups, and the update management. Odoo updates are initiated automatically in the course of an operator update.
Make sure you are connected to a Kubernetes cluster and have helm
installed.
The easiest way to install Glasskube is via its helm chart:
helm repo add glasskube https://charts.glasskube.eu/
helm repo update
helm install my-glasskube-operator glasskube/glasskube-operator
The full documentation can be found in our Getting started documentation.
Once the operator installation is complete, Odoo can be installed. For this purpose, only the following custom resource must be created in the cluster:
Odoo.yaml
apiVersion: "glasskube.eu/v1alpha1"
kind: Odoo
metadata:
name: odoo
namespace: odoo
spec:
host: odoo.hostname.tld # hostname
demoEnabled: true # Whether Odoo should be initially populated with demo data.
kubectl apply -f Odoo.yaml
This completes the installation. Updates to the Kubernetes operator will automatically update Odoo.
Important A DNS entry must be set on the 'LoadBalancer' or the ingress host. SSL certificates are automatically generated by the
LoadBalancer
orcert-manager
if aClusterIssuer
is configured.
In the Kubernetes custom resource definition, it can be specified whether Odoo should be initially populated with demo
data.
For demonstrations and a first trial it is useful to set this parameter to true
, but for production use this is not
recommended.
for productive use, however, this is not recommended.
Caution After the initial installation a change of this parameter has no influence anymore. Existing Odoo demo data will not be deleted.
The Glasskube Kubernetes operator for Odoo automatically backs up the PostgreSQL database in a MinIO bucket
in the glasskube-system
namespace.
Odoo has developed a Runbot that automates Odoo instances for Git Branches. for Git Branches. This tool is especially useful when using Enterprise or Custom add-ons, as it can be used to merge the entire Odoo source code is merged with the add-ons. An OCA (Odoo Community Association) member has created a Runbot like version for the automated provisioning of Odoo instances in a Kubernetes cluster. created: Runboat
The official Odoo Docker image is not directly suitable for production use, as this does not have immutable tags and the persistence of the asset bundles leads to version update problems. With the help of the Glasskube Odoo Docker images and the Glasskube Kubernetes operator, Odoo can be installed in a Kubernetes cluster in just a few steps.
Easily and scale your IT infrastructure while deploying applications quickly and securely with our cloud native technology solutions.