Resource icon

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

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
@danb35 Just as a side note, All passwords are saved in /root/db_password.txt does not exist.
Does that file exist in your FreeNAS installation? It wouldn't be in the jail.
 

Apollo

Wizard
Joined
Jun 13, 2013
Messages
1,458
Does that file exist in your FreeNAS installation? It wouldn't be in the jail.
I thought exactly as rfanch3r did as I was convinced the file would be stored in the jail itself.

The file does indeed appear in the Freenas "/root" folder location.

One issue with this approach is that the file content is being replaced with the passwords from the last ran script.
I think it would make more sense to store it in the "db", "files" datasets of the jail or in the install location where the script is run from, this way it can be preserved and recovered from a replicated volume or dataset.
I don't think this would be too much of a security issue as the various passwords are already included in one of the PHP or Nextcloud config files.
If not, it would be nice to have the file renamed to make it unique, yet easily identifiable with the iocage jail installed.

At the moment, simply running the script more than once (ie, installing the script in different iocage jails on the same system) is enough to loose the previous passwords.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
One issue with this approach is that the file content is being replaced with the passwords from the last ran script.
True. My intent had been that the file would be saved within the jail, but the redirect wasn't working that way and I just didn't want to spend too much time figuring it out. Might need to reconsider that.
 

NasKar

Guru
Joined
Jan 8, 2016
Messages
739
True. My intent had been that the file would be saved within the jail, but the redirect wasn't working that way and I just didn't want to spend too much time figuring it out. Might need to reconsider that.
I had it name the files based on the jail name so if I ran the script again to create a 2nd nextcloud jail to experiment with it wouldn't wipe out the original.
Code:
# Save passwords for later reference
iocage exec ${JAIL_NAME} echo "MySQL root password is ${DB_ROOT_PASSWORD}" > /root/${JAIL_NAME}_db_password.txt
iocage exec ${JAIL_NAME} echo "Nextcloud database password is ${DB_PASSWORD}" >> /root/${JAIL_NAME}_db_password.txt
iocage exec ${JAIL_NAME} echo "Nextcloud Administrator password is ${ADMIN_PASSWORD}" >> /root/${JAIL_NAME}_db_password.txt
chmod 600 /root/${JAIL_NAME}_db_password.txt


danb35 does your scipt still work with 11.1 being EOL? I had to change my fork of the pkg to release_2 and comment out the lines that install pecl-redis and pecl-APCu as the ports tree won't work till ver 11.2.
 

rfanch3r

Dabbler
Joined
Aug 16, 2015
Messages
34
Does that file exist in your FreeNAS installation? It wouldn't be in the jail.

Yeah this wasn't clear to me, I figured if you were making the jail it would be placed in the jail. I never thought of looking in the root dir of freenas.
 

rfanch3r

Dabbler
Joined
Aug 16, 2015
Messages
34
True. My intent had been that the file would be saved within the jail, but the redirect wasn't working that way and I just didn't want to spend too much time figuring it out. Might need to reconsider that.

Now that I know where it's at I think you just need to change either the verbiage or the location. Might be easier to change the location to where the script was ran and print that as the output.
 

rfanch3r

Dabbler
Joined
Aug 16, 2015
Messages
34
I had it name the files based on the jail name so if I ran the script again to create a 2nd nextcloud jail to experiment with it wouldn't wipe out the original.
Code:
# Save passwords for later reference
iocage exec ${JAIL_NAME} echo "MySQL root password is ${DB_ROOT_PASSWORD}" > /root/${JAIL_NAME}_db_password.txt
iocage exec ${JAIL_NAME} echo "Nextcloud database password is ${DB_PASSWORD}" >> /root/${JAIL_NAME}_db_password.txt
iocage exec ${JAIL_NAME} echo "Nextcloud Administrator password is ${ADMIN_PASSWORD}" >> /root/${JAIL_NAME}_db_password.txt
chmod 600 /root/${JAIL_NAME}_db_password.txt


danb35 does your scipt still work with 11.1 being EOL? I had to change my fork of the pkg to release_2 and comment out the lines that install pecl-redis and pecl-APCu as the ports tree won't work till ver 11.2.

You can head over to his github and review the issue I submitted, since then I upgraded to 11.2. That's what I ran into with 11.1-U6. He mentions U3-U4 working but does not mention U6, some speculate that it does not work with that version.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Now that I know where it's at I think you just need to change either the verbiage or the location.
I guess it could be clearer, but really it should be pretty clear as it is:
  • You run the script on your FreeNAS system
  • The script gives you a path for the file
  • Wouldn't you conclude that the path is relative to the environment where you ran the script that's telling you where the file is?
But to avoid the issue of the file being overwritten, it would be simple enough to update the script to include the jail name in the file name.
 

rfanch3r

Dabbler
Joined
Aug 16, 2015
Messages
34
I've never touched HAproxy in pfSense (or elsewhere, for that matter). A simpler way to handle the (presumed) DNS issue is to enter the FQDN as a host override under Services -> DNS Resolver.

