YunoHost-Apps / lemmy_ynh

A link aggregator for the fediverse.
https://join.lemmy.ml
GNU General Public License v3.0
20 stars 12 forks source link

Error after upgrading to 0.18.1 & 0.18.2 #66

Open retiolus opened 1 year ago

retiolus commented 1 year ago

After upgrading to latest 0.18.1 Lemmy Yunohost version, my Lemmy server look like this:

image

retiolus commented 1 year ago

The issue is coming from the lemmy service, I can't get logs, yunohost-api crash when trying to get them.

image

mdeabreu commented 1 year ago

Do you still have this issue? I just tried upgrading on my live instance and noticed the same thing however I was able to dig a little deeper. I think this is if you have a large database. If you can ssh into your machine (or have physical access), you can see what the lemmy service is doing by looking at the /var/log/lemmy/lemmy.log file. In my case I saw the following line:

lemmy_db_schema::utils: Running Database migrations (this may take a long time)...

Yunohost thinks the upgrade succeeded but you should have seen a warning saying the lemmy service didn't fully start, that's because it's still running the migrations.

You can follow along by running tail -f /var/log/lemmy/lemmy.log and waiting until it says something new. You can also run top and see that postgres is using a ton of CPU as it goes through the migrations. It seems like the best bet is to wait until the migrations are complete and you see Database migrations complete. in that log file.

retiolus commented 1 year ago

That's correct image image

retiolus commented 1 year ago

2 h and still doing the database migration (~7 GB database), is this normal?

image

retiolus commented 1 year ago

Database migration finished and still having the "Error" message.

API error: FetchError: request to http://0.0.0.0:8536/api/v3/site? failed, reason: connect ECONNREFUSED 0.0.0.0:8536
da-am commented 1 year ago

I'm seeing this too. After migration I'm getting: Error connecting to postgres://lemmy:9WVl5bVF0FA9myk1slnMFlY7g9KEsW@localhost:5432/lemmy: could not connect to server: Connection refused

mdeabreu commented 1 year ago

I was seeing the connection refused to the postgres server, attempting to start lemmy again got me past that issue. But then it appeared that I was having troubles federating. I wasn't able to see any incoming activity.

I've opted to restore from my backup for the time being.

retiolus commented 1 year ago

Fixed the issue following these steps:

Updated config of the environment variables: https://github.com/LemmyNet/lemmy-ui#configuration

jahway603 commented 1 year ago

Thank you @retiolus for this possible fix, as I do not see the OP error. It's not clear if the server is now federating or not though.

jahway603 commented 1 year ago

Now I'm getting the original error again. Anyone have any ideas on how to fix this?

retiolus commented 5 months ago

My server running 0.18.2~ynh3 was completely broken, here is how I fixed it (not sure if this will allow futures updates from YunoHost):

node: v20.14.0 yarn: 1.22.22

  1. sudo -u lemmy bash
  2. cd
  3. delete lemmy-ui: rm -rf lemmy-ui
  4. git clone https://github.com/LemmyNet/lemmy-ui.git --recursive --> --recursive is very important
  5. cd lemmy-ui
  6. git checkout 0.18.2
  7. yarn install --pure-lockfile
  8. yarn build:prod
  9. here I don't know why but my lemmy server was running on port 8537 (default is 8536), even changing lemmy-ui environment variables I didn't manage to change its config so...
  10. sudo nano /var/www/lemmy/config/config.hjson and change port to 8536
  11. sudo systemctl restart lemmy
  12. sudo nano /etc/nginx/conf.d/lemmy.cat.d/lemmy.conf and change all 8537 to 8536
  13. sudo systemctl daemon-reload && sudo systemctl restart nginx
  14. sudo systemctl restart lemmy-ui