-
-
Notifications
You must be signed in to change notification settings - Fork 265
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThe changes update the PostgreSQL Docker image version across the codebase and configuration files. The Changes
Sequence Diagram(s)Poem
Tip ⚡💬 Agentic Chat (Pro Plan, General Availability)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Well well well, after a bit of digging, it seems like that PR accidentally found some bugs... 🙃 There was issues with sorting because using Alpine (like in the distributed image..!) means using musl libc, which has very limited support for fancy locales stuff and was only doing bytewise comparisons. Thankfully, since PostgreSQL 15 we can rely on ICU instead, which appears to solve the issues. Tests still fail, but after glancing at the results it seems the tests are the problem this time, but I didn't investigate further. |
724ebc1
to
befd300
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
backend/misc/src/main/kotlin/io/tolgee/misc/dockerRunner/DockerContainerRunner.kt (1)
129-135
: Improved command string processing to handle escaped spaces correctly.The updated implementation uses a more sophisticated regex pattern with a negative lookbehind assertion (
(?<!\\)\\s+
) to ensure that escaped spaces in command arguments are preserved during splitting. This is followed by a mapping operation that converts these escaped spaces to regular spaces.This enhancement is important for correctly processing Docker commands that might include arguments with spaces, such as container names or paths with spaces, which need to be escaped in the command line.
Consider adding a brief comment explaining the purpose of this regex and transformation for future maintainability:
private fun String.startProcess( workingDir: File, timeoutAmount: Long, timeoutUnit: TimeUnit, ): Process { + // Split command by whitespace but preserve escaped spaces, then convert escaped spaces to regular spaces val transformed = "(?<!\\\\)\\s+" .toRegex() .split(this.trim()) .map { it.replace("\\ ", " ") } return ProcessBuilder(transformed)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
backend/app/src/main/kotlin/io/tolgee/postgresRunners/PostgresDockerRunner.kt
(2 hunks)backend/misc/src/main/kotlin/io/tolgee/misc/dockerRunner/DockerContainerRunner.kt
(1 hunks)build.gradle
(1 hunks)docker/app/Dockerfile
(1 hunks)docker/docker-compose.template.yml
(1 hunks)docker/docker-compose.yml
(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
- backend/app/src/main/kotlin/io/tolgee/postgresRunners/PostgresDockerRunner.kt
- build.gradle
- docker/app/Dockerfile
- docker/docker-compose.template.yml
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Build backend 🏗️
🔇 Additional comments (3)
docker/docker-compose.yml (3)
3-3
: Update DB Service Image VersionThe
db
service now usespostgres:16.8-alpine3.21
, which aligns with the PR objective to update PostgreSQL image references. This change is properly applied.
7-8
: Introduce POSTGRES_INITDB_ARGS for ICU Locale SupportAdding the
POSTGRES_INITDB_ARGS
environment variable with the arguments--locale-provider=icu --icu-locale=und-u-kn-true
is a critical enhancement. This change leverages ICU for proper locale handling and better sorting behavior. Please ensure that the initialization arguments are tested in your test environment so that they produce the expected locale settings.
19-19
: Clarify SMTP Service Image ChangeThe SMTP service image on line 19 is updated to
namshi/smtp
. Since the primary PR objective focuses on updating PostgreSQL image references, please confirm whether this change was intentional. If it is part of a broader update, it would be helpful to include additional context in the PR description.
musl libc's reduced feature-set causes unexpected issues with ordering existing workarounds seem to surface more unexpected issues as well let's go for the easy solution first
befd300
to
92bb8f9
Compare
Well, given the amount of issues surfaced by trying Alpine images, I think it's best for now to stick to Debian-based images, and experiment with Alpine images more thoroughly later. I am unsure if the configuration I tried to use with Alpine ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
docker/app/Dockerfile (1)
5-10
: APT Installation and Cleanup BlockThe heredoc RUN block correctly:
- Enables strict mode with
set -eux
- Updates the apt cache quietly
- Installs
temurin-21-jdk
andlibxml2
in a single layer- Cleans up the apt lists to reduce image size
As an optional improvement, consider setting the environment variable
DEBIAN_FRONTEND=noninteractive
to suppress any interactive prompts during package installation. Here’s a diff suggestion:-FROM postgres:16.8 +FROM postgres:16.8 +ENV DEBIAN_FRONTEND=noninteractiveThis change can help ensure that the build stays non-interactive even if future package changes introduce prompts.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
docker/app/Dockerfile
(1 hunks)
🔇 Additional comments (1)
docker/app/Dockerfile (1)
1-1
: Base Image Update VerificationThe base image has been updated to
postgres:16.8
, consistent with the PR objective to move to a Debian-based PostgreSQL image. Please verify that the default variant forpostgres:16.8
is indeed Debian-based as expected.
8ba3cfd
to
182b46a
Compare
182b46a
to
ac497e9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
docker/app/Dockerfile (1)
5-15
: Streamlined RUN Block with Apt CommandsThe multi-line RUN block is well-structured. It updates the package lists, installs wget to fetch the Adoptium GPG key, configures the Adoptium repository, installs
temurin-21-jdk
andlibxml2
, and then cleans up by removing wget and clearing cached package lists. This helps keep the Docker image size lean.One optional enhancement is to ensure noninteractive installation by setting the
DEBIAN_FRONTEND
environment variable. This can help prevent any unforeseen interactive prompts during package installation. You can either add it as a global environment variable or prepend it to the RUN command. For instance:+ENV DEBIAN_FRONTEND=noninteractive
Or modify the RUN command as follows:
-RUN <<EOF +RUN export DEBIAN_FRONTEND=noninteractive && <<EOFThis change is optional but can improve reliability in automated builds.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
docker/app/Dockerfile
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Frontend static check 🪲
- GitHub Check: Build backend 🏗️
- GitHub Check: Build frontend 🏗️
🔇 Additional comments (1)
docker/app/Dockerfile (1)
1-1
: Base Image Update VerificationThe base image has been correctly updated to
postgres:16.8
, which aligns with the PR objective of moving to a Debian-based image with the latest PostgreSQL version. Please confirm that all dependent tools and configurations in the project are compatible with this image.
@@ -1,9 +1,18 @@ | |||
FROM postgres:13.20-alpine3.21 | |||
FROM postgres:16.8 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 🤔
There was a problem hiding this comment.
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... 🙈
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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. 🤔
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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.
Thanks a lot for the PR anyway! ❤️ Btw. What prevent us from upgrading to Postgres 17? |
Probably nothing tbh. I just stayed on 16 since that's what was used in all the tests 😅 |
See #3033
Summary by CodeRabbit