Migrating ownCloud
Introduction
There are several situations where ownCloud needs to be migrated.
The following scenarios are described here:
-
Migrating to a different host
-
Migrating to a different domain
-
Migrating from ownCloud 10 to ownCloud 11
Note that any database migration is not covered here.
| During the migration process, do not make any changes to the original system except to put it into maintenance mode. This ensures that, should anything unforeseen happen, you can revert to your existing installation and resume its availability while debugging the problem. |
Maintenance Mode
To issue any occ commands, you must enter the directory where the ownCloud compose file is located.
-
To enable maintenance mode, issue the following command:
cd /var/www/owncloud/ docker compose exec owncloud occ maintenance:mode --on -
To disable maintenance mode, issue the following command:
cd /var/www/owncloud/ docker compose exec owncloud occ maintenance:mode --off
Migration
Host Migration
Migration to a different host is easy with Docker.
-
Enable maintenance mode
-
Down the container
-
Make the data available on the new host:
-
Either copy the Docker volume if not using a shared mount point to the new host, or
-
Create a new shared mount point
-
-
Copy / adapt the compose yaml file to reflect your changes
-
Bring up the container
-
Disable maintenance mode
Domain Migration
As the ownCloud 11 image provides an embedded Apache web server, you need a proxy to handle security and other web-related settings anyway. To migrate or add a domain, two steps are required:
-
Update your proxy server settings
-
Update the ownCloud trusted domain settings
Managing Trusted Domains
All URLs used to access your ownCloud server must be white-listed in your configuration file, under the trusted_domains setting or via environment variables. Users are allowed to log into ownCloud only when they point their browsers to a URL that is listed in the trusted_domains setting.
| This setting is important when changing or moving to a new domain name. You may use IP addresses and domain names. |
The loopback address, 127.0.0.1, is automatically white-listed, so as long as you have access to the physical server you can always log in. In the event that a load-balancer is in place, there will be no issues as long as it sends the correct X-Forwarded-Host header.
|
- A typical configuration via the configuration file looks like this
-
'trusted_domains' => [ 0 => 'localhost', 1 => 'server1.example.com', 2 => '192.168.1.50', ], - Here is an example of how this can be used from within a docker-compose.yml file
-
In case of a docker based setup, the trusted_domains setting is controlled by the environment variables
OWNCLOUD_TRUSTED_DOMAINSorOWNCLOUD_DOMAIN. The latter only takes effect, ifOWNCLOUD_TRUSTED_DOMAINSis undefined and can provide one IP-address or hostname.OWNCLOUD_TRUSTED_DOMAINScan specify multiple values as a comma-separated list. For more details on environment variables see the Installing With Docker documentation.This will allow access to ownCloud under two different names, and one IP-address, in addition to localhost and 127.0.0.1:
services: owncloud: image: owncloud/server:10.16.2 environment: OWNCLOUD_TRUSTED_DOMAINS: "myowncloud.mydomain.com, myowncloud, 12.23.34.45" ...
ownCloud Server Migration
This section describes the migration of ownCloud 10 to ownCloud 11, if ownCloud 10 was installed natively. It only focuses on ownCloud but not on any migration of the database!
Due to the wide range of installation types, the description focuses on the main steps rather than the details. When using encryption with the ownCloud 10 instance, the openSSL requirements must be met without circumventing retired ciphers. See the ownCloud 10 encryption documentation for more details.
-
Enable maintenance mode on ownCloud 10
-
Create a mount point to bind mount the Docker volume.
For more details see the Mount Folder Structure documentation. -
Install ownCloud 11 using a bind mount and down the container.
This will install/prepare ownCloud 11 in a basic way but it is not configured to your needs.
For details see: Installing With Docker. -
Adapt the compose yaml file to your needs.
Remove any environment variables from the compose file that are no longer relevant, such as those for the database. These settings are now covered by a new configuration file, see below. -
Migrate the
data/filesdirectory intomount-point/files. -
Migrate all apps from ownCloud 10 that are NOT part of ownCloud 11 into the
mount-point/appsdirectory.
For more details see the Apps Management documentation. -
Make a copy of your existing
config.phpfile with a new name and remove any setting that addresses thedatadirectory andapps/apps-externaldirectories into themount-point/configdirectory.
See the important note with regards to the config in the Mount Folder Structure documentation. -
Bring up the ownCloud 11 container.
-
Disable maintenance mode.