This is how I got Nextcloud to work on Truenas Scale 24:10. I tried to install the official app and that didn’t work. So instead I tried the YAML way and it worked for me. It will be a post that describes the process from the beginning so feel free to skip ahead. And if you find any errors or have some suggestions please ellaborate.
I’m using my myname_admin user account to set up these steps. I joined the groups builtin_administrators, builtin_users and truenas_admin when I set this user up. UID and GID is 3000. I also added a public key so that it is easy to login from my linux terminal with this command. You need to create home folder for this to work.
ssh -i '/path/to/your/cert/yourname_id_ecdsa' myname_admin@192.168.10.2 (your ip)
If you haven’t already, create a pool and a dataset to hold your applications and make sure to chose apps as your dataset preset. Create a nextcloud dataset under apps or whatever you made. I have put mine under /ridgeback2/apps/nextcloud. Now log into any terminal and navigate to /pool/apps/nextcloud. Create the following subdirectories: config, db, redis-data, ssl, user-data
sudo mkdir /mnt/pool/apps/nextcloud/config (etc)
Change ownership on the folders you created to your UID and GID
sudo chown 3000:3000 /mnt/pool/apps/nextcloud/config (etc)
In this setup I’m using the default SSL certs on the server so they need to be copied over
cp /etc/certificates/truenas_default.crt /mnt/pool/apps/nextcloud/ssl/
cp /etc/certificates/truenas_default.key /mnt/pool/apps/nextcloud/ssl/
Change owner if you need to and set permissions
sudo chown 3000/3000 /mnt/pool/apps/nextcloud/ssl/truenas_default.crt
sudo chown 3000/3000 /mnt/pool/apps/nextcloud/ssl/truenas_default.key
chmod 644 /mnt/pool/apps/nextcloud/ssl/truenas_default.crt
chmod 600 /mnt/pool/apps/nextcloud/ssl/truenas_default.key
Now everything should be set up to install Nextcloud via YAML script. On your Truenas server go into Apps → Discover Apps → 3 horisontal dots and chose install via YAML. Give a name to this setup, I called it nextcloud for obvious reasons. Then copy and paste this YAML code, edit as needed:
services:
nextcloud:
image: lscr.io/linuxserver/nextcloud:latest
container_name: nextcloud
environment:
- PUID=3000
- PGID=3000
- TZ=Europe/Stockholm #or your TZ
- MYSQL_HOST=db
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_PASSWORD=yourpassword #avoid " in your pw if you can
- REDIS_HOST=redis
- REDIS_HOST_PASSWORD=yourpassword #avoid " in your pw if you can
volumes:
- /mnt/ridgeback2/apps/nextcloud/config:/config
- /mnt/ridgeback2/apps/nextcloud/ssl:/config/ssl
- /mnt/ridgeback2/apps/nextcloud/user-data:/data
ports:
- 3010:443 #choose any port you like, I went with 3010
depends_on:
- db
- redis
restart: unless-stopped
db:
image: mariadb:latest
container_name: nextcloud_db
environment:
- MYSQL_ROOT_PASSWORD=yourpassword #avoid " in your pw if you can
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_PASSWORD=yourpassword #avoid " in your pw if you can
volumes:
- /mnt/ridgeback2/apps/nextcloud/db:/var/lib/mysql
restart: unless-stopped
redis:
image: redis:alpine
container_name: nextcloud_redis
command: ["redis-server", " --requirepass", "yourpassword"]
volumes:
- /mnt/ridgeback2/apps/nextcloud/redis-data:/data
restart: unless-stopped
Save and watch the app deploy. The installation of nextcloud will change users on some folders under ./nextcloud. For example, the db folder is now owned by netdata:docker. Now you should be able to log into your Nextcloud running on Truenas Scale 24:10. I have not been able to make Collabora to work yet so if you have any ideas, please let me know. Here is some additional code you need:
list docker containers
sudo docker ps
move into container shell
sudo docker exec -it nextcloud (or id number) /bin/bash
in docker shell check the users you have
cat /etc/passwd
In my case, the docker container have created user abc with UID and GID 3000 which is the same UID and GID that we specified in the YAML file
Now find your occ path
find / -name occ
Confirm ownership of your path to use. This is where I found mine. The occ folder in this install is not where you would normally find it.
ls -al /app/www/public/occ
As you can see it is owned by user abc
-rwxr-xr-x 1 abc abc 308 Nov 4 09:17 /app/www/public/occ
Now we can use this path for maintenance tasks:
Turn on and off maintenance mode
sudo -u abc php /app/www/public/occ maintenance:mode --on
sudo -u abc php /app/www/public/occ maintenance:mode --off
Update and clean up cache
sudo -u abc php /app/www/public/occ files:scan --all
sudo -u abc php /app/www/public/occ files:cleanup
Convert database from SQLite to MariaDB. As of now this can not be done yet, 2024-11-04
sudo -u abc php /app/www/public/occ db:convert-type --password='yourpassword' --all-apps mysql nextcloud localhost nextcloud
There is still some tinkering to do but at least for now I have a working Nextcloud install. One can also wait until 12 December for the next update and hope that Nextcloud will be fixed. I am not that patient though. Cheers!