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

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

listhor

Member
Joined
Mar 2, 2020
Messages
74
I have few other services running already behind Nginx and that's why I want it for Nextcloud as well. To make sure myself, there's nothing more to change except in config.php, like Caddyfile? And I wonder why changing 'overwrite.cli.url' to new url causes server error?
 

Basil Hendroff

Neophyte Sage
Joined
Jan 4, 2014
Messages
1,219
I have few other services running already behind Nginx and that's why I want it for Nextcloud as well. To make sure myself, there's nothing more to change except in config.php, like Caddyfile?
I use danb35's Nextcloud resource with the NO_CERT option behind a Caddy reverse proxy. It works well. You shouldn't have to modify the Caddyfile. Here's a redacted copy of my config.php for comparison:

Code:
<?php
$CONFIG = array (
  'passwordsalt' => 'REDACTED',
  'secret' => 'REDACTED',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => 'cloud.mydomain.com',
    2 => '10.1.1.29',
  ),
  'datadirectory' => '/mnt/files',
  'dbtype' => 'mysql',
  'version' => '19.0.1.1',
  'overwrite.cli.url' => 'http://cloud.mydomain.com/',
  'overwriteprotocol' => 'https',
  'overwritehost' => 'cloud.mydomain.com',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:/tmp/mysql.sock',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'REDACTED',
  'installed' => true,
  'instanceid' => 'ocosbn1u1n1h',
  'logtimezone' => 'Australia/Perth',
  'log_type' => 'file',
  'logfile' => '/var/log/nextcloud.log',
  'loglevel' => '2',
  'logrotate_size' => '104847600',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
  ),
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'htaccess.RewriteBase' => '/',
);


There are a couple of gotcha's to be aware of. If testing the Nextcloud jail using HTTP, a couple of parameters need to tweaked. When placed behind the reverse proxy, those parameters need to be retweaked. For more info, refer to steps 1 and 2 in the resource Nextcloud and OnlyOffice Integration
 

listhor

Member
Joined
Mar 2, 2020
Messages
74
Thanks @Basil Hendroff I've done exactly same changes and it doesn't work unfortunately. It must be something related to the way how either Nextcloud or Caddy had been configured during installation vs Nginx or that Nextcloud was installed under local domain and I want to change it to LE SSL domain.
As it is test instance of Nextcloud, I will reinstall it under LE domain and see how it goes...
 

listhor

Member
Joined
Mar 2, 2020
Messages
74
As it is test instance of Nextcloud, I will reinstall it under LE domain and see how it goes...
After reinstalling Nextcloud using LE domain and NO_CERT variable plus changing only 'overwriteprotocol' => 'http', to 'overwriteprotocol' => 'https' plus adding proxy IP to 'trusted_domains', reverse proxy finally WORKS! :smile:
And I've lost so many hours to figure it out, haha!
BTW, is domain name saved in database or other config files?
 
Last edited:

Basil Hendroff

Neophyte Sage
Joined
Jan 4, 2014
Messages
1,219
BTW, is domain name saved in database or other config files?
I'm not sure I follow. Are you referring to the HOST_NAME option in the script config file?
 

listhor

Member
Joined
Mar 2, 2020
Messages
74
I'm not sure I follow. Are you referring to the HOST_NAME option in the script config file?
Yes, I’m. Reason I’m asking is that with different Host name set when installing Nextcloud, Nginx proxy didn’t work with new host name. Of course config.php was updated with new name...
 

Basil Hendroff

Neophyte Sage
Joined
Jan 4, 2014
Messages
1,219
Yes, I’m. Reason I’m asking is that with different Host name set when installing Nextcloud, Nginx proxy didn’t work with new host name. Of course config.php was updated with new name...
Apart from config.php, HOST_NAME is also referred to in the webserver Caddyfile. Assuming your Nextcloud jail is named nextcloud, enter the jail iocage console nextcloud and have a look at the Caddyfile cd /usr/local/www && ee Caddyfile.
 

listhor

Member
Joined
Mar 2, 2020
Messages
74
Apart from config.php, HOST_NAME is also referred to in the webserver Caddyfile. Assuming your Nextcloud jail is named nextcloud, enter the jail iocage console nextcloud and have a look at the Caddyfile cd /usr/local/www && ee Caddyfile.
Thanks for help. Later on I will change host name of current test instance to verify whether I can do it without reinstallation.

My current "production" instance of Nextcloud was installed as version 18 and over time, upgraded to 19. Unfortunately it has become very slow - page loads almost 30s. Do you know anything about not using built-in upgrader? That's a reason why I'm establishing new instance of Nextcloud...
And what is a correct way of migrating only users' data (not config/settings) between Nextcloud jails?
 

Basil Hendroff

Neophyte Sage
Joined
Jan 4, 2014
Messages
1,219

listhor

