this post was submitted on 30 Dec 2023
44 points (94.0% liked)

Selfhosted

37686 readers
1313 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 

Anyone who knows me knows that I've been using next cloud forever, and I fully endorse anyone doing any level of self hosting should have their own. It's just a self-hosted Swiss army knife, and I personally find it even easier to use than something like SharePoint.

I had a recurring issue where my logs would show "MYSQL server has gone away". It generally wasn't doing anything, but occasionally would cause large large file uploads to fail or other random failures that would stop quickly after.

The only thing I did is I went in and doubled wait_timeout in my /etc/mysql/mariadb.conf.d/50-server.cnf

After that, my larger file uploads went through properly.

It might not be the best solution but it did work so I figured I'd share.

top 10 comments
sorted by: hot top controversial new old
[–] [email protected] 17 points 6 months ago (2 children)

Just read the other day here that Nextcloud runs much much better with PostgreSQL. Migrating to that (or the all in one installation) is my next big project.

[–] [email protected] 10 points 6 months ago (1 children)

Yes way faster, I switched a long time ago. If you want more extra speed add redis cache via unix sockets ☝🏻

[–] [email protected] 2 points 6 months ago

Looks like I’ve got a project for next weekend

[–] [email protected] 2 points 6 months ago* (last edited 6 months ago) (2 children)

Interesting. Do you remember where you read this?

The process seems simple enough. I'm on the nextcloud:stable docker image, so adding a postgres container is really easy, but it's a scary task...

[–] [email protected] 8 points 6 months ago (1 children)

Okay, did the migration just now. Everything seems a little more responsive, but I wouldn't call it way faster.

Either way, it wasn't very scary at all. For anybody coming after me:

  • add postgres container to compose file like so. I named mine "postgres", added a "postgres" volume, and added it to depends_on for app and cron
  • run migration command from nextcloud app container like any other occ command and check admin settings/system for db state: ./occ db:convert-type --password $POSTGRES_PASSWORD --all-apps pgsql $POSTGRES_USER postgres $POSTGRES_DB
  • remove old "db" container and volume and all references to it from compose file and run docker compose up -d --remove-orphans
[–] haplo 3 points 6 months ago (1 children)

Thank you for this. I really dislike MySQL/MariaDB and favor SQLite whenever possible, or PostgreSQL otherwise. The DB migration of my Nextcloud instance was high in my to-do list, and your instructions saved me research time.

[–] [email protected] 2 points 6 months ago (2 children)

Here's a cool article I found on Nextcloud performance improvements, and connecting Redis over Unix sockets gave me a more substantial performance improvement than migrating to Postgres. Very happy I fell down this rabbit hole today.

To note if you're following the tutorial in the link above, and for people using the nextcloud:stable container together with the recommended cron container:

  • the redis configuration (host, port, password, ...) need to be set in config/config.php, as well as config/redis.config.php
  • the cron container needs to receive the same /etc/localtime and /etc/timezone volumes the app container did, as well as the volumes_from: tmp
[–] haplo 2 points 5 months ago

Thank you for the link and the Redis pointers. I should double check that my Nextcloud setup is using Redis, it might well be misconfigured.

[–] [email protected] 0 points 6 months ago

If you do end up using postgresql, over time the database could end up getting fragmented and that can lead to increased latency, so routine pg_repacks imo are a worthwhile thing to schedule.

[–] [email protected] 1 points 6 months ago

Well, another guy responded before you, so that would be the last time I heard it.

It was probably on one of the posts in this community.