Scripted Nextcloud jail running but no access

This was my first attempt to manual jail on CORE and I am not an expert with linux nor FreeBSD so please be gentle.
I tool a stab at danb35’s script and here what i did:
Created /mnt/Tank/Nextcloud with the 4 directories.
Addred simple config with No_CERT=1 and the jail installed with some warnings about not able to find the paths but still completed. Now I noticed two issues and I am not able to use nextcloud.

  1. The path /mnt/FarcryNAS/Nextcloud had folders with data from plugin jail that i wanted to retails. But as the installed failed to locate the path it created new directories /mnt/FarcryNAS/nextcloud instead of using /mnt/FarcryNAS/Nextcloud
  2. I use NPM with cloudflare and it works perfectly without issues for another jail. So I wanted the new jail to use the same reverse proxy and get certificated from lets encrypt from NPM. But not I cant reach the GUI as it land to the cloudflare error 503 page (service not reachable). After some reading it feel it maybe due to caddy still takign command of the jail proxies and they are not playing with NPM. How should i have chnaged the config to avoid these two problems.


Ignore the space, i wasn’t able to remove the empty lines using vi.

the log files has some lines that correspond to the above issues

/mnt/FarcryNAS/temp/freenas-iocage-nextcloud/nextcloud-config: COUNTRY_CODE:US: not found
+ DB_PATH:/mnt/FarcryNAS/Nextcloud/db
/mnt/FarcryNAS/temp/freenas-iocage-nextcloud/nextcloud-config: DB_PATH:/mnt/FarcryNAS/Nextcloud/db: not found
+ FILES_PATH:/mnt/FarcryNAS/Nextcloud/files
/mnt/FarcryNAS/temp/freenas-iocage-nextcloud/nextcloud-config: FILES_PATH:/mnt/FarcryNAS/Nextcloud/files: not found
+ CONFIG_PATH:/mnt/FarcryNAS/Nextcloud/config
/mnt/FarcryNAS/temp/freenas-iocage-nextcloud/nextcloud-config: CONFIG_PATH:/mnt/FarcryNAS/Nextcloud/config: not found
+ THEMES_PATH:/mnt/FarcryNAS/Nextcloud/themes
/mnt/FarcryNAS/temp/freenas-iocage-nextcloud/nextcloud-config: THEMES_PATH:/mnt/FarcryNAS/Nextcloud/themes: not found
+ DB_PATH=/mnt/FarcryNAS/nextcloud/db
+ [ -z '' ]
+ FILES_PATH=/mnt/FarcryNAS/nextcloud/files
+ [ -z '' ]
+ CONFIG_PATH=/mnt/FarcryNAS/nextcloud/config
+ [ -z '' ]
+ THEMES_PATH=/mnt/FarcryNAS/nextcloud/themes
+ [ -z '' ]
+ PORTS_PATH=/mnt/FarcryNAS/portsnap
+ [ /mnt/FarcryNAS/nextcloud/db '=' /mnt/FarcryNAS/nextcloud/files ]
+ [ /mnt/FarcryNAS/nextcloud/files '=' /mnt/FarcryNAS/portsnap ]
+ [ /mnt/FarcryNAS/portsnap '=' /mnt/FarcryNAS/nextcloud/db ]
+ [ /mnt/FarcryNAS/nextcloud/config '=' /mnt/FarcryNAS/nextcloud/files ]
+ [ /mnt/FarcryNAS/nextcloud/config '=' /mnt/FarcryNAS/portsnap ]
+ [ /mnt/FarcryNAS/nextcloud/config '=' /mnt/FarcryNAS/nextcloud/db ]
+ [ /mnt/FarcryNAS/nextcloud/themes '=' /mnt/FarcryNAS/portsnap ]
+ [ /mnt/FarcryNAS/nextcloud/themes '=' /mnt/FarcryNAS/nextcloud/db ]
+ [ /mnt/FarcryNAS/nextcloud/themes '=' /mnt/FarcryNAS/nextcloud/config ]
+ [ /mnt/FarcryNAS/nextcloud/db '=' /mnt/FarcryNAS ]
+ [ /mnt/FarcryNAS/nextcloud/files '=' /mnt/FarcryNAS ]
+ [ /mnt/FarcryNAS/portsnap '=' /mnt/FarcryNAS ]
+ [ /mnt/FarcryNAS/nextcloud/config '=' /mnt/FarcryNAS ]
+ [ /mnt/FarcryNAS/nextcloud/themes '=' /mnt/FarcryNAS ]
+ echo
+ cut -f1 -d/
+ IP=
+ echo
+ cut -f2 -d/
+ [ '=' ]
Warning: You have chosen to include SSL support. Applications/ports that use
the cclient library but do not support SSL may stop working or have problems
linking. Linking them explicitly with ssl (-lssl -lcrypto) may or may not help.