Member
Joined
Mar 2, 2020
Messages
74
Yes, I remember that but still there's a problem of moving only data to new Nextcloud instance. If I migrate old DB dump to newer one it's like either undoing upgrade or ending up with a lot of errors... Or I'm wrong here? If Nextcloud doesn't have smooth update process than it's better to look for something more reliable.

EDIT:
So far I've migrated users' data following way:
- switch Nextcloud to maintenance mode: su -m www -c 'php /usr/local/www/nextcloud/occ maintenance:mode --on'
- copy data between mounted datasets (content of users' files folders)
- switch off maintenance mode: su -m www -c 'php /usr/local/www/nextcloud/occ maintenance:mode --off'
- rescan new data: su -m www -c 'php /usr/local/www/nextcloud/occ files:scan --all'
Code:
Starting scan for user 1 out of 5 (admin)
Starting scan for user 2 out of 5 (xxx)
Starting scan for user 3 out of 5 (xxx)
Starting scan for user 4 out of 5 (xxx)
Starting scan for user 5 out of 5 (xxx)
+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 9720    | 53932 | 00:00:53     |
+---------+-------+--------------+


I'm not sure of final outcome, I need some more time to verify permissions and so on...
 
Last edited:

listhor

Member
Joined
Mar 2, 2020
Messages
74
It's like never ending story... Everything been working in test instance (including Onlyoffice). I did remove its jail, datasets and recreate everything from scratch. All works fine but I can't connect to any instance of Onlyoffice - through proxy, directly and public one. In all cases I receive "Error while downloading the document file to be converted". I 've tried with and without SSL, wget worked from jail to Onlyoffice and opposite way. I removed Nextcloud jail and datasets and installed all over and it's still the same. I've run out of ideas...

EDIT:
It seems like that I needed to install Onlyoffice connector with already added "trusted_proxies" in config.php. Adding afterwards didn't help. Now it works...
 
Last edited:

Basil Hendroff

Neophyte Sage
Joined
Jan 4, 2014
Messages
1,219
All works fine but I can't connect to any instance of Onlyoffice - through proxy, directly and public one. In all cases I receive "Error while downloading the document file to be converted".
You may want to shift this to the discussion area for the Nextcloud and OnlyOffice Integration resource. There are checks at each of the six steps described in that resource. You should not proceed to the next step until the current step checks out. I suggest you work through each of those steps until you identify the step that's failing; then troubleshoot that step.
 

listhor

Member
Joined
Mar 2, 2020
Messages
74
You may want to shift this to the discussion area for the Nextcloud and OnlyOffice Integration resource. There are checks at each of the six steps described in that resource. You should not proceed to the next step until the current step checks out. I suggest you work through each of those steps until you identify the step that's failing; then troubleshoot that step.
Yes, I may want :cool:, thanks I wasn't aware of it.
One question, I've mounted a few datasets to Nextcloud jail to be used as local external storage (using plugin app). Is it enough that user 'www' belongs to these datasets' group or must be datasets' owner?
 

Basil Hendroff

Neophyte Sage
Joined
Jan 4, 2014
Messages
1,219
Is it enough that user 'www' belongs to these datasets' group or must be datasets' owner?
I've only used SMB external storage. Authentication is via username and password.
screenshot.566.png
 

tebra

Junior Member
Joined
Feb 29, 2020
Messages
17
Hello community,
I have a problem with the renew of my "Let’s Encrypt certificate".
The caddy.log and Caddyfile files are attached to this post.
Any help? Any other information I need to provide ?
Caddy v1.0.4
 

Attachments

Last edited:

deltavlokkies

Neophyte
Joined
Apr 18, 2016
Messages
11
I tried to install it, but >
This site can’t be reached


"
JAIL_IP="192.168.168.4"
DEFAULT_GW_IP="192.168.178.1"
POOL_PATH="/mnt/vlokbox"
TIME_ZONE="America/New_York"
HOST_NAME="cloud.vlokkiebox.nl"
STANDALONE_CERT=1
"

Not sure what i'm doing wrong here
 

Basil Hendroff

Neophyte Sage
Joined
Jan 4, 2014
Messages
1,219
Last edited:

deltavlokkies

Neophyte
Joined
Apr 18, 2016
Messages
11
You've met all the Prerequisites (Let's Encrypt) in the README?
I only did the git clone and run the install script

I didn't quite get the Prerequisites ..

So if someone could help me with a more beginner friendly tutorial or readme. That would be amazikg
 
Last edited:

NasKar

Neophyte Sage
Joined
Jan 8, 2016
Messages
655
I only did the git clone and run the install script

I didn't quite get the Prerequisites ..

So if someone could help me with a more beginner friendly tutorial or readme. That would be amazikg
Your IP and gateway are on different subnets. My guess is the gateway should be 192.168.168.1
 
Top