Draft: [REF] docker-postgresql: simplify the images and allow for their use in normal deployments
Related MRs:
- https://git.vauxoo.com/devops/dockerv/-/merge_requests/70
- https://git.vauxoo.com/deployv/godeployv/-/merge_requests/109
- https://git.vauxoo.com/deployv/deployv/-/merge_requests/753
This MR changes how the custom postgresql images are built so they can also be used in the normal deployments (deployments in servers without zfs), this also simplifies the amount of Dockerfiles used for the images using multistage builds. Now we can build all the images with a single Dockerfile.
Main changes:
-
The
-dev
images used by the zfs deployments use a custom entrypoint that assumes that the data is already in the volume and only starts the cluster, this works in zfs because the volume is created with a copy of the production cluster but causes errors in the normal deployments where the cluster needs to be initialized before restoring the backup. Now by default these images will be built with the default entrypoint pointing to the custom configuration file and a new tag for the zfs images with the custom entrypoint will be created. This MR proposes to create the-dev
and the-zfsdev
tags for this. -
The
-ci
images are using the same Dockerfile as the-dev
images except for a few changes:- The pgbadger files are added only in the
-dev
images. - The
clang19-dev
package is only installed in the-dev
images. - The entrypoint is modified in the
-dev
images (will now only be modified in the-zfsdev
images).
To simplify this, instead of having two different Dockerfiles for each version with these changes, a single standard Dockerfile will be used. This new Dockerfile adds several steps that were missing from the v13 images, and the IRC images.
- The pgbadger files are added only in the
-
The ABSA images were almost identical to the v14 default images, with the only modifications being
max_parallel_workers_per_gather = 0
, which should be set to0
in the postgres containers to avoid shared memory issues, andpassword_encryption = md5
, which should also be set by default in our image as well since the versions of Odoo we use with PostgreSQL 14 does not supportscram-sha-256
. This MR proposes to add these changes to the default image for the version 14 and remove the custom image for ABSA. -
A new directory named
postgresql
was created with the new standarized Dockerfile and all the configuration files for the different psql versions, and the customer images, were also added here. The default configuration files are inpostgresql/common
while the specific configurations for each customer are in a directory with the name of the customer. In order to build the images using this new Dockerfile we need to execute the build with a--target
and thePSQL_VERSION
argument, for example:
docker build . -t basepsql --target dev --build-arg PSQL_VERSION=14
docker build . -t testpsql --target ci --build-arg PSQL_VERSION=16
- To avoid overwriting the current images, and to facilitate the rollback to those images if needed, the build script was modified to support the
--updated-build
parameter. This parameter will build the images using the--target
parameter based on thePSQL_TYPE
env var set in the job, and create different names for the images that are pushed so they don't overwrite the current ones. The .gitlab-ci.yml file was modified with jobs namedbuild_<psql_version>_<psql_type>_new
using this new parameter and the new Dockerfile to push these images.
Tests:
-
Deploy a normal instance with a custom postgres image and make sure that the pgvector extension can be installed and that the customizations are applied. -
Deploy a ZFS instance with a cusotm postgres image and make sure that the pgvector extension can be installed and that the customizations are applied.