Fork of Nextcloud installation script using nginx

NasKar

Guru
Joined
Jan 8, 2016
Messages
739
I've adjusted the Nextcloud installation script written by @danb35 to follow the excellent instructions from @Joshua Parker Ruehlig. I wanted to use nginx instead of apache. My version of the script will give you a basic iocage installation of nextcloud (latest version), using mariadb, php-fpm, and nginx. I have ssl included directions in the Readme file. I've learned a lot from members of these forums and hope that his would be helpful to people new to freenas that are having trouble getting nextcloud running.

https://github.com/NasKar2/freenas-iocage-nextcloud

As a disclaimer this was my first attempt at uploading to github. Thanks again to danb35 and Joshua Parker Ruehlig.

Add scripts to automatically backup and restore nextcloud
 
Last edited:

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
Has this disappeared? Was going to give this a shot on 11.1-U4 but getting a 404 error :(
 

NasKar

Guru
Joined
Jan 8, 2016
Messages
739
Has this disappeared? Was going to give this a shot on 11.1-U4 but getting a 404 error :(
I fixed the link in the original post. Let me know if the the script works for you.
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
Thanks. I'll take a look at some point, but I ended up building the jail from the @Joshua guide as (a) i'd used it before and know it works, and (b) I didn't want the SSL stuff as I'm dealing with that in another reverse-proxy jail.
 

NasKar

Guru
Joined
Jan 8, 2016
Messages
739
I didn't want the SSL stuff as I'm dealing with that in another reverse-proxy jail.
I've been thinking about doing a reverse proxy jail as detailed in this thread . It's a new concept for me. Would it allow me to have multiple web servers on one dynamic IP address?

For example:
Open port 443 and 80 in my router and forward them to the reverse proxy jail.
The reverse proxy would send to https://myIP/nextcloud or https://myIP/wordpress?
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
Would it allow me to have multiple web servers on one dynamic IP address?
Yes, that's what I use mine for. You would be better off with a static public IP if you can get one.
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
Mine is using a static IP, but it works as you described. All traffic on port 80 and 443 is forwarded to the reverse-proxy jail which then redirects each service to the appropriate jail. It's a much cleaner way of dealing with SSL as they can all be managed in the reverse-proxy jail and a cron task to trigger Certbot every few days.
 

NasKar

Guru
Joined
Jan 8, 2016
Messages
739
Added scripts to the install that automate backing up an restoring the nextcloud files and database. They are located in the /usr directory of the jail. Read the contents of the scripts for directions.
 

luckyal

Dabbler
Joined
Aug 4, 2017
Messages
32
I've adjusted the Nextcloud installation script written by @danb35 to follow the excellent instructions from @Joshua Parker Ruehlig. I wanted to use nginx instead of apache. My version of the script will give you a basic iocage installation of nextcloud (latest version), using mariadb, php-fpm, and nginx. I have ssl included directions in the Readme file. I've learned a lot from members of these forums and hope that his would be helpful to people new to freenas that are having trouble getting nextcloud running.

https://github.com/NasKar2/freenas-iocage-nextcloud

As a disclaimer this was my first attempt at uploading to github. Thanks again to danb35 and Joshua Parker Ruehlig.

Add scripts to automatically backup and restore nextcloud
I've spent the last two days trying to follow your instructions exactly as written. At first I was getting this error:

./nextcloud-jail.sh: Command not found

What's interesting is that after running the ls command from within the directory where I ran git clone https://github.com/NasKar2/freenas-iocage-nextcloud.git, I can see nextcloud-jail.sh listed as one of the items present.

I re-read the instructions and decided to implement the steps outlined below the following statement

"It is known to NOT work on 11.1-U3 or 11.1-U4 out of the box."

These two commands work without issues (first one is obvious):
cd /tmp
git clone --recursive https://github.com/iocage/iocage

After running the last command:
cp -R iocage/iocage/lib/ /usr/local/lib/python3.6/site-packages/iocage/lib

...I get the following error:
cp: iocage/iocage/lib/: Not a directory

Full disclosure: I am running FreeNAS-11.1-U6

I would appreciate any help or guidance you can provide.
 

NasKar

Guru
Joined
Jan 8, 2016
Messages
739
./nextcloud-jail.sh: Command not found
Make sure the execute flag is on for the nextcloud-jail.sh file. chmod +x nextcloud-jail.sh then try to run it again.
 

luckyal

Dabbler
Joined
Aug 4, 2017
Messages
32
Make sure the execute flag is on for the nextcloud-jail.sh file. chmod +x nextcloud-jail.sh then try to run it again.
Just did. Results in the following error:

17: Syntax error: Unterminated quoted string
 

NasKar

Guru
Joined
Jan 8, 2016
Messages
739
Just did. Results in the following error:

17: Syntax error: Unterminated quoted string
Are any of the lines in your nextcloud-config file missing the second quote?
 

luckyal

Dabbler
Joined
Aug 4, 2017
Messages
32
Are any of the lines in your nextcloud-config file missing the second quote?
I don't think so. Although I notice that some quotes look different than others (the actual characters)

Here's the output of my nextcloud-config file:
Code:
JAIL_IP=“10.0.2.202” #ip address of iocage jail
DEFAULT_GW_IP=“10.0.2.1”
INTERFACE="em1"
VNET="off"
POOL_PATH="/mnt/skippyVol” #your pool
JAIL_NAME="nextcloud" #name of iocage jail to be created
TIME_ZONE="America/Los_Angeles” # See http://php.net/manual/en/timezones.php
HOST_NAME=“skippy.triton.com”
STANDALONE_CERT=1
DNS_CERT=0
TEST_CERT="--staging"
C_NAME="US"
ST_NAME=“WA”
L_NAME=“Vancouver”
O_NAME="FreeNAS"
OU_NAME="FreeNAS_IT"
EMAIL_NAME=“skippy@gmail.com"
 

luckyal

Dabbler
Joined
Aug 4, 2017
Messages
32
I think I got it. I had originally used copy/paste from your instructions on GitHub into macOS TextEdit tool. Then, as I was editing, some of the trailing quotes I deleted and re-typed after typing in my specific details. I probably should have stripped all formatting as I copied from the website. Thanks for pointing me in the right direction @NasKar
 

luckyal

Dabbler
Joined
Aug 4, 2017
Messages
32
So looks like it installed. Only problem is - I don't see the jail listed alongside my plex jail. Was I supposed to change my Jail Root somehow?
 

NasKar

Guru
Joined
Jan 8, 2016
Messages
739
So looks like it installed. Only problem is - I don't see the jail listed alongside my plex jail. Was I supposed to change my Jail Root somehow?
Glad it worked. Not sure how you installed plex so I can't say. If you do iocage list it should show the nextcloud jail.
 

luckyal

Dabbler
Joined
Aug 4, 2017
Messages
32
Glad it worked. Not sure how you installed plex so I can't say. If you do iocage list it should show the nextcloud jail.
It does show it inside the shell, but it's nowhere to be found within the web interface under Jails.
 

NasKar

Guru
Joined
Jan 8, 2016
Messages
739
It does show it inside the shell, but it's nowhere to be found within the web interface under Jails.
I believe your current version of FN 11.1 U6 only shows the warden jails in the GUI. If there is an option when you logon to use the new beta UI. It will show the iocage jails in the GUI.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
chmod +x nextcloud-jail.sh
Just FYI, you can set the +x bit in your git repo so that when users clone it, the script will already be executable.
 

NasKar

Guru
Joined
Jan 8, 2016
Messages
739
Just FYI, you can set the +x bit in your git repo so that when users clone it, the script will already be executable.
I did a git clone of the repo to a temp directory and the +x bit is set. Don't know why it wasn't when luckyal did it.
 
Top