Is that all the logs you have? This doesn’t give us much to go on.

You should only have to set your POOL_PATH, and it will automatically pick up the datasets underneath. It isn’t really necessary to set all the other path variables.

Also you have a number of typos? Are you using /mnt/tank or /mnt/FarcryNAS?

It’s a bit unclear as to your setup.

I skimmed through the log and only added the ones where errors or warning appeared. The log file is very long with secure keys and other info,so didn’t want to paste two pages.
I followed the Config sample and added the path variables for the four directories. as /mnt/FarcryNAS. The /mnt/tank was just to match the documentation that i changed to show the correct name.
Existing data was moved in this structure that i want the script to pickup.
Also how do i pass on db password or other keys in the config to use existing db in the directory?
Do I have to use lowercase in the directory name as nextcloud instead? Are their any sample config files that i can refer to get an idea on the possible variations.

No. The names are ok. I was just making sure.

Inside the jail, run sockstat | grep caddy to see if caddy is running.

Also, if you ping your domain, does it resolve to the correct IP of your nextcloud jail?

Seems it running

root@nextcloud:~ # sockstat | grep caddy
root     caddy      25730 6  tcp4        *:*
root     caddy      25730 7  tcp46  *:80                  *:*
root     caddy      25730 8  tcp4
root@nextcloud:~ #

The ping return cloudflare IP as I use that for accessing my services. Same as my other nextcloud or other services.

Ok, good so far.

Can you visit and get to your Nextcloud?


I was using https and 443 on NPM adn now after switching it to 80 and http only. I could reach the page.

Does this mean the website is not secure even if cloudflare is using https upon redirection?

Now to fix the other directory issue and use the existing data and db. What should the config be set to.

I do have the old db password that i think can be passed on the config file to pick up the directory and accounts along with the other data.

As long as the NPM connection is secure, then the backend can be over http. The connection will still be secure.

So I’m not exactly sure how you would go about using the existing db. The problem is that the plugin used postgres, and the script used mariadb by default. You can change this in the script config before running it though.
The plugin config is just so much different than what the script uses.

You can, however, run the script overtop your existing data IF the data was created using the script.

I would recommend just copying the files over and doing a occ files:scan --all to populate your db.

Other than that, all passwords are save in /root/ of your TrueNAS system.

You could try to copy the files, database, etc to the corresponding directories and see if it will work. Let me know if you attempt this…

The main data that i have on the last nextcloud are photos and as long as the occ files:scan all can pick up the right metadata to organize the memories. I am game.

So I think I will have to create the same users to populate the data directories and then move the corresponding data to each account directories and run occ scan?
Let me attempt moving the files to the directory.

2nd question I have is I have multiple account and the data directory for those users. does this method lose all those settings for user accounts, or any other apps within nextcloud?

3rd Is there a way to access the ui from internal IP instead of redirection from local ip:80 → and failing if i want to disable public access?

The second question is something I don’t know.

The first question is a yes. If you create the users, then move each users files into the proper directories, then the scan command will work.

Ran the db scan and all the files are imported and appear to be in order. Thanks very much @victor
The last thing i want to know is how to backup and restore the scripted jail to a regular nextcloud app on Truenas scale or docker install. Is it as simple as backup db, files and config directories.

That should be all you have to do. Files, DB, and config.