templates
templates copied to clipboard
Pin PostgreSQL version in `*-postgres` templates
*-postgres
templates (ex. ruby-rails-postgres) use postgres:latest
image which isn't the best default by 2 reasons:
- Using
latest
tag will cause problems in a case we rebuild container after release of new major version of PostgreSQL, as data generated by different major versions are not compatible and require using dumps, cluster upgrades, etc., simply saying container won't start unless we pin to numbered tag that matches previous major version. - Images that have tags without suffix, like
latest
or16
, are Debian-based which means it's almost twice bigger than Alpine-based (425MB vs 243MB), in most cases using Alpine-flavored image should suffice.
I suggest switching to numbered tags with -alpine
suffix as and it's smaller and would make it more future-safe. Not sure if it's possible, can PostgreSQL version be entered by user in the same way as imageVariant
during initialization?
Thank you for creating the issue and explaining the drawbacks of defaulting to the latest
tag for postgres
image.
The suggestion to allow users to override the tag (similar to imageVarient
) makes sense. But we still need to have a default. I am afraid if a tag like 16-alpine
can be the new default instead of latest
, since that will hard pin the image and would never receive newer major versions unless we manually modify the template. Any thoughts around that?
I think it would be good default, at least a better one. In perspective, pinned version in template would need to be updated every year around September/October when new major version is being released to match.
Pinned version also simplifies upgrading to latest minor version by rebuild (not sure if pull is set to always during them, docker pull postgres:16-alpine
can be run previously to be safe).
Similarly if developer would need new version to utilize newly added features or simply upgrade it with persisting data still stays manual but more controllable.