Backstory: I had a debian 11 VPS. I installed the postgresql program from the debian 11 apt repo, back a few months ago. Back then, it was postgres 13 on the debian stable repos.
Fast forward couple months: debian 12 comes out. I do a “apt dist-upgrade” and in-place upgrade my VPS from debian 11 to debian 12. Along with this upgrade, comes postgresql 15 installed.
Now, fast forward couple more months: lemmy 0.18.3 comes out. I do not upgrade (I am on lemmy 0.18.2—afaik).
Fast forward some time, too: lemmy 0.18.4 comes out. I decide to upgrade to 0.18.4 from my existing 0.18.2.
I pull the git repo. Compile it locally. It goes well, no errors in the compilation process. I stop the lemmy systemd service, then I “mv” the compiled “lemmy_server” to /usr/bin dir.
I try to restart the now-upgraded lemmy systemd service. However, the systemd service fails.
I check the sudo journalctl -fu lemmy
and I see the following error message:
lemmy_server[17631]: thread 'main' panicked at 'Couldn't run DB Migrations: Failed to run 2023-07-08-101154_fix_soft_delete_aggregates with: syntax error at or near "trigger"', crates/db_schema/src/utils.rs:221:25
I report this issue here: https://github.com/LemmyNet/lemmy/issues/3756#issuecomment-1686439103
However, after a few back and forths and internet search, I conclude that somewhere between lemmy 0.18.3 and 0.18.4, lemmy stops supporting psql <15. So, my existing DB is not compatible.
Upon my investigation on my VPS setup, I concluded that psql 15 is running, however, lemmy is using the psql 13 tables (I do not know if this is the correct term).
Now my question: is there a way to import the lemmy data I had in the psql 13 tables to a new psql 15 table (or database, I don’t know the term).
To make things hairier: I also run a dendrite server on the same VPS, and the dendrite server is using the psql 15 with psql 13 tables on the same database as the lemmy one.
The dendrite database is controlled by a psql user named “dendrite” and the lemmy database is controlled by a psql user named “lemmy” . I hope this makes differentiation between two databases possible. And so I do not harm my existing dendrite database.
Any recommendations about my options here?
I just arrived. I will be here for the next hour or hour-and-a-half.
Let’s go if you are ready.
Here are some of the suggestions I have:
Let’s try putting the postgresql URL to the lemmy.hjson file and try again (it was in the systemd service file lemmy.service )
or, anything you suggest
Good news, found the docs:
soo, what should I add to the lemmy.hjson file now?
replied to other msg
ok, I’m here now
I don’t think the URL gets read from the file, we need to find out if there is a port= setting in there
By “file” you mean the lemmy.service systemd file?
no, the lemmy.hjson…
Good news is I found the docs: https://github.com/LemmyNet/lemmy/blob/main/config/defaults.hjson
EDIT: make sure 5433, was 5432 before edit
Speaking of, I think remove the environment variable from there, as it will take precedence.
I will remove the following line we have added yesterday:
How do we transform this line so that it fits into the lemmy.hjson file?
And need to correct the lemmy.hjson to 5433 - right?
/etc/lemmy/lemmy.hjson file doesn’t have a port directive in it yet. We are going to add one now. And yes, the expected port number should be 5433, which is for postgresql 15.
So to recap, should be easy for our next attempt:
I suppose for future, maybe worth some effort to block federation in the NGINX or something to make sure federation doesn’t kick off on wrong data if it isn’t what we expect
My suggestion: Although I have updated lemmy backend to the v0.18.4, I have not yet upgraded the lemmy-ui (frontend) to its latest version. Should I compile lemmy-ui again, so that we have its latest version, too, and then try again?
We don’t… your lemmy.hjson you were using for 0.18.2 - if you used the same password, the only thing we need to do is add the port to 5433… the URL doesn’t need to go into that file
Yes, I used the same psql password.
OK. Then, I am going to remove the
line from the lemmy.service file. And then, I will add the port directive.
The updated /etc/lemmy/lemmy.hjson file is as follows now:
{ database: { # put your db-passwd from above password: "REDACTED" port: 5433 } # replace with your domain hostname: domain.tld bind: "127.0.0.1" federation: { enabled: true } # remove this block if you don't require image hosting pictrs: { url: "http://localhost:8080/" } }
observe that I have added the
port: 5433
to the database: clause.yep, looks good. We will find out if the two formats talk to different data (“DATABASE” within PostgreSQL 15)