Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.
Resource icon

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

Western Digital Drives - The Preferred Drives of FreeNAS and TrueNAS CORE

danb35

Wizened Sage
Joined
Aug 16, 2011
Messages
12,440
I've updated the script to create /var/log/nextcloud/, change its ownership to the www user, and put the log there--seems to be working fine. The script also seems to work fine to install Nextcloud 22--I'll probably update it shortly to make that the default.
 

Basil Hendroff

Dedicated Sage
Joined
Jan 4, 2014
Messages
1,645
I've updated the script to create /var/log/nextcloud/, change its ownership to the www user, and put the log there--seems to be working fine. The script also seems to work fine to install Nextcloud 22--I'll probably update it shortly to make that the default.
Great! I've retrofitted these changes in my NC jail. If anyone else wants to do the same, but is not sure how to proceed, enter your NC jail from a terminal e.g. iocage console nextcloud and execute the following commands:
Code:
mkdir -p /var/log/nextcloud/
chown www:www /var/log/nextcloud
su -m www -c 'php /usr/local/www/nextcloud/occ config:system:set logfile --value="/var/log/nextcloud/nextcloud.log"'
service php-fpm restart
 

mistermanko

Senior Member
Joined
Jan 27, 2020
Messages
287
Great! I've retrofitted these changes in my NC jail. If anyone else wants to do the same, but is not sure how to proceed, enter your NC jail from a terminal e.g. iocage console nextcloud and execute the following commands:
Code:
mkdir -p /var/log/nextcloud/
chown www:www /var/log/nextcloud
su -m www -c 'php /usr/local/www/nextcloud/occ config:system:set logfile --value="/var/log/nextcloud/nextcloud.log"'
service php-fpm restart
Really nice work, Basil! Fast and Simple, as always. Don't forget to copy your existing logs into /var/log/nextcloud/
 

Basil Hendroff

Dedicated Sage
Joined
Jan 4, 2014
Messages
1,645
Really nice work, Basil! Fast and Simple, as always. Don't forget to copy your existing logs into /var/log/nextcloud/
Well spotted @mistermanko! I had hoped this would slip under the radar. It was a conscious decision to start with a new log, but you're right, it was a sleight of hand and I should have been clearer on this point.
 

Basil Hendroff

Dedicated Sage
Joined
Jan 4, 2014
Messages
1,645
However, if I apply your PR, I get lots of fatal errors:
Okay, I think I've solved the mystery. It appears there's more than one way to skin a cat. It has to do with commit 1f6579a to the repo. So, to align my NC instance as closely as possible to the NC environment created by the script, this is what I had to do.

1. Edit php.ini cd /usr/local/etc && ee php.ini. Search for expose_php and add the lines below after it.
Code:
; Enable the apc cli to prevent memory error, see link below for more info
; https://help.nextcloud.com/t/solved-occ-command-php-fatal-error-allowed-memory-size-of-xxx-bytes-exhausted/108521/28
[apcu]
apc.enable_cli=1


Exit the editor.

2. Reverse the change I suggested in post #2043.
Code:
su -m www -c 'php /usr/local/www/nextcloud/occ config:system:set memcache.local --value="\OC\Memcache\APCu"'

3. Restart the PHP manager.
Code:
service php-fpm restart
 

gt2416

Senior Member
Joined
Feb 4, 2018
Messages
253
So after editing the php file is it better to use APCu or redis for memcache ?
 

Basil Hendroff

Dedicated Sage
Joined
Jan 4, 2014
Messages
1,645
So after editing the php file is it better to use APCu or redis for memcache ?
Good question. I think it's better to align closely with the environment the script sets up. It will simplify and streamline support in this discussion area. So, yup... APCu.

You actually don't have a choice if you've edited php.ini. It has to be APCu otherwise you get the errors seen in post #2044.
 
Last edited:

mistermanko

Senior Member
Joined
Jan 27, 2020
Messages
287
Good question. I think it's better to align closely with the environment the script sets.

Looking at the script, it makes use of both, APCu and redis. One for local caching and one for distributed caching, which is fine according to nextcloud documentation.


So to answer your questions @gt2416, it depends. Stick to the docu and to the ways the script sets up memcaching and you're fine.
 

gt2416

Senior Member
Joined
Feb 4, 2018
Messages
253
Thanks, Ive also added a couple settings according to the doc.

In /usr/local/www/nextcloud/config/config.php add

'memcache.distributed' => '\OC\Memcache\Redis',

I also used redis as session handler. Apparently its better than the default "files" handler especially if you use Talk (which I do)

To do so edit /usr/local/etc/php.ini
Find session.save_handler and set it to
session.save_handler = redis

