Resource icon

Scripted installation of Nextcloud 28 in iocage jail 2018-03-23

Gblenn

Dabbler
Joined
Feb 21, 2024
Messages
32
I noticed that in my existing user folder I have, besides files there is files_versions and files_trashbin with lot's of data. Do I need to run some command to get this synced up once I have copied everthing over to the new setup?
php occ files:sync foldername is the command to run.
I have been trying to find how to run this earlier without succeeding.
But this is how I managed now:
SSH into TrueNAS.
command: 'iocage console nextcloud'
then 'cd /usr/local/www/nextcloud' (this is where I found OCC)
I then tried 'php occ files:scan foldername' to which I got the response: Try adding sudo -u #80 to the command...
(may be different ID for someone else??)

So... command 'sudo -u #80 php occ files:scan foldername'

And after a few seconds it was all done and files visible when user logged in.
 

victort

Guru
Joined
Dec 31, 2021
Messages
973
I have basically all my services behind a reverse proxy. With Nextcloud you can just install and set NO_CERT=1, and forward your proxy connection to port 80. You also need to set the config.php file to trust the proxy, and edit the domain to read the same in your proxy, and host variables in config.php
 

victort

Guru
Joined
Dec 31, 2021
Messages
973
php occ files:sync foldername is the command to run.
I have been trying to find how to run this earlier without succeeding.
But this is how I managed now:
SSH into TrueNAS.
command: 'iocage console nextcloud'
then 'cd /usr/local/www/nextcloud' (this is where I found OCC)
I then tried 'php occ files:scan foldername' to which I got the response: Try adding sudo -u #80 to the command...
(may be different ID for someone else??)

So... command 'sudo -u #80 php occ files:scan foldername'

And after a few seconds it was all done and files visible when user logged in.
Generally speaking, I always just do php occ files:scan --all or php occ files:scan user
 

Gblenn

Dabbler
Joined
Feb 21, 2024
Messages
32
I have basically all my services behind a reverse proxy. With Nextcloud you can just install and set NO_CERT=1, and forward your proxy connection to port 80. You also need to set the config.php file to trust the proxy, and edit the domain to read the same in your proxy, and host variables in config.php
That's what I thought, but it just gave me an empty page when accessing via the reverse proxy... Adding the port in Caddyfile did the trick for me...
 

xames

Patron
Joined
Jun 1, 2020
Messages
235
I have problem with my isp, i cannot put hostnames there i cannot resolve my nextcloud.mydomain.com
i just install adguard plugin and work and resolve fine for my lan fixed clients manually, the other ones not because i cannot put dns in my isp side. and i cannot connect on my external clients.
I'm trying to change dhclient.conf and resolv.conf but for the moment is no working.
When i ping from truenas shell nextcloud.mydomain.com resolve locally fine, but when i don inside the jail resolve the public ip.

I try editing with nano dhclient.conf (inside etc/) (previously installed nano)
supersede domain-name-servers myloccalipofnextcloud;

and NOW IT WORKS!
 
Last edited:

Gblenn

Dabbler
Joined
Feb 21, 2024
Messages
32
Is it possible to downgrade nextcloud to a previous version, like 27?
I'm thinking of just editing the script to read NEXTCLOUD_VERSION="27"...

Reason is that I'm having trouble downloading multiple files at a time. And it seems other people have the same problem with v28 specifically so I thought I'd run a test with an older version...
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Is it possible to downgrade nextcloud to a previous version, like 27?
If you already ran php occ upgrade, then only if you have a backup of your database from that version.
 

Gblenn

Dabbler
Joined
Feb 21, 2024
Messages
32
If you already ran php occ upgrade, then only if you have a backup of your database from that version.
Well I made a fresh install and copied everything over from an older version (25) so I guess not then... Perhaps I'll make another parallell install just to try it out...
 
Last edited:

Gblenn

Dabbler
Joined
Feb 21, 2024
Messages
32
I know this is a thread about installing nextcloud using danb35's script. But as I'm running into problems with the latest version of nextcloud, when trying to download multiple items at once from the web UI.

I wanted to check if others have the same issue (version 28.0.2)??

