Resource icon

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

Joined
Jan 4, 2014
Messages
1,644
@profzelonka Let's have a look at your config file, but remember to redact any sensitive information.
 

profzelonka

Explorer
Joined
Mar 29, 2020
Messages
67
@profzelonka Let's have a look at your config file, but remember to redact any sensitive information.
JAIL_NAME="cloud"
JAIL_IP="xx.xx.25.26"
DEFAULT_GW_IP="xx.xx.25.1"
POOL_PATH="/mnt/ssd"
TIME_ZONE="America/Los_Angeles"
HOST_NAME="subdomain.domain.com"
STANDALONE_CERT=1
CERT_EMAIL="me@domain.com"
DB_PATH="$POOL_PATH/nextcloud/db"
FILES_PATH="$POOL_PATH/nextcloud/files"

Can I install it on a subdomain setup?
 
Joined
Jan 4, 2014
Messages
1,644
What do you see when you access the jail via its IP address?

When you look under /mnt/ssd, you should see a nextcloud directory. Under that, you should see four directories: db, files, portsnap, config. Can you confirm?
 

profzelonka

Explorer
Joined
Mar 29, 2020
Messages
67
Accessing the jail IP via browser takes about 3 seconds then goes to "Unable to connect" firefox error (attached).

I just reran it cleanly again this time without specifying db/files paths, I'm only seeing config and db under mnt/ssd/nextcloud.

ssd/iocage/jails/cloud/root/mnt contains files and includes.
ssd/iocage/jails/cloud/root/usr/local contains:
bin include libdata man sbin var
etc lib libexec openssl share www
 
Joined
Jan 4, 2014
Messages
1,644

profzelonka

Explorer
Joined
Mar 29, 2020
Messages
67
I also ran it as just my domain without the subdomain, same results. I should note that my domain name is already being used by a cpanel on a separate external server that isn't mine (a shared web host service). Not sure how this would cause me from not even seeing nextcloud under the ip tho..

I ran it again with the same config as above. (but pool name is now SSDs)

Under mnt/SSDs: iocage, nextcloud, portsnap
Within that nextcloud dir: config, db, files

