hassos-addon-timescaledb icon indicating copy to clipboard operation
hassos-addon-timescaledb copied to clipboard

Explain how to upgrade from 2.11 to 4.0 - and make it less precious!

Open mgg1010 opened this issue 2 years ago • 23 comments

Hi

I tried upgrading from 2.11 to 4.0. It upgraded, then I got an error saying "can't upgrade postgres 14, please update first" - and then the add-in shut down!

I'm technical, but not a deep expert in HA - so I was lost. I found instructions saying to upgrade PG I needed to use pgadmin - but I couldn't because the addin shut down.

I've managed to downgrade back to 2.11, so my setup is working. But

  1. Can you give me a route to upgrade? Home Assistant doesn't support upgrading to 3.0, which might do it. I might be able to use portainer to do it, but any guidainces would be great

  2. A thought for the future: make it so the addin doesn't shut down so completely - or check for this condition sooner!

Thanks

Martin Green

mgg1010 avatar Mar 31 '24 22:03 mgg1010

Hi Martin!

Wow! Upgrading from 2.11 is quite a step! Let me explain:

Within the addon, I had to manage not only upgrades of different timescale versions, but also different versions of Postgres. This means that each addon contains 2 postgres versions: The 'previous major version', and the 'current version'. Within a version you need to upgrade timescale first, and eventually postgres. So the addon has to run 2 postgres versions simultaneously during upgrades between major versions. When I started the addon, we were on Postgres 12. Then came 14, then 15 and now 16. This means that if I would make the upgrade possible from 12, I need to build-in Postgres 12,14,15 and 16. That would make the addon huge! (Apart form the fact that the base-image doesn't support all the older version anymore).

Unfortunately, I don't have any other means for checking earlier in the process or continue without quitting... But.. maybe I could help with upgrading step by step..

Is it possible to connect on discord? https://discord.gg/ccBjsZC8 I could help you perform the upgrade in a few intermediate steps.

expaso avatar Apr 03 '24 13:04 expaso

Hi Martin, do you still need some assistance with this?

expaso avatar Apr 12 '24 12:04 expaso

I al also facing an issue going from 2.0.1 to 4.0.1

i just updated core and os and wanted to update all add-ons.

after this update no history was found, my enery dashboard is gone(maybe not related).

But also I cannot log into the database.

Tried downgrading using the backup but still no luck. Its been years since I set this up also the reason for the huge jump in versions.

I could do with any assistance maybe over Discord?

JeppeBoetkjaer avatar May 15 '24 14:05 JeppeBoetkjaer

Hi @JeppeBoetkjaer , sure I can try helping you out... Discord invite: https://discord.gg/JktdYKhE

expaso avatar May 17 '24 07:05 expaso

Unfortunately, I have the same problem. I was never shown that there was an update of LTSS, with the last HA update there was now a note that the setup config is missing. After I added the source again the note: From 1.1.6 to 4.0.1

;(

Unfortunately the same problem, the update hangs with the note, cant upgrade postgres ...

Is there an "easy" way to export the database, delete LTSS completely, reinstall 4.0.1. and then just import the old data? ...

Even when importing a backup, my old data is back, but the recorder no longer works correctly and no new data (e.g. energy) is recorded ... I would like to simply save the database with the backup and then set up LTSS completely new ... Is there a way to do this?

Thank you

LaMiyu avatar Jun 22 '24 07:06 LaMiyu

Argh i got the same problem. I'm on 4.0.1 Failed to start cause i need to upgrade. My entire energy dashboard is gone. How do i downgrade the addon and upgrade the db ?

skank01 avatar Jun 22 '24 12:06 skank01

Hi

I tried upgrading from 2.11 to 4.0. It upgraded, then I got an error saying "can't upgrade postgres 14, please update first" - and then the add-in shut down!

I'm technical, but not a deep expert in HA - so I was lost. I found instructions saying to upgrade PG I needed to use pgadmin - but I couldn't because the addin shut down.

I've managed to downgrade back to 2.11, so my setup is working. But

  1. Can you give me a route to upgrade? Home Assistant doesn't support upgrading to 3.0, which might do it. I might be able to use portainer to do it, but any guidainces would be great
  2. A thought for the future: make it so the addin doesn't shut down so completely - or check for this condition sooner!

Thanks

Martin Green

Hi, how did u downgrade the addon?

skank01 avatar Jun 22 '24 12:06 skank01

@Expaso can you help me please? Thx in advance

skank01 avatar Jun 23 '24 12:06 skank01

Hi I tried upgrading from 2.11 to 4.0. It upgraded, then I got an error saying "can't upgrade postgres 14, please update first" - and then the add-in shut down! I'm technical, but not a deep expert in HA - so I was lost. I found instructions saying to upgrade PG I needed to use pgadmin - but I couldn't because the addin shut down. I've managed to downgrade back to 2.11, so my setup is working. But

  1. Can you give me a route to upgrade? Home Assistant doesn't support upgrading to 3.0, which might do it. I might be able to use portainer to do it, but any guidainces would be great
  2. A thought for the future: make it so the addin doesn't shut down so completely - or check for this condition sooner!

Thanks Martin Green

Hi, how did u downgrade the addon?

Hello,

I was able to restore the backup of HA. This was created automatically during the upgrade. System -> Backup -> Select TimeScaleDB -> Restore

LaMiyu avatar Jun 23 '24 14:06 LaMiyu

Hi Good idea, will try that. After reverting to old one, did you succeed in upgrading to new one too?

Op zo 23 jun. 2024 16:47 schreef LaMiyu @.***>:

Hi I tried upgrading from 2.11 to 4.0. It upgraded, then I got an error saying "can't upgrade postgres 14, please update first" - and then the add-in shut down! I'm technical, but not a deep expert in HA - so I was lost. I found instructions saying to upgrade PG I needed to use pgadmin - but I couldn't because the addin shut down. I've managed to downgrade back to 2.11, so my setup is working. But

  1. Can you give me a route to upgrade? Home Assistant doesn't support upgrading to 3.0, which might do it. I might be able to use portainer to do it, but any guidainces would be great
  2. A thought for the future: make it so the addin doesn't shut down so completely - or check for this condition sooner!

Thanks Martin Green

Hi, how did u downgrade the addon?

Hello,

I was able to restore the backup of HA. This was created automatically during the upgrade. System -> Backup -> Select TimeScaleDB -> Restore

— Reply to this email directly, view it on GitHub https://github.com/Expaso/hassos-addon-timescaledb/issues/44#issuecomment-2185018825, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMXFMVXVQO2L7KFABRRJKPDZI3NWPAVCNFSM6AAAAABFQX52HSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBVGAYTQOBSGU . You are receiving this because you commented.Message ID: @.***>

skank01 avatar Jun 23 '24 14:06 skank01

OK managed to revert back and all is working again. Can you explain me now how to properly update?

skank01 avatar Jun 23 '24 18:06 skank01

Expanso

Very, very sorry for the slow reply. I appreciate your offer, and it's very useful - I'll connect on Discord. The problem is that this is a home activity for me, and work is crazy...

If there's a route where I can backup the DB, and install the newest version and then just copy the tables - maybe that's the best option? I'm a developer by background, so very technical but not very experienced in this environment.

Thanks

Martin

mgg1010 avatar Jun 23 '24 20:06 mgg1010

Oops - discord invite expired too!

mgg1010 avatar Jun 23 '24 20:06 mgg1010

Hi I tried upgrading from 2.11 to 4.0. It upgraded, then I got an error saying "can't upgrade postgres 14, please update first" - and then the add-in shut down! I'm technical, but not a deep expert in HA - so I was lost. I found instructions saying to upgrade PG I needed to use pgadmin - but I couldn't because the addin shut down. I've managed to downgrade back to 2.11, so my setup is working. But

  1. Can you give me a route to upgrade? Home Assistant doesn't support upgrading to 3.0, which might do it. I might be able to use portainer to do it, but any guidainces would be great
  2. A thought for the future: make it so the addin doesn't shut down so completely - or check for this condition sooner!

Thanks Martin Green

Hi, how did u downgrade the addon?

Hello,

I was able to restore the backup of HA. This was created automatically during the upgrade. System -> Backup -> Select TimeScaleDB -> Restore

Hi , do you know how to properly update now?

skank01 avatar Jun 28 '24 10:06 skank01

Hi I tried upgrading from 2.11 to 4.0. It upgraded, then I got an error saying "can't upgrade postgres 14, please update first" - and then the add-in shut down! I'm technical, but not a deep expert in HA - so I was lost. I found instructions saying to upgrade PG I needed to use pgadmin - but I couldn't because the addin shut down. I've managed to downgrade back to 2.11, so my setup is working. But

  1. Can you give me a route to upgrade? Home Assistant doesn't support upgrading to 3.0, which might do it. I might be able to use portainer to do it, but any guidainces would be great
  2. A thought for the future: make it so the addin doesn't shut down so completely - or check for this condition sooner!

Thanks Martin Green

Hi, how did u downgrade the addon?

Hello, I was able to restore the backup of HA. This was created automatically during the upgrade. System -> Backup -> Select TimeScaleDB -> Restore

Hi , do you know how to properly update now?

i haven't find a solution until now ... i have a backup of my 1.1.6 timescale DB with all the Data and make some csv exports from pgadmin also a backup as sql from the database. But i cannot import anything in the 4.x Version - At the moment i have no solution. ;( All my historical Data are lost ...

LaMiyu avatar Jul 01 '24 19:07 LaMiyu

@Expaso how do we update from 2.0.1?

skank01 avatar Jul 03 '24 10:07 skank01

@Expaso is it possible to please reply? We are stuck on how to update

skank01 avatar Jul 17 '24 11:07 skank01

I al also facing an issue going from 2.0.1 to 4.0.1

i just updated core and os and wanted to update all add-ons.

after this update no history was found, my enery dashboard is gone(maybe not related).

But also I cannot log into the database.

Tried downgrading using the backup but still no luck. Its been years since I set this up also the reason for the huge jump in versions.

I could do with any assistance maybe over Discord?

Hi @JeppeBoetkjaer did you manage to upgrade correctly? Can you help me, cause @Expaso isnt replying anymore and i cant update the addon cause of this problem

skank01 avatar Jul 30 '24 14:07 skank01

Hi all! Back again!

Sorry for the delay, I was on the other side of the world for a project for quite some time, so I did not had a change to look into this, but I'm currently testing a possibility..

Stay close, Im on it right now.

Edit: New Discord invote link: https://discord.gg/wScb9jjr

expaso avatar Aug 17 '24 14:08 expaso

@skank01 , @JeppeBoetkjaer , @mgg1010

I have found a way of upgrading the intermediate steps of the addon manually.

Here are the instructions:

  1. Make sure you have a backup of your timescale addon!

  2. Obtain SSH root access to your home-assistant installation, using this method: https://developers.home-assistant.io/docs/operating-system/debugging/

  3. Stop the timescale-db addon.

Important! Replace aarch64 with amd64 if you are on a x64 machine. If you are on a raspberry PI or other embedded board, mostly you'll have to use aarch64

To upgrade from 1.x.x, run the 2.1.1 version using this command:

docker run --rm --name timescaledb-upgrade -v /mnt/data/supervisor/addons/data/77b2833f_timescaledb/:/data:rw husselhans/hassos-addon-timescaledb-aarch64:2.1.1

To upgrade from 2.x.x, run the 3.0.2 version using this command:

docker run --rm --name timescaledb-upgrade -v /mnt/data/supervisor/addons/data/77b2833f_timescaledb/:/data:rw husselhans/hassos-addon-timescaledb-aarch64:3.0.2

To upgrade from 3.x.x, run the 4.0.1 version using this command:

docker run --rm --name timescaledb-upgrade -v /mnt/data/supervisor/addons/data/77b2833f_timescaledb/:/data:rw husselhans/hassos-addon-timescaledb-aarch64:4.0.1

After the last step, you should see something like:

[15:47:28] INFO: Starting PgAgent.. curl: (6) Could not resolve host: supervisor [15:47:29] ERROR: Something went wrong contacting the API [15:47:29] NOTICE: TimescaleDb is running!

Stop this process by using Crtrl-C, and let the database shut down

From here, the normal home-assistant upgrade should be back on track again.

  1. Start the addon again in Home Assistant. You should be good to go.

expaso avatar Aug 17 '24 15:08 expaso

ion - At the moment i have no solution. ;( All my historical Data are lost ...

Probably your data is still there, as it's just moved to another folder internally. Reach out on discord, so I can help you: https://discord.gg/wScb9jjr

expaso avatar Aug 17 '24 15:08 expaso

5. e Assistant. You should be good to go.

Hi,

No need to excuse yourself... You are doing this all in your free time. Thx a lot for all your work, and keeping this alive. Much appreciated !

I just tested your solution ,and i can confirm i could easily upgrade now from 2.0.1 to 4.0.1 All is working fine now, a big thanks !!!

For me this can be closed!

skank01 avatar Aug 18 '24 12:08 skank01

Great to hear!!

And thank you for using the addon! Enjoy!!

expaso avatar Aug 18 '24 14:08 expaso