-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
Deprecate postgres subchart #149
Comments
I think specifying that we need 0.2.1 for the pgvecto.rs extension would be helpful (iirc that's still the version required...). It also looks like we'll (end users) will have to build containers for if we want up to date versions of psql-server, but that's no change (previously was just using the old published image iirc). |
Is there a documented migration path for people currently using the postgres subchart so we don't lose the current data? |
Yes, I intend to add some more detail to the README about the options for deploying postgres.
I'm not quite sure what you mean by this?
Not specifically. It'll depend on what method you choose for running postgres going forward. For example, operators such as CNPG have an option to import from an existing database: https://cloudnative-pg.io/documentation/1.24/database_import/, or if you run a plain postgres you can do a backup/restore just like with the usual docker compose setup: https://immich.app/docs/administration/backup-and-restore. |
I was just looking at the published containers for pgvecto.rs and noticed that any that specified 0.2.1 are 9 months old. https://hub.docker.com/r/tensorchord/pgvecto-rs/tags?name=0.2.1 |
In case someone wants to go the apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: immich-postgres
spec:
# At the time of writing, immich is only compatible with pgvecto.rs <0.4. Latest postgres image with that version is 16.5.
imageName: ghcr.io/tensorchord/cloudnative-pgvecto.rs:16.5-v0.3.0@sha256:be3f025d79aa1b747817f478e07e71be43236e14d00d8a9eb3914146245035ba
instances: 1
postgresql:
shared_preload_libraries:
- "vectors.so"
managed:
roles:
- name: immich
superuser: true
login: true
bootstrap:
initdb:
database: immich
owner: immich
secret:
name: immich-postgres-user
postInitSQL:
- CREATE EXTENSION IF NOT EXISTS "vectors";
- CREATE EXTENSION IF NOT EXISTS "cube" CASCADE;
- CREATE EXTENSION IF NOT EXISTS "earthdistance" CASCADE;
storage:
size: 4Gi
storageClass: immich-postgres That, and migrate the data by running The critical part being making |
Hey, I understand the move, completely. But it might leave some users (like me) in a hard spot. I fully switched to Immich (ie, I've removed my photos from elsewhere but don't worry I do keep backups). but Immich is my main way of viewing pictures now. Would it be possible to walk us through a step by step of how to do the switch ? |
I don't have a step-by-step because the details will depend quite a bit on your setup and how you choose to run postgres, and because if you opt to run a more advanced setup like Kubernetes you're somewhat expected to be able to handle this kind of thing yourself. In general though, you want to spin up a new postgres instance in whatever way you prefer and get the Immich data into it, either through the import that some operators support or with a backup-restore type procedure, and then configure Immich to use that new database. |
What I meant is a default step by step as a drop in replacement to minimise disruption. Just wanted to highlight that it might put some users in a not so easy spot, to have to solve something unexpected. If it is what it is, then so be it ofc. |
If it can help anyone here are the steps I followed to do the migration just now and it didn't explode ;) https://github.com/camrossi/home-cluster/blob/main/apps/immich/DB_Migration.md |
This is awesome, I'm reading the CNPG docs right now to deploy it. |
It looks like a cnpg cluster won't work due to a bug only fixed in 0.4.0, so setting cluster size to 1 is required Also, for some reason envFrom for the password at least was not working well, I had to set env/envFrom to this to get the password populating in the env vars... maybe because I have lower case keys in the secret...
|
Yet another migration howto, largely based on the comments of this issue: |
Sharing some hiccups I found after my initial approach in #149 (comment). Yesterday I noticed that immich search was not working, and erroring with:
I solved this by manually running:
Where I think this could be added in the CNPG manifest, perhaps in |
This is what the README for the image suggests. I intend to eventually provide a base manifest for CNPG that should work out of the box, but haven't had time to do comprehensive testing yet. |
One question I have is if we should remove the externalClusters section once we are "up and running". |
I'm running into this error when trying to migrate with the initdb import approach:
Any advice on how to easily solve it? |
Just to add a little bit more on that : Immich traditional docker install provides the instructions for DB deployment as well. So I can understand that this is a lot of work for one person to maintain an extra set of instructions for a helm chart. But would you be open to the suggestion of others trying to come up with a set of instructions ? Your help would be needed eventually to review confirm or highlight potential issues. Reason is, it's already obvious few people have tried and failed on this discussions. Meaning it might not be as simple as it looks. It's a positive thing for all these users and for Immich if we could come up with something that makes it safer to migrate. The opposite would bring an undeserved negative experience towards using Immich in k8s Btw its implicit but I can try to come up with those instructions. |
I hit another small issue, I was upgrading my K8s cluster and the cordon of the node was failing as the postgres pod wasn't being removed as there is a Pod Distribution Budget set. I have for now configured the
To disable it and now I can cordon my nodes and immich went down for like a minute when the DB was finally moved to a different node. I am fine with this, just wondering however if you folks are also seeing this and if you run a single instance as well. |
I had a catastrophic cluster failure before I was able to migrate my database to CNPG. I am trying to import my immich database backup into CNPG, but the last command hangs. This is what I did:
The last command hangs with no command output. |
You can to tidy things up, but it's not required.
I believe (but am not entirely certain) this should be solved by the sed command in https://immich.app/docs/administration/backup-and-restore
Is this with CNPG? Because if you run multiple replicas the switchover should be pretty seamless (maybe a few seconds of downtime). If you're running a single pod, downtime when it reschedules is inevitable.
This command tries to access the |
Ah, yes. I |
Based on this PR: immich-app/immich#6785, does this mean we will be able to use Found it after my first part of the comment: It seems that the migration process is not possible: immich-app/immich#7296 (reply in thread) But for my use case, I will be able to create the Immich from scratch and migrate the date I after that :) |
Thanks for this. It worked generally speaking. I had to dig up how to tweak initdb for disabling huge pages for the cloudnative-pg config (for my cluster/node setup). I ended up with (mixed in with the rest)
|
Thanks, @kabakaev - your detailed Gist really helped me out! I'm ashamed to say I still used three days fixing this... Would greatly appreciate more official documentation. |
Thanks @kabakaev - I like the approach of running the database import separately using |
I ran the detailed gist and everything is up but now. But I get this if anybody faced this while using explore, rest everything works !
Edit:
|
If you are like me and ended up manually migrating the data and now you need to configure the helm chart to inject the DB vars from the secret created by cnpg you can do this as follows in the values.yaml:
|
Thanks for this. For the restore part, I had no problems following Immich's own instructions on: https://immich.app/docs/administration/backup-and-restore/
After altering the DB_HOST, DB_USERNAME and DB_PASSWORD in my BTW, you can create the postgres cluster anywhere, so instead of placing it with the |
@nadiamoe you don't know helpful this is. Was trying to use cnpg and hitting against a brick wall. this helped a lot i owe you a beer!
|
For better or worse, I use zalando/postgres-operator in my cluster, and the process was similar, but different compared to Creating the database is pretty straightforward, with only minor complications:
Migrating data largely followed the documentation to get the data, but it was more complicated to write it back.
The full set of changes I made can be seen in sdwilsh/ansible-playbooks@8858c83. |
I think the correct order would be
|
As of chart version 0.9.0, the postgres subchart will be deprecated. In 0.10.0 it will be removed entirely. See #129 for the reasoning and discussion.
If you're reading this issue, you probably came here because trying to install the chart gave you an error message with a link. This is your signal to look into a different way of running Postgres for Immich, that doesn't depend on this chart directly. We recommend using an operator with an image like https://github.com/tensorchord/cloudnative-pgvecto.rs or https://github.com/chkpwd/cdpgvecto.rs. More details on possible configurations will be added to the README file later.
If you want to bypass the deprecation warning and install with the deprecated postgres chart anyways, you can do that by setting
useDeprecatedPostgresChart: true
in the values. Be very careful if you do that, because in chart version 0.10.0 that postgres instance will be deleted entirely without any warning.TBD before full removal
The text was updated successfully, but these errors were encountered: