Fiddling with Nextcloud

Nextcloud seems like a good idea for storing documents, but I think the whole user experience is a bit "meh". All UI-elements are a bit slow, and things seems a bit sluggish. Nevertheless, here I go.

First of all. I have taken my old work laptop and installed Ubuntu Server 23.01. There is nothing like living on the bleeding edge. After that I installed docker on top of this, and crammed portainer-agent into this mess. Well, it worked quite smoothly, and so I carried on.

First of all I needed a database on this, and I used mariadb:latest and made a short docker-compose.yaml to get this up and running:

version: '3'
volumes:
  data:
services:
  db:
    image: mariadb
    environment:
      MYSQL_ROOT_PASSWORD: <password>
      MYSQL_DATABASE: <database>
      MYSQL_USER: <user>
      MYSQL_PASSWORD: <password>
    volumes:
      - data:/var/lib/mysql
    ports:
      - "3306:3306"

And, voila, I was up and running with mariadb. Next up was Nextcloud.

Since this laptop does not have a serious amount of storage (250GB), I decided to mount.nfs my OpenMediaVault-nfs to the server. I made the mountpoint, and edited /etc/fstab and did a mount -a and all was happy. After that I had to start up the Nextcould-container and dug into it to find where to mount the correct filestorage to get more storagespace in Nextcloud. After a bit of fiddling around, I found that /var/www/html/data was the correct sweetspot. Lo and behold, a docker-compose.yaml:

version: '2'

volumes:
  nextcloud_data:

services:
  nextcloud:
    image: nextcloud
    restart: always
    ports:
      - 8080:80
    volumes:
      - nextcloud_data:/var/www/html
      - /nfs/dockerstation/nextcloud:/var/www/html/data
    environment:
      - MYSQL_PASSWORD=<password>
      - MYSQL_DATABASE=<database>
      - MYSQL_USER=<user>
      - MYSQL_HOST=example.home.arpa

Before I forget it; I had to get into mariadb and create the database and the user, and I had to give the user full rights on the database in question.

Things started as expected, and I did some tweaking and adjusting. After that I needed to put Nextcloud behind a reverse proxy to get https in front of it. I fixed the reverse proxy (HA-Proxy) in my pfSense-fw, and nothing worked....

After a bit of googling, I found out that Nextcloud has to be told that it is behind a reverse proxy. The file you have to edit is /var/www/html/config/config.php and add/adjust this:

  'trusted_domains' => 
    array (
      0 => '<FQDN>',
  ),
  'trusted_proxies' =>
    array (
      0 => '<IP of Proxy>',
    ),
  'overwrite.cli.url' => 'https://<FQDN>',
  'overwriteprotocol' => 'https',
  'forwarded_for_headers' => ['HTTP_X_FORWARDED', 'HTTP_FORWARDED_FOR'],

After this, everything seems OK.

I tried to integrate calendar, mail and contacts with Google, but those things worked like a glued rat. Things where awfully slow and buggy. So I ended up disabling all those apps, and decided to test Nextcloud as a Document storage, and editor-on-the-go. Wish me luck, and I will be making updates about the progress in later posts.