Skip to content

feat: update all postgres image references to 16.8 Debian-based #3035

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class PostgresDockerRunner(
override fun run() {
instance =
DockerContainerRunner(
image = "postgres:16.3",
image = "postgres:16.8",
expose = mapOf(postgresAutostartProperties.port to "5432"),
waitForLog = "database system is ready to accept connections",
waitForLogTimesForNewContainer = 2,
Expand Down
7 changes: 6 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,12 @@ project(':server-app').afterEvaluate {
task startDbChangelogContainer {
doLast {
exec {
commandLine "docker", "run", "-e", "POSTGRES_PASSWORD=postgres", "-d", "-p55538:5432", "--name", dbSchemaContainerName, "postgres:13"
commandLine "docker", "run",
"-e", "POSTGRES_PASSWORD=postgres",
"-d",
"-p55538:5432",
"--name", dbSchemaContainerName,
"postgres:16.8"
}
Thread.sleep(5000)
}
Expand Down
15 changes: 12 additions & 3 deletions docker/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
FROM postgres:13.20-alpine3.21
FROM postgres:16.8

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking change, since now we embed postgres 13. So for all the users running the current image, this make their containers fail to start.

It would be great if you wrote an migration guide for this, so the users know how to migrate.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a fair point. I myself never dealt with migrating embedded databases (I always use compose with a volume mount); so I'm not sure what the best procedure would be to ensure smooth migration w/o losing data 🤔

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me neither. That's the thing... 🙈

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking a bit more about it, the update procedure should be mostly the same as for any Tolgee release (the container image changes regardless of whether the base changed or not). The only additional consideration is upgrading PostgreSQL, which is a fairly straightforward process documented here: https://www.postgresql.org/docs/17/upgrading.html

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know! Anyway, if we are going to release this, we need to do it with breaking change (new major version) and with some migration guide in our docs. 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should point out my conclusion isn't really based on anything concrete, given that I'm not even quite sure how one's supposed to upgrade Tolgee when using the monolithic image to begin with 😬

Not sure it falls under the breaking change umbrella; sure the data needs to be migrated but that's a deployment concern that I wouldn't necessarily tie to the version 🤔 but that's up to you. If this ends up released as a new major version, I recon there are a bunch of things pending removal in the source code too 😅

I don't think the monolithic docker image is best practice, it would probably be best to move towards Docker compose. Perhaps support for H2 (or SQLite perhaps) could be introduced back, disabling/degrading features that require PostgreSQL capabilities. SonarQube's images do this, IIRC (and nags the admin about the embedded database not being suited for any serious deployment).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, removing the embedded DB would make sense.

Anyway, we cannot introduce other DBs, because we already use too much Postgres specific features.

ENTRYPOINT []

RUN apk --no-cache add openjdk21
RUN apk --no-cache add "libxml2>=2.13.4-r5"
RUN <<EOF
set -eux
apt -qq update
apt -qq -y install wget
wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public | gpg --dearmor | tee /etc/apt/trusted.gpg.d/adoptium.gpg > /dev/null
echo "deb https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list
apt -qq update
apt -qq -y install temurin-21-jdk libxml2
apt -qq -y remove wget --purge --auto-remove
rm -rf /var/lib/apt/lists/*
EOF

#############
### Tolgee #
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.template.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
db:
image: postgres:11
image: postgres:16.8
environment:
- POSTGRES_PASSWORD=postgres
app:
Expand Down
4 changes: 2 additions & 2 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
db:
image: postgres:11
image: postgres:16.8
volumes:
- ../build/db-data:/var/lib/postgresql/data/
environment:
Expand All @@ -14,4 +14,4 @@ services:
depends_on:
- "db"
smtp:
image: namshi/smtp
image: namshi/smtp
Loading