hello community,
short overview
- task: move owncloud from docker setup to native / manual setup
- question: export & import Database (currently this went wrong)
Full Story
i had some bugs in my owncloud-docker setup lately -
partly maybe caused by the virtualization of my hoster and the Docker compatibility… (it is running in a strato v-server.)
and as i had no more energy to track this deeper i thought hey just let us move the owncloud thing to a manual non virtualization raw installation on the server.
that is what i have tried yesterday…
the way so fare
I describe here in detail what i have done so fare…
basically i followed this Install ownCloud on Ubuntu 20.04 Quickstart Guid.
apache setup
i had to change the default apache port as iam running a proxy on the same server…
/etc/apache2/ports.conf
Listen 8089
<IfModule ssl_module>
Listen 4439
</IfModule>
<IfModule mod_gnutls.c>
Listen 4439
</IfModule>
sudo nano /etc/apache2/sites-enabled/000-default.conf
# change 80 to 8089
sudo nano /etc/apache2/sites-available/default-ssl.conf
# change 443 to 4439
owncloud
at the step Download ownCloud
i used the zip file link from the official download page for 10.06:
cd /var/www/
wget https://download.owncloud.org/community/owncloud-complete-20201216.zip
unzip owncloud-complete-20201216.zip
chown -R www-data. owncloud
proxy
after the Installation with occ maintenance:install ....
(using all the config values from the docker .env and docker-compose.yml
files…)
i added the needed configs for my proxy setup
occ config:system:set trusted_proxies 1 --value="127.0.0.1"
occ config:system:set overwriteprotocol --value="https"
occ config:system:set trusted_domains 2 --value="cloud.myexample.de"
move files
next step was to move the files
sudo rsync -avt --progress /var/lib/docker/volumes/owncloud-docker_files/_data/apps /var/www/owncloud
sudo rsync -avt --progress /var/lib/docker/volumes/owncloud-docker_files/_data/files /var/www/owncloud
i did not update the config as i tried to setup with identical / tweaked config values and thought i don’t want to get unsutable things…
Move the Database
# enter the owncloud docker container
theuser@ourhost:~/owncloud-docker$
docker-compose exec owncloud /bin/bash
root@123a8c47c016: /var/www/owncloud #
# create backup dump
mysqldump --single-transaction --column-statistics=0 -h db -u owncloud -powncloud owncloud > /mnt/data/owncloud-dbbackup.bak
# exit container
exit
if found out that the --column-statistics=0
is needed -
otherwise i got this error
mysqldump --single-transaction -h db -u owncloud -pmypw owncloud > owncloud-dbbackup.bak
mysqldump: [Warning] Using a password on the command line interface can be insecure.
mysqldump: Couldn't execute 'SELECT COLUMN_NAME, JSON_EXTRACT(HISTOGRAM, '$."number-of-buckets-specified"') FROM information_schema.COLUMN_STATISTICS WHERE SCHEMA_NAME = 'owncloud' AND TABLE_NAME = 'oc_account_terms';': Unknown table 'COLUMN_STATISTICS' in information_schema (1109)
theuser@ourhost:~/owncloud-docker$
# move backupfile
sudo mv /var/lib/docker/volumes/owncloud-docker_files/_data/owncloud-dbbackup.bak ~/.
then i tried to import
# import db
mysql -v --progress-reports -h localhost -u owncloud -powncloud owncloud < owncloud-dbbackup.bak
but got a error
ERROR 1071 (42000) at line 51: Specified key was too long; max key length is 767 bytes
after
some search i found that this could be fixed by changing the database config:
# prepare db
sudo mysql -u root -p
MariaDB [(none)]> use owncloud;
MariaDB [owncloud]> set global innodb_large_prefix=on;
MariaDB [owncloud]> set global innodb_file_format=Barracuda;
exit
occ maintenance:repair
i think the occ maintenance:repair
did not do something here…
with this changed i could import the db with
# import db
mysql -v --progress-reports -h localhost -u owncloud -powncloud owncloud < owncloud-dbbackup.bak
just for sure i also run occ maintenance:repair
and indeed i could login with my old users - and from the web it seemd fine at first -
but with my admin user i found that iam not able to see the user list -
and in the owncloud logs there were som errors…
i had to fix the hardcoded paths to the user files in the db -
following this guid on…
sudo mysql -u root -p
MariaDB [(none)]> use owncloud;
UPDATE oc_storages
SET id='local::/var/www/owncloud/data/'
WHERE id='local::/mnt/data/files/';
UPDATE oc_accounts
SET home = REPLACE(
home,
'/mnt/data/files/',
'/var/www/owncloud/data/'
);
this fixed the user path errors in the log.
but the problem with the user listing does not change.
i encoded one of the error messages
(by the way - is there a tool to do this? - i have done it by hand )
Code: "42000"
Exception: "PDOException"
File: "/var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php"
Line: 129
Message:
SQLSTATE[42000]:
Syntax error or access violation:
1253 COLLATION 'utf8_general_ci' is not valid for CHARACTER SET 'utf8mb4'
Trace:
#0 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php(129): PDOStatement->execute(NULL)
#1 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Statement.php(155): Doctrine\\DBAL\\Driver\\PDOStatement->execute(NULL)
#2 /var/www/owncloud/lib/public/AppFramework/Db/Mapper.php(241): Doctrine\\DBAL\\Statement->execute()
#3 /var/www/owncloud/lib/public/AppFramework/Db/Mapper.php(337): OCP\\AppFramework\\Db\\Mapper->execute('SELECT DISTINCT...', Array, 200, 0)
#4 /var/www/owncloud/lib/private/User/AccountMapper.php(176): OCP\\AppFramework\\Db\\Mapper->findEntities('SELECT DISTINCT...', Array, 200, 0)
#5 /var/www/owncloud/lib/private/User/Manager.php(305): OC\\User\\AccountMapper->find('', 200, 0)
#6 /var/www/owncloud/settings/Controller/UsersController.php(302): OC\\User\\Manager->find('', 200, 0)
#7 /var/www/owncloud/lib/private/AppFramework/Http/Dispatcher.php(153): OC\\Settings\\Controller\\UsersController->index(0, 200, '', '', '')
#8 /var/www/owncloud/lib/private/AppFramework/Http/Dispatcher.php(85): OC\\AppFramework\\Http\\Dispatcher->executeController(Object(OC\\Settings\\Controller\\UsersController), 'index')
#9 /var/www/owncloud/lib/private/AppFramework/App.php(100): OC\\AppFramework\\Http\\Dispatcher->dispatch(Object(OC\\Settings\\Controller\\UsersController), 'index')
#10 /var/www/owncloud/lib/private/AppFramework/Routing/RouteActionHandler.php(47): OC\\AppFramework\\App::main('UsersController', 'index', Object(OC\\AppFramework\\DependencyInjection\\DIContainer), Array)
#11 /var/www/owncloud/lib/private/Route/Router.php(342): OC\\AppFramework\\Routing\\RouteActionHandler->__invoke(Array)
#12 /var/www/owncloud/lib/base.php(917): OC\\Route\\Router->match('/settings/users...')
#13 /var/www/owncloud/index.php(54): OC::handleRequest()
#14 {main}
so yeah - it seems i have caused some invalid combination with my database config changes…
any help or ideas on this?
sunny greetings
stefan