No portsnap folder there... :(

Here's my steps:
1. Navigate UI to shell
2. git clone https://github.com/danb35/freenas-iocage-nextcloud
3. cd into dir, create config file with config, save
4. Create pool: 2 ssds in same pool but seperate Data VDevs (if it matters)
5. vertical dots button on my SSDs pool, add Dataset: nextcloud
6. vertical dots button on nextcloud, add Dataset: files
7. vertical dots button on nextcloud, add Dataset: db, advanced mode, change to 16 KB
8. back to UI shell: zfs set primarycache=metadata SSDs/nextcloud/db
9. ./nextcloud-jail.sh
10. Once done, go to jail IP, observe this time attached webpage lol
 

Attachments

  • Capture.PNG
    Capture.PNG
    42.1 KB · Views: 242
Joined
Jan 4, 2014
Messages
1,644
No portsnap folder there... :(
It is there...under the pool root. My suggestion for a clean install. Create the nested datasets db, portsnap, files, config under the parent dataset nextcloud. Remember to adjust the characteristic of the db dataset. In the script config file, explicitly specify locations for all the nested datasets eg. PORTS_PATH="/mnt/SSDs/nextcloud/portsnap" etc. Rerun the script. Make sure there are no errors. Check the nested datasets.
 
Joined
Jan 4, 2014
Messages
1,644

profzelonka

Explorer
Joined
Mar 29, 2020
Messages
67
Good idea! And something worked for a second! I got a white page with "404 page not found" in the top left corner. Refreshed, got it instanly again. Refreshed again, and now I'm back to getting the "unable to connect" page..

Btw, you have remembered to open ports 80 and 443 from the internet to your jail before running the script?
Yup! 80 and 443 pointed at jail IP. Got DDNS setup for the subdomain too. (Hopefully it'll work) My DDNS times out btw, if it matters at all. (That is to say, I don't get "unable to connect" page but rather a "The connection has timed out".)
 
Joined
Jan 4, 2014
Messages
1,644

profzelonka

Explorer
Joined
Mar 29, 2020
Messages
67
Yes. But I'm not confident. My router is updating DuckDNS with my daily public IP (DynDNS), and on my external webhost where the domain is managed I'm using CNAME pointed at the DuckDNS subdomain. I believe this should all be correct, but I'm not confident because when I install nextcloud v17 via Plugins, I'm able to access nextcloud thru the duckdns url, however my subdomain.domain.com is somehow letting me access my freenas instead. I don't understand how, when the CNAME record, again, is point at my duckdns. (example: domain.duckdns.org)
 
Joined
Jan 4, 2014
Messages
1,644
Yes. But I'm not confident. My router is updating DuckDNS with my daily public IP (DynDNS), and on my external webhost where the domain is managed I'm using CNAME pointed at the DuckDNS subdomain. I believe this should all be correct, but I'm not confident because when I install nextcloud v17 via Plugins, I'm able to access nextcloud thru the duckdns url, however my subdomain.domain.com is somehow letting me access my freenas instead. I don't understand how, when the CNAME record, again, is point at my duckdns. (example: domain.duckdns.org)
Just forget about what's happening on the internet side for the moment. Your local DNS resolver (e.g. a capable router, pi-hole, DNSMasq, hosts file, etc) needs to resolve, on the local network, subdomain.com.au to the jail IP. For instance, I use DNSMasq and in the DNSMasq configuration file have the line address=/subdomain.domain.com/jail_IP. If you don't have a capable router, you can use local hosts file on your client device to test.
 

profzelonka

Explorer
Joined
Mar 29, 2020
Messages
67
I edited hosts and also resolv.conf, is that enough?
Doesn't look like my router has the option. (I could try setting up DNSMasq in a jail tomorrow.)
 
Joined
Jan 4, 2014
Messages
1,644
What happens when you now try to access the jail by ip address? by FQDN?
 

profzelonka

Explorer
Joined
Mar 29, 2020
Messages
67
Same :\ unable to connect. Reinstalling it last time before I go pass out (It's 230am here lol) I appreciate your help! :) Will let you know if this one will work. Thanks again!
 
Joined
Jan 4, 2014
Messages
1,644
Same :\ unable to connect. Reinstalling it last time before I go pass out (It's 230am here lol) I appreciate your help! :) Will let you know if this one will work. Thanks again!
Just make sure you've edited the hosts file on the PC you're using.
 

KevDog

Patron
Joined
Nov 26, 2016
Messages
462
Is there anyway to add to your script to use Cloudflare's other credentials Account ID/API Token Key rather than email/global API key? Since caddy obtains the LE certs on the backend I'm not sure what Caddy's capabilities are.
 
Joined
Jan 4, 2014
Messages
1,644
@danb35 I believe there may be a minor script error. I noticed that the script builds two directories db and ports in the portsnap dataset. However, the ports directory was empty.

After inspecting the script, I think these lines...

Code:
mkdir -p /mnt/iocage/jails/${JAIL_NAME}/root/var/db/portsnap
mkdir -p /mnt/iocage/jails/${JAIL_NAME}/root/mnt/files
mkdir -p /mnt/iocage/jails/${JAIL_NAME}/root/mnt/includes
mkdir -p /mnt/iocage/jails/${JAIL_NAME}/root/usr/ports


...should be changed to...

Code:
mkdir -p "${POOL_PATH}"/iocage/jails/${JAIL_NAME}/root/var/db/portsnap
mkdir -p "${POOL_PATH}"/iocage/jails/${JAIL_NAME}/root/mnt/files
mkdir -p "${POOL_PATH}"/iocage/jails/${JAIL_NAME}/root/mnt/includes
mkdir -p "${POOL_PATH}"/iocage/jails/${JAIL_NAME}/root/usr/ports


When I modified the script and tested it, the ports directory was properly populated.
 
Last edited:

profzelonka

Explorer
Joined
Mar 29, 2020
Messages
67
Following up.
Once I do step 4 (edit nginx.conf to add your FQDN) and step 5 restart the nextcloud jail, after jail boots up I can no longer access nextcloud from IP or duckdns subdomain. (Needless to say, going forward and issuing a cert from acme.sh fails since nextcloud is unreachable.) This is the exact issue I'm encountering with your script as well. Any ideas? (Can take to PMs or I can make a new thread elsewhere too.)

My setup is really simple with just a router, surely I'm not the only one who's run into this issue before... o_O
 
Top