To test it: Log in as a regular user, or admin, select a few files of any type; text, pictures etc. and click the Download button. I get an error and no file is downloaded... The windows explorer dialog that opens shows file name "download.htm" and an error that sais "site wasn't available"...

To test previous versions, I made a fresh install with version 26 (by changing the version number in danb's script) which worked fine. When trying to download multiple files I now get a zipfile as expected... I removed the jail and changed to version 27 in the script. After logging in as admin it sais version 27 is available for update, which I selected and ran, from the web UI. This also works perfectly fine, (27.1.6).

BUT, after I go to Administrative settings and clicking update, it goes through the procedure and I am again at the latest version 28.0.2, without and errors reported in the update log.
Now, downloading of multiple files no longer works...

The response over at the nextcloud forum is "Do not use a script e.g. danb35/freenas-iocage-nextcloud. Use a normal installation guide that you can understand all parts of installation."
Furthermore I got the following comments:

Read here for needed packages. You need the package php-zip with e.g. /usr/lib/php/20220829/zip.so (belongs to php version).

line 239: “php82-zip”,
freenas-iocage-nextcloud/nextcloud-jail.sh at master · danb35/freenas-iocage-nextcloud · GitHub

Maybe another error.


As far as I can see, zip has been installed and is working. There must be some other configuration error of sorts??
 
Last edited:

victort

Guru
Joined
Dec 31, 2021
Messages
973
I know this is a thread about installing nextcloud using danb35's script. But as I'm running into problems with the latest version of nextcloud, when trying to download multiple items at once from the web UI.

I wanted to check if others have the same issue (version 28.0.2)??

To test it: Log in as a regular user, or admin, select a few files of any type; text, pictures etc. and click the Download button. I get an error and no file is downloaded... The windows explorer dialog that opens shows file name "download.htm" and an error that sais "site wasn't available"...

To test previous versions, I made a fresh install with version 26 (by changing the version number in danb's script) which worked fine. When trying to download multiple files I now get a zipfile as expected... I removed the jail and changed to version 27 in the script. After logging in as admin it sais version 27 is available for update, which I selected and ran, from the web UI. This also works perfectly fine, (27.1.6).

BUT, after I go to Administrative settings and clicking update, it goes through the procedure and I am again at the latest version 28.0.2, without and errors reported in the update log.
Now, downloading of multiple files no longer works...

The response over at the nextcloud forum is "Do not use a script e.g. danb35/freenas-iocage-nextcloud. Use a normal installation guide that you can understand all parts of installation."
Furthermore I got the following comments:

Read here for needed packages. You need the package php-zip with e.g. /usr/lib/php/20220829/zip.so (belongs to php version).


freenas-iocage-nextcloud/nextcloud-jail.sh at master · danb35/freenas-iocage-nextcloud · GitHub

Maybe another error.


As far as I can see, zip has been installed and is working. There must be some other configuration error of sorts??
It’s probably Nextcloud 28. I’m having some issues as well but with uploading. In 27 I was able
To drag multiple files to upload, but with 28 I can only do one at a time. If I do multiple files, it only uploads one of them.
 

garm

Wizard
Joined
Aug 19, 2017
Messages
1,556
"Do not use a script e.g. danb35/freenas-iocage-nextcloud. Use a normal installation guide that you can understand all parts of installation."
Thats kind of a lazy reply but one I understand from their point of view, they cant support you as they would have to read the script. But on the other hand so should you.

I have had issues with Nextcloud 28 as well, but no the once you describe, those work well. So I don't think its a general bug but an implementation issue.

Do you have any flags in Administration Settings > Security and configuration warnings?
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
I would not go as far as recommending not to use danb's script, far from it. He's put an immense amount of work into making it reliable and understandable.
Nonetheless I see a point in that rather snarky comment.

Installing Nextcloud in a FreeBSD environment (server or jail) is as simple as pkg install nextcloud-php81. Then you need a web server and a database.

The package will install MySQL 8.0 anyway so the database aspect boils down to this nice and accurate documentation by Nextcloud.

And similarly a pkg install nginx and following the Nextcloud guide for NginX will take care of the web server. Minor adjustments in paths necessary but nothing major or challenging.

All of this comes quite natural ... and now I am getting to the point I am trying to make ... if you are an at least somewhat experienced system administrator who knows what a web server and a database are in the first place.

So my point is: can we at all turn Nextcloud into a "click setup.exe" application or is the system due to its complexity bound to be a three-tier-web-framework that will always require certain system administration skills?

For initial deployment even TrueNAS CORE plugins worked like the former. The crux is how to handle updates/upgrades of Nextcloud, PHP, MySQL/MariaDB etc. As far as I know there is as of today no "application style" answer and and every once in a while shit hits the fan and after an update you need to know how all of this works under the hood.

Kind regards,
Patrick
 
Last edited:

garm

Wizard
Joined
Aug 19, 2017
Messages
1,556
Given the architecture of Nextcloud I doubt it. I manage CMS stacks professionally and the closest Ive seen to cms.exe is still requiring you to manage configuration and databases separately. In my home lab the docker suit for bitwarden is kind of close I guess by pulling a couple of handful of images and managing it with a shell script.

So I thing that @danb35's approach is the way to go, but I would highly recommend anyone deploying it to read through it and understand what moving parts are involved. You make yourself a huge favor in general if you have atleast a high level understanding of how your fridge, boiler and Nextcloud instance work.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Given the architecture of Nextcloud I doubt it.
Same same. But here we are with a flood of frustrated users of TrueNAS expecting as much because plugins! ... apps!

This is my one major grief with iX and their messaging. The fundamental problem does not go away by switching from jails to helm.
 

Gblenn

Dabbler
Joined
Feb 21, 2024
Messages
32
Thats kind of a lazy reply but one I understand from their point of view, they cant support you as they would have to read the script. But on the other hand so should you.

I have had issues with Nextcloud 28 as well, but no the once you describe, those work well. So I don't think its a general bug but an implementation issue.

Do you have any flags in Administration Settings > Security and configuration warnings

Yeah, well it's sort of a snide remark for sure, and sure doesn't help me one bit. It pretty much means that unless you go the "official" route, you are on your own. But at the same time I was thinking there must be quite a large number of people who installed nextcloud using this script.
Doesn't mean everyone is already on 28.0.1 or 0.2 though. And this problem does not appear on the previous versions...

But perhaps there is someone elso who has stumbled on the same issue and found a solution...

So, a question to you then, are you saying that you have also installed nextcloud using danb35/freenas-iocage-nextcloud but you are not seeing this problem at all??

I have no warnings at all that have any relevance here, and only one error in nextcloud.log... not sure what to look for in this case though...
 

Gblenn

Dabbler
Joined
Feb 21, 2024
Messages
32
Given the architecture of Nextcloud I doubt it. I manage CMS stacks professionally and the closest Ive seen to cms.exe is still requiring you to manage configuration and databases separately. In my home lab the docker suit for bitwarden is kind of close I guess by pulling a couple of handful of images and managing it with a shell script.

So I thing that @danb35's approach is the way to go, but I would highly recommend anyone deploying it to read through it and understand what moving parts are involved. You make yourself a huge favor in general if you have atleast a high level understanding of how your fridge, boiler and Nextcloud instance work.
I suppose the obvious way to deploy nextcloud in TrueNAS is using the official plugin. Which I did two years back and it worked like a charm... It was literally as easy as clicking install. But updating was typically not that straight forward and there were issues with php versions that I was hoping I'd resolve by going the route of danb35's script.
Plex was pretty much the same thing, where I found a script that updates for me.

Going the nextcloud AIO route using Docker should be pretty straight forward as well... and I suppose I can move over to Scale to do that?

However, I have now found some references to the same problem and apparently some config settings that should resolve it. However this applies to Nginx, not Caddy, and I have no clue how to translate to the installation resulting from danb35's script.
https://github.com/nextcloud/server/issues/42617#issuecomment-1881958718

I'm 99% confident the underlying cause is a missing line in your web (nginx.conf) configuration. Specifically you're likely missing the rewrite line for handling ajax and other URLs:

https://docs.nextcloud.com/server/latest/admin_manual/installation/nginx.html

Search for "ajax" on that page and compare your config.

Or, alternatively, these lines:

https://github.com/nextcloud/docker...insecure/mariadb/fpm/web/nginx.conf#L142-L143

Originally added in nextcloud/documentation#7141 back in 2021
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Installing Nextcloud in a FreeBSD environment (server or jail) is as simple as pkg install nextcloud-php81.
I honestly don't remember having given thought to pkg install nextcloud when I was working on this (it's been six years ago now; I think I'm entitled to a little haziness in my recollection). I'd been jumping in supporting a different guide and had noticed that there was a lot of user error, and figured that the best way to make sure the user doesn't mess it up is to not let/make them do it at all--hence the script. I don't doubt that something similar could be achieved using the FreeBSD package for Nextcloud rather than installing it from source; whether that was the case when I started work on this script I don't know.

But be that as it may, the script doesn't do anything fancy--it installs Nextcloud from source (which is "un-tar it in a directory that a web server serves"), sets it up with what I think are some sensible defaults, and configures it to work with MariaDB 10.6 or PostgreSQL 13, using Caddy as the web server. The only thing there that's at all out of the ordinary is the use of Caddy rather than Apache/Nginx, which I do to simplify the configuration (the server config file with Apache is 10x longer than it is with Caddy) and to take care of all the TLS stuff.
are you saying that you have also installed nextcloud using danb35/freenas-iocage-nextcloud but you are not seeing this problem at all??
My last installation of it, using NC 28.0.2, has a similar but perhaps not identical problem--when I try to download multiple files, my browser opens a new blank tab, but there's no URL in the address bar.

I'm entirely willing to believe that the issue is the lack of a rewrite line that's in the "official" nginx config:
Code:
            # Required for legacy support
            rewrite ^/(?!index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|ocs-provider\/.+|.+\/richdocumentscode\/proxy) /index.php$request_uri;

It's kind of interesting to me that this was added, and noted as required, two years ago, but I've had no reports of problems until now. But in principle it shouldn't be too difficult to translate from nginx to Caddyfile syntax here. Just not sure when I'll get to it.
 

victort

Guru
Joined
Dec 31, 2021
Messages
973
I honestly don't remember having given thought to pkg install nextcloud when I was working on this (it's been six years ago now; I think I'm entitled to a little haziness in my recollection). I'd been jumping in supporting a different guide and had noticed that there was a lot of user error, and figured that the best way to make sure the user doesn't mess it up is to not let/make them do it at all--hence the script. I don't doubt that something similar could be achieved using the FreeBSD package for Nextcloud rather than installing it from source; whether that was the case when I started work on this script I don't know.

But be that as it may, the script doesn't do anything fancy--it installs Nextcloud from source (which is "un-tar it in a directory that a web server serves"), sets it up with what I think are some sensible defaults, and configures it to work with MariaDB 10.6 or PostgreSQL 13, using Caddy as the web server. The only thing there that's at all out of the ordinary is the use of Caddy rather than Apache/Nginx, which I do to simplify the configuration (the server config file with Apache is 10x longer than it is with Caddy) and to take care of all the TLS stuff.

My last installation of it, using NC 28.0.2, has a similar but perhaps not identical problem--when I try to download multiple files, my browser opens a new blank tab, but there's no URL in the address bar.

I'm entirely willing to believe that the issue is the lack of a rewrite line that's in the "official" nginx config:
Code:
            # Required for legacy support
            rewrite ^/(?!index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|ocs-provider\/.+|.+\/richdocumentscode\/proxy) /index.php$request_uri;

It's kind of interesting to me that this was added, and noted as required, two years ago, but I've had no reports of problems until now. But in principle it shouldn't be too difficult to translate from nginx to Caddyfile syntax here. Just not sure when I'll get to it.
ChatGPT…
 

Gblenn

Dabbler
Joined
Feb 21, 2024
Messages
32
ChatGPT…
Already tried it, and it gave me this syntax to put in Caddyfile, and I placed it at the end:

rewrite {
regexp ^/(?!index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|ocs-provider\/.+|.+\/richdocumentscode\/proxy) to /index.php{uri}
}

I did not have time to test much or investigate logs but it's failing completely as in I'm not able to reach nextcloud at all.
 
Top