uncomment session.save_path and set it to
session.save_path = "unix:///var/run/redis/redis.sock?persistent=1"

Edit /usr/local/etc/php/ext-30-redis.ini and add these lines to it

Code:
redis.session.locking_enabled=1
redis.session.lock_retries=-1
redis.session.lock_wait_time=10000
 

mistermanko

Senior Member
Joined
Jan 27, 2020
Messages
287
Thanks, Ive also added a couple settings according to the doc.

In /usr/local/www/nextcloud/config/config.php add

'memcache.distributed' => '\OC\Memcache\Redis',

I also used redis as session handler. Apparently its better than the default "files" handler especially if you use Talk (which I do)

To do so edit /usr/local/etc/php.ini
Find session.save_handler and set it to
session.save_handler = redis

uncomment session.save_path and set it to
session.save_path = "unix:///var/run/redis/redis.sock?persistent=1"

Edit /usr/local/etc/php/ext-30-redis.ini and add these lines to it

Code:
redis.session.locking_enabled=1
redis.session.lock_retries=-1
redis.session.lock_wait_time=10000
One thing to consider before making your suggested changes to memcaching is also mentioned in the nextcloud doc:

APCu is faster at local caching than Redis. If you have enough memory, use APCu for Memory Caching and Redis for File Locking. If you are low on memory, use Redis for both.

 

gt2416

Senior Member
Joined
Feb 4, 2018
Messages
253
Good point, I left local memcaching as APCu and used redis only for distributed caching and file locking.
The other new settings I posted above are for session handling. Honestly I don't see the difference myself but apparently using redis for session handling is better than php default "files" handler, any free performance tuning is always welcome in my book.
 

Soupcan

Neophyte
Joined
Mar 6, 2021
Messages
5
Hello people, I've a problem with my scripted Installation.

Everything went smoothly really, Nextcloud is also running, my problem that I just have is that I cannot access it through it's local IP Address how I used to sometimes.

So, when I try to connect to my domain xXxxxX.duckdns.org, it connects successfully and I get no problems, I can do everything I could really.

But once I try to connect to it's local IP Address, 192.168.178.21, it throws me Error code: SSL_ERROR_INTERNAL_ERROR_ALERT.

I've set the Script up with a STANDALONE_CERT=1, so I've read here that I might have to change it to SELFSIGNED, tried reinstalling a different testcloud jail, it's local ip still threw me the same Error Code.

Now as to why I want to connect to it's local IP Address, I want to try and get the transfer Speed a bit quicker, since I assume that it would Increase to my 100 MB/s Speed if i'd set it up like this (which would be fantastic), but I am unsure if it would even reach that Speed.

As to why I need these Transfer Speeds, I've set up my Storage in Nextcloud to be connected with mounted Datasets from my TrueNAS, meaning that all my Datasets are displayed and handled through Nextcloud.

Before, I've had one of those Datasets shared through TrueNAS with an SMB Share to get my Transfer Speed and also dump big files onto the Dataset, problem that I've gotten from it was that I assume I broke my Nextcloud Jail's Database Structure since I guess it didn't know I moved files? or something like that, I'm not quite sure what the problem is/was. (see my post https://www.truenas.com/community/threads/nextcloud-internal-server-error.94207/#post-652204)

For me, it would be very convenient to have basically all my Data that I can access through my Nextcloud Jail to be able to access my files anywhere I go and from any Device I want, while perhaps also having the ability to have quick upload/download speed when i'm locally connected to it.

Any suggestions are gladly appreciated!
 

NasKar

Neophyte Sage
Joined
Jan 8, 2016
Messages
725
My version of Nextcloud 21.0.3 on TrueNAS-12.0-U4.1 is giving an error msg on the admin/overview.
Code:
Module php-imagick in this instance has no SVG support. For better compatibility it is recommended to install it.

Any thoughts on what the best way to fix it?
 

danb35

