Resource icon

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

bnorman93

Dabbler
Joined
May 3, 2022
Messages
17
Nice script danb! I am having some issues though, on my side connecting to the dynamic dns url I keep getting a error that says “dangerous” at the top but the certificate is valid. Also, I’m having issues trying to put a different certificate on the correct directory on the ip address for the site instead of the dynamic address. Also, the caddy restart command isn’t doing anything for me for some reason it just says either info or command not found in the directory for caddy file… thanks for any help with this issue!
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
thanks for any help with this issue!
I'm afraid there isn't much I can do without exact error messages and exactly what you did to get them. But the command to restart Caddy does need to be run in the jail.
 

bnorman93

Dabbler
Joined
May 3, 2022
Messages
17
image.jpg
 

bnorman93

Dabbler
Joined
May 3, 2022
Messages
17
image.jpg
I can’t access the ip range on the local ip it’s says this, I seen where someone else was having this issue but they Resolved it I tried to message them but no reply yet
 

Attachments

  • image.jpg
    image.jpg
    189.4 KB · Views: 77

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
I'm sure my chiropractor will appreciate the crick in my neck from trying to read the sideways image. But the "this site is deceptive" generally means your domain name is listed in the Google Safe Browsing list as unsafe.

As to reaching your site by IP address, that isn't expected to work; it needs to be by name.
 

bnorman93

Dabbler
Joined
May 3, 2022
Messages
17
I'm sure my chiropractor will appreciate the crick in my neck from trying to read the sideways image. But the "this site is deceptive" generally means your domain name is listed in the Google Safe Browsing list as unsafe.

As to reaching your site by IP address, that isn't expected to work; it needs to be by name.
Sorry my phone rotated them for some reason and I was trying to mount the volume locally is the only reason I tried to use the ip couldn’t get WebDAV or others to work for me for some reason. I can’t find the config files neither like Nginx has I tried looking in Apache directory but still no success trying to get rid of the “dangerous” thing in the top bar but I have to edit a file that makes the webpage but I can’t find it.. it’s also not allowing me to turn on server side encryption you can click it but the button doesn’t do anything
 
Last edited:

GeorgiT

Cadet
Joined
Apr 7, 2023
Messages
4
Creating the Nextcloud database failed, which caused the installation failure (which resulted in the screen you saw, rather than a normal login page). There should still be something further up--i.e., earlier--in the log file indicating what went wrong with the database.
a couple more data points

1. the Nextcloud plugin in TNCore brings up the app as expected (ducking low)

2. The other DATABASE option pgsql also fails for me
Screen Shot 2023-04-20 at 4.08.47 PM.png

Screen Shot 2023-04-20 at 4.09.15 PM.png

so once the script enters that section - line 456+, it breaks for me. I can't see anything flagging before that.
 
Joined
Jun 22, 2021
Messages
7
Hey, @danb35, I'm having a bit of trouble with the nextcloud script.

Script spits out error like:
Code:
+ iocage create --name nextcloud -p /tmp/pkg.json -r 13.1-RELEASE 'interfaces=v>
Default mac_prefix specified in defaults.json 'ac1f6b' is invalid. Using 'ae1f6>
nextcloud successfully created!

Testing Host DNS response to pkg.freebsd.org
DNS Exception: A DNS label is empty.
pkg.freebsd.org could not be reached via DNS, check your network
+ echo 'Failed to create jail'
Failed to create jail
+ exit 1

Command exit status: 1


As is apparent in the log, the nextcloud jail was actually created successfully.
When I go to the Jails tab in the TrueNAS UI, it's there and up with full network access.

I tried fiddling with my host network config, but nothing helped get me past the DNS error.
DHCP on/off, NAT on/off, VNET on/off, BPF on/off made no difference.
With DHCP off, manually setting various valid configs made no difference.

Since the jails created by the script have network access,
can ping other local machines and www addresses just fine,
and can definitely ping pkg.freebsd.org without issue,
I tried to dig deeper, however, pkg was not initialized in the jails.

Looking at your script, it obviously relies on the -p pkg.json flag of iocage create,
which leads me to believe pkg SHOULD be initialized?

