HiveMinds / Collabora-Online

Sets up Collabora Online server with a single command through NextCloud. Ideally over Tor.
GNU Affero General Public License v3.0
0 stars 0 forks source link

Ensure restoring=importing the Nextcloud configuration works. #37

Open a-t-0 opened 1 year ago

a-t-0 commented 1 year ago

Note config import is not needed to import calendar and values from fresh install.

WARNING: This functionality is still experimental and under
development, use at your own risk. Note that the CLI interface is
unstable, so beware if using from within scripts.

Enabling maintenance mode... done
Clearing existing non-default apps... done
Importing apps...
         63,82M 100%   26,34MB/s    0:00:02 (xfr#803, to-chk=0/849)  
Dropping existing database... done
Creating new database... done
Importing database...
mysql: [Warning] Using a password on the command line interface can be insecure.
MySQL Nextcloud password has not yet been generated
database_password=
Importing config...
TODO: (re-enable) importing config.
Clearing existing data... done
Importing data...
         28,39M 100%   57,37MB/s    0:00:00 (xfr#55, to-chk=0/113) 
Disabling maintenance mode... error
An unhandled exception has been thrown:
Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [1045] Access denied for user 'oc_root'@'localhost' (using password: NO) in /snap/nextcloud/34542/htdocs/lib/private/DB/Connection.php:139
Stack trace:
#0 /snap/nextcloud/34542/htdocs/3rdparty/doctrine/dbal/src/Connection.php(1519): OC\DB\Connection->connect()
#1 /snap/nextcloud/34542/htdocs/3rdparty/doctrine/dbal/src/Connection.php(1041): Doctrine\DBAL\Connection->getWrappedConnection()
#2 /snap/nextcloud/34542/htdocs/lib/private/DB/Connection.php(261): Doctrine\DBAL\Connection->executeQuery()
#3 /snap/nextcloud/34542/htdocs/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php(345): OC\DB\Connection->executeQuery()
#4 /snap/nextcloud/34542/htdocs/lib/private/DB/QueryBuilder/QueryBuilder.php(281): Doctrine\DBAL\Query\QueryBuilder->execute()
#5 /snap/nextcloud/34542/htdocs/lib/private/AppConfig.php(419): OC\DB\QueryBuilder\QueryBuilder->execute()
#6 /snap/nextcloud/34542/htdocs/lib/private/AppConfig.php(184): OC\AppConfig->loadConfigValues()
#7 /snap/nextcloud/34542/htdocs/lib/private/AppConfig.php(375): OC\AppConfig->getApps()
#8 /snap/nextcloud/34542/htdocs/lib/private/legacy/OC_App.php(967): OC\AppConfig->getValues()
#9 /snap/nextcloud/34542/htdocs/lib/private/Server.php(725): OC_App::getAppVersions()
#10 /snap/nextcloud/34542/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php(162): OC\Server->OC\{closure}()
#11 /snap/nextcloud/34542/htdocs/3rdparty/pimple/pimple/src/Pimple/Container.php(122): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#12 /snap/nextcloud/34542/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php(129): Pimple\Container->offsetGet()
#13 /snap/nextcloud/34542/htdocs/lib/private/ServerContainer.php(136): OC\AppFramework\Utility\SimpleContainer->query()
#14 /snap/nextcloud/34542/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php(57): OC\ServerContainer->query()
#15 /snap/nextcloud/34542/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php(184): OC\AppFramework\Utility\SimpleContainer->get()
#16 /snap/nextcloud/34542/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php(162): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#17 /snap/nextcloud/34542/htdocs/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#18 /snap/nextcloud/34542/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php(129): Pimple\Container->offsetGet()
#19 /snap/nextcloud/34542/htdocs/lib/private/ServerContainer.php(136): OC\AppFramework\Utility\SimpleContainer->query()
#20 /snap/nextcloud/34542/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php(57): OC\ServerContainer->query()
#21 /snap/nextcloud/34542/htdocs/lib/private/Server.php(1121): OC\AppFramework\Utility\SimpleContainer->get()
#22 /snap/nextcloud/34542/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php(162): OC\Server->OC\{closure}()
#23 /snap/nextcloud/34542/htdocs/3rdparty/pimple/pimple/src/Pimple/Container.php(122): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#24 /snap/nextcloud/34542/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php(129): Pimple\Container->offsetGet()
#25 /snap/nextcloud/34542/htdocs/lib/private/ServerContainer.php(136): OC\AppFramework\Utility\SimpleContainer->query()
#26 /snap/nextcloud/34542/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php(57): OC\ServerContainer->query()
#27 /snap/nextcloud/34542/htdocs/lib/private/Server.php(2072): OC\AppFramework\Utility\SimpleContainer->get()
#28 /snap/nextcloud/34542/htdocs/lib/private/Files/View.php(117): OC\Server->getLockingProvider()
#29 /snap/nextcloud/34542/htdocs/lib/private/Server.php(462): OC\Files\View->__construct()
#30 /snap/nextcloud/34542/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php(162): OC\Server->OC\{closure}()
#31 /snap/nextcloud/34542/htdocs/3rdparty/pimple/pimple/src/Pimple/Container.php(122): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#32 /snap/nextcloud/34542/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php(129): Pimple\Container->offsetGet()
#33 /snap/nextcloud/34542/htdocs/lib/private/ServerContainer.php(136): OC\AppFramework\Utility\SimpleContainer->query()
#34 /snap/nextcloud/34542/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php(57): OC\ServerContainer->query()
#35 /snap/nextcloud/34542/htdocs/lib/private/Server.php(1474): OC\AppFramework\Utility\SimpleContainer->get()
#36 /snap/nextcloud/34542/htdocs/lib/base.php(617): OC\Server->boot()
#37 /snap/nextcloud/34542/htdocs/lib/base.php(1145): OC::init()
#38 /snap/nextcloud/34542/htdocs/console.php(48): require_once('...')
#39 /snap/nextcloud/34542/htdocs/occ(11): require_once('...')
#40 {main}
a-t-0 commented 1 year ago

Note, the issue seems to be that the old Nextcloud (database) password gets overwritten with the new Nextcloud database password. I inspected the config file content that is being restored, and the current config content, and that password is the only difference.

One could perhaps also restore the old password, that matches the old database, however, in that case, one would always have to restore the database along with the config. A more flexible approach would be to try whether the restored password works on the restored/current database, and if not use the current password.

Also, if only a database from a different time is imported, probably the config password should be updated to match that database.