Since I started messing around with OpenMediaVault and TrueNAS Scale I have been experimenting with using containerized applications running on them. Some at easy to install and configure and some… are not. It’s also been really interesting to see the difference between how OpenMediaVault and TrueNAS handle them. OMV is more like “paste docker compose file here and edit it” and TrueNAS is more “here’s a long web page form, select things, fill things out and submit it” and both have pros and cons, but I’m here today to talk about Nextcloud on TrueNAS.
I should note my environment, even though it may not have a huge impact on things. Still, it’s worth a mention because every install is different. I use Nginx Proxy Manager to be able to use some of my hosted services on my home network outside of my own network. So while Nextcloud might be at 192.168.1.105 at my house, I might want to visit it at nextcloud.example.com from elsewhere in the world. (Assuming I have control over nextcloud.example.com, which I do not, because it’s just an example.)
Anyway, I used the TrueNAS “app store” to install Nextcloud. I had to fill out the form a few times to get things right. I made sure I noted any passwords I typed into the form. Eventually I got the form to submit and Nextcloud was deployed! I tried to visit 192.168.1.105:30085 in my browser (TrueNAS gives every containerized application a high port number, above 30000 so as not to conflict with anything else I guess) but it did not work. That’s okay…
One of the neat things about TrueNAS is that the web interface have a system shell built into a web page in the admin where you can type commands and do whatever shell stuff you need to.
Since I logged into the TrueNAS web admin as tnsadmin
I was put into the shell as the user tnsadmin
which can use the sudo
command. So I had to edit the file Nextcloud config file found at /mnt/.ix-apps/app_mounts/nextcloud/html/config/config.php
.
The config file has a line with 'overwriteprotocol' => 'https',
which tries to force HTTPS. Since i was running on am IP address on my local network using 192.168.1.105 that caused issue because there is no cert for that. You can try to set it to use the TrueNAS certificate but that did not work and just kicked me from Nextcloud to TrueNAS in my browser… maybe because of the port number? I don’t know. I changed from HTTPS to HTTP with this 'overwriteprotocol' => 'http',
There is also this whole section on trusted_proxies I tried to mess with since I did plan on using a proxy. I ended up deleting everything I added there, and what you see below seems to be the default from the file before I made any edits. I don’t know if that is a default or was generated by my system. It didn’t seem to matter.
'trusted_proxies' =>
array (
0 => '127.0.0.1',
1 => '192.168.0.0/16',
2 => '172.16.0.0/12',
3 => '10.0.0.0/8',
),
Next up was trusted_domains which I did change.
'trusted_domains' =>
array (
0 => '127.0.0.1',
1 => '192.168.1.105',
2 => 'localhost',
3 => 'nextcloud.example.com',
4 => 'nextcloud',
),
The 192.168.1.105 is the IP address of the server, and nextcloud.example.com is the domain I’ll use with the Nginx Proxy Manager. After all this nonsense… it worked! (Again, replace nextcloud.example.com with whatever you might be using.)
Well, it worked as in I could get my web browser to the Nextcloud login page. I could not login though. I tried all sorts of usernames and passwords and searched for Nextcloud default passwords and that all failed.
I finally found this form thread Logging into Nextcloud App for the first time – Cannot log in as specified user with the solution. Back to the browser-based shell in TrueNAS to type this command:
sudo docker exec -it -u 33 ix-nextcloud-nextcloud-1 php -f /var/www/html/occ user:resetpassword ncadmin
I don’t know if it needs to be ncadmin but that was what I was trying to login with based on a different post I read. Luckily it asked me for a new password (twice) right on the command line, so I type a new password (twice) and after that I was able to log into Nextcloud.
That login became the admin user since it was the first to login so I made a user account for myself and was up and running with Nextcloud.
Oh, I should also note that while I changed the config from using HTTPS to HTTP, my proxy server has a certificate (from Let’s Encrypt) so when I visit outside my network using nextcloud.example.com https works as the reverse proxy handles the https part of things.
I should add one thing! It’s important! Everything above is about Nextcloud in the browser. It works for me in a desktop browser and in a mobile browser but not in the mobile application (yet!) I’ve got a list of posts and notes to follow up to get that part to work.
I have also not been able to get all of the Nextcloud “apps” (add-ons within Nextcloud) installed and configured yet. It’s… a journey I guess. Sigh…