I think it has to do with iocage create, either failing to init pkg,
or import dns.resolver, which is where I tracked the DNS Exception: A DNS label is empty. error to?

Any insight would be appreciated, been using your scripts for years.
You're like the Batman of the TrueNAS Gothamite.
 
Last edited:

victort

Guru
Joined
Dec 31, 2021
Messages
973
Hey, @danb35, I'm having a bit of trouble with the nextcloud script.

Script spits out error like:
Code:
+ iocage create --name nextcloud -p /tmp/pkg.json -r 13.1-RELEASE 'interfaces=v>
Default mac_prefix specified in defaults.json 'ac1f6b' is invalid. Using 'ae1f6>
nextcloud successfully created!

Testing Host DNS response to pkg.freebsd.org
DNS Exception: A DNS label is empty.
pkg.freebsd.org could not be reached via DNS, check your network
+ echo 'Failed to create jail'
Failed to create jail
+ exit 1

Command exit status: 1


As is apparent in the log, the nextcloud jail was actually created successfully.
When I go to the Jails tab in the TrueNAS UI, it's there and up with full network access.

I tried fiddling with my host network config, but nothing helped get me past the DNS error.
DHCP on/off, NAT on/off, VNET on/off, BPF on/off made no difference.
With DHCP off, manually setting various valid configs made no difference.

Since the jails created by the script have network access,
can ping other local machines and www addresses just fine,
and can definitely ping pkg.freebsd.org without issue,
I tried to dig deeper, however, pkg was not initialized in the jails.

Looking at your script, it obviously relies on the -p pkg.json flag of iocage create,
which leads me to believe pkg SHOULD be initialized?

I think it has to do with iocage create, either failing to init pkg,
or import dns.resolver, which is where I tracked the DNS Exception: A DNS label is empty. error to?

Any insight would be appreciated, been using your scripts for years.
You're like the Batman of the TrueNAS Gothamite.
What does your nextcloud-config file look like?
 
Joined
Jun 22, 2021
Messages
7
What does your nextcloud-config file look like?

nextcloud-config:
Code:
JAIL_IP="10.0.0.N" # N redacted
DEFAULT_GW_IP="10.0.0.1"
POOL_PATH="/mnt/Storage"
TIME_ZONE="America/Los_Angeles"
HOST_NAME="nextcloud.mydomain.com" # mydomain redacted
SELFSIGNED_CERT=1


Have tried with 'NO_CERT=1' as well.
I intend to import my wildcard LE cert from my host with a read-only mount point after I get the jail up.
 
Joined
Jun 22, 2021
Messages
7
Are your host network settings properly configured?

Gateway
DNS server

Right before you posted, I got the bright idea to:
Code:
root@truenas[~]# python
>>> import dns.resolver
>>> dns.resolver.query('pkg.freebsd.org')
...
...
File "/usr/local/lib/python3.9/site-packages/dns/name.py", line 852, in from_unicode
    raise EmptyLabel
dns.name.EmptyLabel: A DNS label is empty.
>>> exit()


but I don't understand why dig works fine from the host:
Code:
root@truenas[~]# dig pkg.freebsd.org

; <<>> DiG 9.16.23 <<>> pkg.freebsd.org
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 55667
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;pkg.freebsd.org.               IN      A

;; ANSWER SECTION:
pkg.freebsd.org.        251     IN      CNAME   pkgmir.geo.freebsd.org.
pkgmir.geo.freebsd.org. 101     IN      A       204.15.11.66

;; Query time: 13 msec
;; SERVER: 1.1.1.1#53(1.1.1.1)
;; WHEN: Sat Apr 22 12:56:21 PDT 2023
;; MSG SIZE  rcvd: 85

root@truenas[~]#


and nslookup is fine too:
Code:
#root@truenas[~]# nslookup pkg.freebsd.org
Server:         1.1.1.1
Address:        1.1.1.1#53

Non-authoritative answer:
pkg.freebsd.org canonical name = pkgmir.geo.freebsd.org.
Name:   pkgmir.geo.freebsd.org
Address: 204.15.11.66
Name:   pkgmir.geo.freebsd.org
Address: 2620:11c:5001:1099:1337::3

