Skip to content

Conversation

@swiffer
Copy link
Collaborator

@swiffer swiffer commented Apr 7, 2025

This PR adds a check for on startup that validates the PostgreSQL version used.
Requirements are set to 16.7+ / 17.3+ - if not matched, an exception is raised.

In addition a migration is added that updates the earthdistance extension to 1.2 (bundled since 16.7 / 17.3).

Feedback welcome, fixes #4638

@netlify
Copy link

netlify bot commented Apr 7, 2025

Deploy Preview for teslamate ready!

Name Link
🔨 Latest commit d492ba0
🔍 Latest deploy log https://app.netlify.com/sites/teslamate/deploys/67f56fef17591d000805ae60
😎 Deploy Preview https://deploy-preview-4639--teslamate.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@swiffer
Copy link
Collaborator Author

swiffer commented Apr 7, 2025

to be clear - this will intentionally break existing installs not running on 16.7+ / 17.3+ and enforces users to upgrade.

from my checks supported versions should be available on all supported platforms.

@JakobLichterfeld - i suggest releasing it as part of v1.34 and mention it in the release notes?

@JakobLichterfeld JakobLichterfeld changed the title Check postgres version on startup, require 16.7 / 17.3, update earthdistance extension feat: check Postgres version on startup, require 16.7 / 17.3, update earthdistance extension Apr 7, 2025
@JakobLichterfeld JakobLichterfeld added enhancement New feature or request area:teslamate Related to TeslaMate core labels Apr 7, 2025
@cwanja
Copy link
Collaborator

cwanja commented Apr 7, 2025

What is this going to do users who are running on installations that do not support PostgreSQL 16 or 17, but are running fine on 15 or below? Are we comfortable locking them at v1.33?

@swiffer
Copy link
Collaborator Author

swiffer commented Apr 7, 2025

That would be the consequence...

Based on supported installs there shouldn't be any but i guess there are some installs out there...

Others (GitLab) are raising their minimum version yearly, too. With 18.0 (due in two months) requiring v16 as minimum.
https://docs.gitlab.com/install/requirements/#postgresql

@parkr
Copy link

parkr commented Apr 8, 2025

Is there a way users can check their minor version? Migrating is a bit of work. I'm on 16 but not sure which minor version. Is this something we could display in Grafana for example?

@swiffer
Copy link
Collaborator Author

swiffer commented Apr 8, 2025

Migrating between minors is "no" work, compose pull, down, up

You can see your current version in the database dashboard

add migration updating earthdistance extension
update docs reflecting required versions
@parkr
Copy link

parkr commented Apr 8, 2025

Yes, easier when you trust postgres minor versions. Is this also documented on the migration page or is that too much detail and users will be confused? The best way is to back up, clear the volume, pull the new version, and restore. It's best because it works for any version upgrade but takes much longer. So if folks can understand what they're doing, the pull/down/up is a great shortcut.

@swiffer
Copy link
Collaborator Author

swiffer commented Apr 9, 2025

It's not explicitly stated (the shortcut for minors) but the title in the docs is:

"Upgrading PostgreSQL to a new major version".

All install install code is not pinning to specific minors so upgrades can happen anytime.

By how we documented Upgrading TeslaMate a new PostgreSQL minor will be fetched automatically at that time.

Manual installs are upgraded via package managers as well.

See Upgrades in the official docs. https://www.postgresql.org/support/versioning/

Open for extending the docs if others agree that providing more context helps!

@JakobLichterfeld
Copy link
Member

JakobLichterfeld commented Apr 9, 2025

The best way is to back up, clear the volume, pull the new version, and restore.

Yes, and that's exactly what we describe here: https://docs.teslamate.org/docs/maintenance/upgrading_postgres

@JakobLichterfeld
Copy link
Member

Open for extending the docs if others agree that providing more context helps!

Imo the docs are sufficent there: https://docs.teslamate.org/docs/upgrading

It is not in TeslaMate's responsibility to educate the users how to update their docker stacks, nor when to do so. Pulling new minor PostgreSQL, grafana or mosquitto or anything else should be done on regular basis according to own update strategy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:teslamate Related to TeslaMate core enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

earthdistance v1.2 in PG16/17 -> migration needed

4 participants