Wizened Sage
Joined
Aug 16, 2011
Messages
12,440
But once I try to connect to it's local IP Address, 192.168.178.21, it throws me Error code: SSL_ERROR_INTERNAL_ERROR_ALERT.
The configuration produced by the script really doesn't support accessing the jail by IP address--it wants you to be using a domain name, as that's the only way SSL will work without errors. But as long as your DNS is set up properly (i.e., the domain name resolves to your jail's IP address inside your LAN), this shouldn't affect transfer speeds at all.
 

T_T

Member
Joined
Jul 24, 2018
Messages
56
First of all, thank you Mr.Danb for the script. Absolutely amazing!

I did open port 80 and 443 and purchased a domain name with namecheap.com
JAIL_IP="192.168.1.199"
DEFAULT_GW_IP="192.168.1.1"
POOL_PATH="/mnt/vault"
TIME_ZONE="America/Chicago"
HOST_NAME="example.us"
STANDALONE_CERT=1
CERT_EMAIL="myemail@gmail.com"

Everything is working so far, but there are several questions that I would like to clarify:

  1. So when I type in the address of my nextcloud "example.us" it will only work on chrome, if I use other browsers I have to type https://example.us. I am assuming this has something with the certificate which I believe I do have a trusted certificate with the green lock on the address bar when I type https in front of my address on any browser.
    1. I have tried to add a URL redirect in my namecheap record but still won't work
    2. I get this error INET_E_RESOURCE_NOT_FOUND
  2. I know if I want to fix the HTTP Strict Transport Security error I should wait for it to renew which is approximately 60 days. But how do I know if it's renewed and when is the best time to run the command to fix the HSTS issue?
  3. I know that I cannot access my nextcloud using internal IP address. I will have to edit the host file on each PC which I did. But it still did not work. I want to be able to access nextcloud using my internal address just in case if something went wrong. IDK if this is something I understood correctly but will greatly appreciate any pointers.
  4. Every time I upload a file to nextcloud the modified date display totally wrong (a file a just upload said it was there for like 2 days). What settings if any can I change?
  5. Within nextcloud settings, I saw it RAM usage was almost the entire 32 GB that I have installed. Is this normal?
    RAM usage.png
  6. Within nextcloud settings, PHP also tell me that upload size is limited like the picture below. What can I do to increase the upload size limit?
    upload limit.png
  7. I'm sure this has to do with permission issue. I have created several SMB share and wanted to move file between users by just drag and drop on my window PC once my mapped the drive. Is this even possible?
  8. All my data is in an external HDD and I am planning on moving it to my nextcloud. What would be the best and fastest way to do this?
    pool.png
  9. This might be a stupid question but do I need to setup a different server within a jail if I want to use ONLYOFFICE app in nextcloud? If so, is there any guide for this?
Thanks in advance for all the help!
 

Patrick M. Hausen

Wizened Sage
Joined
Nov 25, 2013
Messages
4,038
My version of Nextcloud 21.0.3 on TrueNAS-12.0-U4.1 is giving an error msg on the admin/overview.
Code:
Module php-imagick in this instance has no SVG support. For better compatibility it is recommended to install it.

Any thoughts on what the best way to fix it?
Please post the pkg info for the packages matching "pecl-imagick" and "ImageMagick". If they are installed without X11 support, then SVG is disabled. This is fixable, but I need the info which packages precisely you are using.
 

danb35

Wizened Sage
Joined
Aug 16, 2011
Messages
12,440
So when I type in the address of my nextcloud "example.us" it will only work on chrome, if I use other browsers I have to type https://example.us.
What happens on the other browsers if you don't add "https://"?
I am assuming this has something with the certificate
This is highly unlikely.
But how do I know if it's renewed
After 60+ days, browse to your Nextcloud installation and check the certificate--exactly how you'd do that varies from browser to browser, but you'd generally start by clicking on the padlock. It will show the validity period. If that shows the cert has been renewed (i.e., if the start date is much later than today), you're good.

As another possibility, sign up for certificate transparency notifications, e.g., with Facebook or Cloudflare. See:

They'll email you to let you know when a new cert is issued for your domain.
when is the best time to run the command to fix the HSTS issue?
It really doesn't matter--once you know renewal is working properly, you can run it whenever. But note, this isn't something that needs to be "fixed." It isn't broken; it's working just fine. HSTS is an optional security feature that (like most security features) can cause problems under certain circumstances.
I will have to edit the host file on each PC which I did.
Really, you want whatever device is serving DNS for your LAN (typically your Internet router) to do this--hand-editing the hosts file works, but it's a klunky way to do it. If you can't do this on your router, consider setting up Pi-Hole (which will have other benefits as well). But no, my configuration really isn't designed to work using the IP address.
Every time I upload a file to nextcloud the modified date display totally wrong
When I upload a file to Nextcloud through its web interface, the modified date is the original modified date of the file. I just tested this with a file on my computer that has a modified date of 23 April; the date in Nextcloud is also 23 April. The modified date doesn't change to the date/time you upload it.
I saw it RAM usage was almost the entire 32 GB that I have installed. Is this normal?
Pretty much; I expect you'll see the same in your TrueNAS web UI. You have the RAM, might as well use it.
PHP also tell me that upload size is limited
Do you intend to upload files larger than 16 GB? Even if so, I don't expect this to be a problem because of the way Nextcloud handles files.
I have created several SMB share and wanted to move file between users by just drag and drop on my window PC once my mapped the drive. Is this even possible?
What you're describing here doesn't sound like it has anything to do with Nextcloud, but I don't see why it wouldn't be possible.
do I need to setup a different server within a jail if I want to use ONLYOFFICE app in nextcloud? If so, is there any guide for this?
It would need to be a separate server, but I believe it would need to run on Linux (and therefore it would be a VM rather than a jail). Here are the only instructions I know of:
 
Last edited:
  • Like
Reactions: T_T

T_T

Member
Joined
Jul 24, 2018
Messages
56
So when I type in the address of my nextcloud "example.us" it will only work on chrome, if I use other browsers I have to type https://example.us.
What happens on the other browsers if you don't add "https://"?

It just show a blank page or "INET_E_RESOURCE_NOT_FOUND" on internet explorer or when I try to use my phone and type in safari. I get a message saying "safari could not open the page because the server stopped responding"

I wanted to just type in the address bar on any browser example.us and then it will automatically redirect or put the https:// in front of my address. I also noticed I don't have a problem with this when I'm connect to the same wifi at home.



But how do I know if it's renewed
After 60+ days, browse to your Nextcloud installation and check the certificate--exactly how you'd do that varies from browser to browser, but you'd generally start by clicking on the padlock. It will show the validity period. If that shows the cert has been renewed (i.e., if the start date is much later than today), you're good.

As another possibility, sign up for certificate transparency notifications, e.g., with Facebook or Cloudflare. See:
Certificate Transparency Monitoring - Facebook for Developers

developers.facebook.com
developers.facebook.com
https://developers.cloudflare.com/ssl/certificate-transparency-monitoring

They'll email you to let you know when a new cert is issued for your domain.


So right now, mine actually valid from 7/11 to 10/9. Do I have to wait until after 10/9 to do that or you are saying that after 60 days validation date will change by something magical?

I will have to edit the host file on each PC which I did.
Really, you want whatever device is serving DNS for your LAN (typically your Internet router) to do this--hand-editing the hosts file works, but it's a klunky way to do it. If you can't do this on your router, consider setting up Pi-Hole (which will have other benefits as well). But no, my configuration really isn't designed to work using the IP address.

I did some reading prior to asking the question and found out that my router is not compatible. That's why I go with the editing the host file route but could never get it to work. I just want to make sure that if there is something wrong with my domain name and I can't access nextcloud then internal IP address might be a way for me to go. I don't really know if I should be concern about this!

I saw it RAM usage was almost the entire 32 GB that I have installed. Is this normal?
Pretty much; I expect you'll see the same in your TrueNAS web UI. You have the RAM, might as well use it.
I did indeed saw the same on my FreeNAS web UI but only when I access my nextcloud. otherwise it's sitting at idle. I didn't think it would use the entire 32 GB of RAM I got in there. Should I be concern if I plan on running virtual machines and other stuff on there in the future?

PHP also tell me that upload size is limited
Do you intend to upload files larger than 16 GB? Even if so, I don't expect this to be a problem because of the way Nextcloud handles files.
I do planning on upload files that are larger than 16 and they are 1 big single file. I will try and see how it goes.

I have created several SMB share and wanted to move file between users by just drag and drop on my window PC once my mapped the drive. Is this even possible?
What you're describing here doesn't sound like it has anything to do with Nextcloud, but I don't see why it wouldn't be possible.
If when I map the drive with the picture I uploaded from my pool structure. I was able to access the nextcloud folder, and subfolder such as db, config, and themes but I cannot access the "files" folder. I know for sure this has to do with the permission. It's just really confusing as to how I would set up all the permission. Any suggestion on getting this sort out?

do I need to setup a different server within a jail if I want to use ONLYOFFICE app in nextcloud? If so, is there any guide for this?
It would need to be a separate server, but I believe it would need to run on Linux (and therefore it would be a VM rather than a jail). Here are the only instructions I know of:

I think there is another app called collaboration or something. Is this something that will also need to be run from a Linux base? and If I decide to go with that route, will my system be able to handle this since the RAM is almost used up as I previously mentioned?
 
Last edited:

Patrick M. Hausen

Wizened Sage
Joined
Nov 25, 2013
Messages
4,038
Collabora and OnlyOffice both need a Linux VM to run. 4 GB is enough in ny experience. The easiest way is to use docker-compose for deployment.
 
  • Like
Reactions: T_T

gt2416

Senior Member
Joined
Feb 4, 2018
Messages
253
  • Like
Reactions: T_T
Top