root@truenas[~]#


I'm actually accessing the TrueNAS host remotely via OpenVPN.
Regardless, the host seems to resolve just fine for everything else.
Is it a python dependency thing?

Edit: What gives?

Code:
root@truenas[~]# python
Python 3.9.14 (main, Feb 27 2023, 21:27:08)
[Clang 13.0.0 (git@github.com:llvm/llvm-project.git llvmorg-13.0.0-0-gd7b669b3aon freebsd13
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> socket.gethostbyname('pkg.freebsd.org')
'204.15.11.66'
root@truenas[~]#
 
Last edited:
Joined
Jun 22, 2021
Messages
7
I have little experience with python…

Maybe @danb35 can answer that.
The OpenVPN throws something into the mix that I haven’t combined with TrueNAS before.
I appreciate your effort @victort.

This stack overflow post helped me figure it out.
I had '.local', '.lan', '.localdomain', and '.home' set under 'Network > Global Configuration' as Additional Domains.
Essentially, /etc/resolv.conf.

Turns out, dnspython splits on the '.' and declares the preceeding empty space an "empty label".

Removed them, all is good.
@danb35's script is flawless.
 

waynemer

Cadet
Joined
Apr 18, 2023
Messages
5
I'm pretty new to all this but I'm stuck. I have gotten the script to run successfully but nothing happens when I go to my domain name as it says to do at the end of the log. I think I'm missing something in the Cloudflare setup? How do I make my domain point to my Nextcloud?

My config file looks like this:
Code:
JAIL_IP="<random IP I chose for the jail>"
DEFAULT_GW_IP="<my gateway IP> "
POOL_PATH="/mnt/data"
TIME_ZONE="America/Chicago"
HOST_NAME="<www.example.com>"
DNS_CERT=1
DNS_PLUGIN="cloudflare"
DNS_TOKEN="<the API token I made in Cloudlfare>"
CERT_EMAIL="<my email address>"
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
I think I'm missing something in the Cloudflare setup? How do I make my domain point to my Nextcloud?
As noted in the README:
Also, HOST_NAME needs to resolve to your jail from inside your network. You'll probably need to configure this on your router, or on whatever other device provides DNS for your LAN. If you're unable to do so, you can edit the hosts file on your client computers to achieve this result, but consider installing something like Pi-Hole to give you control over your DNS.
This is all about your local DNS, not about Cloudflare.
 
Last edited:

bnorman93

Dabbler
Joined
May 3, 2022
Messages
17
Is there a way to access the jail through ip I can’t find the config file and feel like my transfer speed would be better if I did it that way.. I tried to do the scp method but couldn’t find the file they were trying to use to scan the drive for nextcloud to add the files to nextcloud it was like “occ” with a scan command but it keeps failing.. thanks for the help in advance!
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Is there a way to access the jail through ip I can’t find the config file and feel like my transfer speed would be better if I did it that way
Why would you think that? If the hostname resolved to your jail IP address within your network, as it should, this would have no effect on performance. If it doesn't, that's what you need to fix.

If you're looking for the Nextcloud config file, it's going to be in /usr/local/www/nextcloud/config/; the web server config file is in /usr/local/www/Caddyfile
I tried to do the scp method but couldn’t find the file they were trying to use to scan the drive for nextcloud to add the files to nextcloud it was like “occ” with a scan command but it keeps failing
I have no idea what this has to do with your question.
 

bnorman93

Dabbler
Joined
May 3, 2022
Messages
17
I’m trying to transfer files through scp to the nextcloud data directory and to get them to show I use this “sudo -u www-data php occ files:scan user” but it fails to run saying it can’t find occ even when I point the directory of occ into the command to run.
The other part I have upgraded to a 10gbe intel nic and I’m still only getting 35mbps on data transfer so I but seems really slow to me with nvme and 16 gb ram and nvme drives and a i5 6core.The trace is back to my server so we’re good there.
Thank you for location directory of those files!
 
Last edited:
Top