Repository navigation
[IMP] runbot: support postgres inside docker - #1433
Merged
Merged
Conversation
Xavier-Do
force-pushed
the
19.0-docker-pg-xdo
branch
2 times, most recently
from
June 29, 2026 11:38
2040bf1 to
10dceb9
Compare
Xavier-Do
force-pushed
the
19.0-docker-pg-xdo
branch
2 times, most recently
from
September 18, 2026 10:42
c8a8d38 to
44156d9
Compare
Xavier-Do
force-pushed
the
19.0-docker-pg-xdo
branch
15 times, most recently
from
October 15, 2026 09:03
b52936f to
0ff1b3b
Compare
Xavier-Do
force-pushed
the
19.0-docker-pg-xdo
branch
10 times, most recently
from
October 16, 2026 12:55
5fb3eb1 to
e8381b7
Compare
bepro-odoo
reviewed
Oct 19, 2026
Contributor
|
the start/stop scripts are not valid in dash-dialect. dash is the interpreter mode selected when "/bin/sh"-ing in ubuntu resolute containers, verified with runbot image odoo:DockerMaster.future (aka DockerMasterPostgres). check yourself running shellcheck; Easy fix is to add the shebang for bash at the top of scripts |
Contributor
Author
|
The scripts are not executable and explicitly called with bash in the entrypoint. But I don't mind adding the shebang. |
Xavier-Do
force-pushed
the
19.0-docker-pg-xdo
branch
3 times, most recently
from
October 20, 2026 07:47
373258a to
1b622b7
Compare
bepro-odoo
reviewed
Oct 20, 2026
Xavier-Do
force-pushed
the
19.0-docker-pg-xdo
branch
5 times, most recently
from
October 20, 2026 09:13
531ae78 to
186f71f
Compare
Xavier-Do
force-pushed
the
19.0-docker-pg-xdo
branch
14 times, most recently
from
October 21, 2026 08:21
725c60c to
9e4140e
Compare
Xavier-Do
force-pushed
the
19.0-docker-pg-xdo
branch
from
October 21, 2026 09:40
9e4140e to
b65ad3c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Runbot currently work by sharing a postgresql cluster across multiple build, convenient to share, maintain and re-use database but this is not perfect for isolation. Mainly, the cpu limits of docker is not reflected to the PostgreSQL server, meaning that high intensive cpu/memory operation on postgres can exhaust resources to other builds, making the test time vary a lot depending on the load for some builds. This also cause issues where the server load is high making the auto-vaccum behavior unpredictable.
With this change the docker limits will be applied to the PostgreSQL server and we will be able to tweak the config per build if needed (memory, vacuum, ...).
The main change is the introduction of an entrypoint in the docker image. This entrypoint does not depend on the runbot infrastructure and should be generic, to allow to use the image locally. When started, the docker image entrypoint will create/restore a cluster if needed and start postgress. On stop, it will export the cluster if requested.
The entrypoint logic can be skipped by mounting /var/run/postgresql in the docker, forcing the docker file to use another existing socket. This will help in the transition between the two options. a parameter
use_host_postgrescan be given in the params to prevent mounting /var/run/postgresql in the docker image, as well as a param on the dockerfile, allowing to axis to migrate to the full dockerized postgress: one using the trigger, the other using the docker image config. In the future all of that will be most likely removed to only support docker in postgress.A little "hacky" but this files are only mounted if PG_VERSION is defined, to avoid to add an entry point in images that don't have/need a pg_server.
restore
While on it a few changes are made in the restore step, in order to make it easier to debug and configure. As a side effect some changes of behavior are expected:
- in general this change will need in depth testing and most likely need to adapt some existing restore
Upgrade cluster
A typical upgrade flow will be like this
Since the Docker 19 used in the first two can be in a different ubuntu version, the postgresl version is not always the same between the pre steps and the upgrade step. The cluster will be in a different place if it is the case,
PGDATA=/data/build/postgres/${PG_VERSION}so if the PG_VERSION changes, we need to restore a database exported from the pre. In this case we can only import the sql fileThe current version is far from ideal, we need to explicitly have a zip generation in the previous step, and this will generate a zip file, but detect that we may need the raw dump and leave the files in place. This will work for now but could be replace by a more precise database export, only if the next step will really need it, without always generating the zip of the database and the cluster. In the context of the pre step, it makes sense. We could also want to immediately restore the database in the right docker version if the next won't use the same docker-file. Some cleanup should be done here, most likely by introducing the pre test in the runbot code to make everything more formal.