Recreate nextcloud in iocage jail

Status
Not open for further replies.

NasKar

Guru
Joined
Jan 8, 2016
Messages
739
I have a working nextcloud in a warden jail with the database of nextcloud and want to recreate the same setup in an iocage jail including my SSL certificate from letsencrypt and my data/shares. I was able to create a nextcloud setup in an icoage jail with a new database nextcloud2.

1) Can I change the database in the iocage jail from nextcloud2 to nextcloud that alread exits ? If so any help with the mysql commands would be greatly appreciated.
2) Can I reuse the same letsencrypt ssl certificated if I copy the nginx.conf from the old jail to the new iocage jail and copy the /usr/local/etc/letsencrypt/live/.... directories or am I stuck recreating a new SSL certificate for this new iocage jail?
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977

NasKar

Guru
Joined
Jan 8, 2016
Messages
739
mysql -u root -p
mysqldump --nextcloud > /nextcloud.sql

after dumping the old database to nextcloud.sql and copied it to the new jail. I exited the old jail and
iocage console nextcloud
mysql -u root -p nextcloud2 < nextcloud.sq
After restarting
service nginx restart && service php-fpm restart && service mysql-server restart && service redis restart

the files from the old nextcloud jail don't show up in the new one.
Any idea what I did wrong?
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
The command for merging the database is source nexcloud.sql from the mysql command prompt.

You'll also have to mount the files to the same mount point in the new jail as the old jail so the database points to the correct directory.
 

NasKar

Guru
Joined
Jan 8, 2016
Messages
739
The command for merging the database is source nexcloud.sql from the mysql command prompt.

You'll also have to mount the files to the same mount point in the new jail as the old jail so the database points to the correct directory.
I have the same mount points in both jails
After running that command from the mysql cmd prompt it asks for my pw and then hesitates for a minute before the cmd prompt returns but the old data isn't there.
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
Ok you have to log in to mysql first before you run that command. mysql -u root -p and enter your database password when prompted.

Then run source nextcloud.sql. Once it completes type exit; and restart the mysql service service mysql-server restart.
 

NasKar

Guru
Joined
Jan 8, 2016
Messages
739
Ok you have to log in to mysql first before you run that command. mysql -u root -p and enter your database password when prompted.

Then run source nextcloud.sql. Once it completes type exit; and restart the mysql service service mysql-server restart.
This time I got
Code:
....Query OK, 0 rows affected (0.00 sec)

MariaDB [nextcloud]> exit
Bye
root@nextcloud:/usr/local/www # service mysql-server restart
Stopping mysql.
Waiting for PIDS: 16667.
Starting mysql.


So it seems to import but the files are not updated when running https://<jailIP>/nextcloud the files from the old jail don't show up.
Code:
 ls -l
total 6021
drwxr-xr-x  51 www   www		  65 Feb  3 16:39 nextcloud
-rw-r--r--   1 www   www	14458497 Feb  3 13:58 nextcloud.sql
lrwxr-xr-x   1 root  wheel		25 Feb  3 09:52 nginx -> /usr/local/www/nginx-dist
dr-xr-xr-x   2 root  wheel		 5 Feb  3 09:52 nginx-dist
lrwxr-xr-x   1 root  wheel		35 Feb  3 15:41 robots.txt -> /usr/local/www/nextcloud/robots.txt



I'm also noticing these errors in the /var/log/nginx/error.log file
Code:
Stack trace:
#0 /usr/local/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect()
#1 /usr/local/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /usr/local/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /usr/local/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /usr/local/www/nextcloud/lib/private/DB/Connection.php(148): Doctrine\DBAL\Connection->setTransactionIsolation(2)
#5 /usr/local/www/nextcloud/3rdpart
2018/02/03 17:08:40 [error] 12605#102118: *268 directory index of "/usr/local/www/" is forbidden, client: 45.55.149.229, server: 192.168.5.81, request: "GET / HTTP/1.1", host: "domain.ddns.net"
2018/02/03 18:26:00 [error] 16524#101436: *953 open() "/usr/local/www/apple-touch-icon-120x120-precomposed.png" failed (2: No such file or directory), client: 174.205.15.151, server: 192.168.5.81, request: "GET /apple-touch-icon-120x120-precomposed.png HTTP/1.1", host:$
2018/02/03 18:26:00 [error] 16524#101436: *953 open() "/usr/local/www/apple-touch-icon-120x120.png" failed (2: No such file or directory), client: 174.205.15.151, server: 192.168.5.81, request: "GET /apple-touch-icon-120x120.png HTTP/1.1", host: "domain.ddns.net"
2018/02/03 19:04:10 [error] 16522#103759: *1178 directory index of "/usr/local/www/" is forbidden, client: 58.247.182.143, server: 192.168.5.81, request: "GET / HTTP/1.0", host: "x.x.x.x:443"
2018/02/03 19:38:07 [error] 16521#102248: *1331 open() "/usr/local/www/phpmyadmin/scripts/setup.php" failed (2: No such file or directory), client: 63.246.129.99, server: 192.168.5.81, request: "HEAD /phpmyadmin/scripts/setup.php HTTP/1.1", host: "www"
 

NasKar

Guru
Joined
Jan 8, 2016
Messages
739
I must have done something incorrectly, so I remove the mount points and redid them. Uninstalled maria101-server and reinstalled after removing files from the /var/db/mysql older and config.php from config folder. After creating the nextcloud db and importing the dump into the data, I restart the web GUI and got the startup questions admin , file location , db name /pw etc and it loaded up with the old files inplace. My external storage mappings were gone and I get an error on the admin page
"Some files have not passed the integrity check. Further information on how to resolve this issue can be found in our documentation" the fix to the problem in the docs doesn't make any sense to my. As I really wanted the external storage mappings shares and they didn't restore I think I'll just start with a clean slate. Thanks for your assistance.
 
Status
Not open for further replies.
Top