@danb35 Yeah I do not have HAproxy/pfSense installed, where would I look for Services -> DNS Resolver? Is this in my router? NextCloud? Jail? FreeNAS? I just looked in FreeNAS and while I do have Services I do not have a DNS Resolver. I have something similar on my router though (Static DNS) and I did set the IP of my Nextcloud LAN IP to nextcloud.local but that did not work.

@danb35 I apologize that you are frustrated with my inquiries, I am just as frustrated that I seem to be the only one that has these issues and no one else has or they are not following this thread with solutions. You are using vernacular I am unfamiliar with. I know what a DNS Resolver is but I do not know what it means or does within my own lan network since I never had to deal with it. In most cases I would just go to the IP and never have to come to any forum and ask but this wasn't the case in my situation.

With that said, I set my ddns host as the internal ip and I am able to get to the jail. Thank you for your assistance.
 

kwessel

Dabbler
Joined
Mar 30, 2015
Messages
44
I ran this script. I am able to logon to my dynamic FQDM from the Internet to the server. I then got this error:
Error

Error while trying to create admin user: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [2002] No such file or directory

Any suggestions?
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504

kwessel

Dabbler
Joined
Mar 30, 2015
Messages
44
Is there a log file to find the errors. I did not capture them. I am running 11.1-U6

BTW, I encountered the same issue as did rfranch3r. I can access the FQDM (acctually a dlinkddns relay) from the Internet, but when on my LAN the jail ip resolves to my pfsense router. I have been reading about use of pfsense for DNS resolver, but I not learned how to fix this problem yet.

I did capture this error:

You have obtained your Let’s Encrypt certificate using the staging server. This certificate will not be trusted by your browser and will cause SSL errors when you connect. Once you’ve verified that everything else is working correctly, you should issue a trusted certificate. To do this, run: *****
 
Last edited:

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Is there a log file to find the errors.
No, the script doesn't generate a log file--you need to keep an eye on it to track any errors. The note about the staging certificate is to be expected if you told it to get a test cert (it defaults to this unless you tell it otherwise), and wouldn't be causing this problem.

What happens if you do iocage console nextcloud and then run mysql inside the jail?
 

kwessel

Dabbler
Joined
Mar 30, 2015
Messages
44
I wiped my drives, reinstalled Freenass 11.1-U6 and ran your script again. Same result. I am not sure how to get inside the jail. No jail was created in the Freenas GUI. There are many new datasets under storage in the GUI including

iocage
download
11.1-RELEASE
images
jails
nextcloud
root
log
releases
11.1-RELEASE
root
templates

I did my best to keep track of errors while the script ran:

after php_fpm_emable: -> YES

===> Cleaning for php72-pecl-redis-4.1.1.

four different cleaning messages then

/!\ ERROR: /!\

Ports Collections support for your FreeBSD version has ended, ....

No support will be provided if you silence this message by defining ALLOW_UNSUPPORTED_SYSTEM.

*** Error code 1

Stop.
make: stopped in /usr/ports/databases/pecl-redis
True

===> Cleaning etc......

/!\ ERROR: /!\

Could not reliably determine the server's FQDN

apach24 not running? (check /var/run/httpd.pid).
[Tue Nov 20] Reload error for:
True

ERROR 2002 (HY000): Can't connect to local MYSQL server through socke '/tmp/mysql.sock' (2 "No such file or directory")
True

Repeated several times.


mysqladamin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2 "No such file or directory")'

Shared object "libdl.so.1" not found, required by "bash"
True

Repeated multiple times

Successfully removed mount from nextcloud's fstab
Installation complete!
 

Apollo

Wizard
Joined
Jun 13, 2013
Messages
1,458
Upgrade to 11.2-RC1 and you should be fine.
How many volumes do you ave on your system. If you have more than one volume with iocage jail already present it will tell you to activate only one of the volume. Not sure t is the issue though.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
I wiped my drives, reinstalled Freenass 11.1-U6 and ran your script again.
...and deleted your earlier messages. Please don't do that.
No jail was created in the Freenas GUI.
Yes, that's normal--iocage jails don't appear in the legacy GUI, though they should show in the new GUI.

The problem you're running into has been discussed a bit recently, and it relates to the fact that FreeBSD 11.1 is EOL. Upgrading to 11.2-RC should resolve the problem, though I wouldn't ordinarily want to recommend running prerelease software. There's a pull request against the script that should address this, but I haven't yet had a chance to test it before merging it.
Upgrade to 11.2-RC1 and you should be fine.
If you're going to recommend pre-release software, wouldn't you want to recommend the most recent version? 11.2-RC2 has been out for a few days now.
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194
deleted your earlier messages. Please don't do that.
Fixed. @kwessel, please use the edit button instead of deleting messages. It's easier for you and for others.
 
Top