0
0
Fork 0
mirror of https://github.com/nextcloud/docker.git synced 2024-11-05 22:04:58 +01:00

Readme: improve migration from existing section (#894)

* README: add postgresql commands to migration section

Signed-off-by: NeroBurner <pyro4hell@gmail.com>

* README: fix migration copy commands

When the docker-compose up is run the first time the nextcloud
directories are created. When after that the `docker cp` command copies
whole folders they are added as subfolders to the existing folders.

For example, when copying the data folder with
```
docker cp ./data/ nextcloud_app_1:/var/www/html/data
```

afterwards the data folder is in `/var/www/html/data/data`

Signed-off-by: NeroBurner <pyro4hell@gmail.com>

* README: migration: mention custom_apps config

Signed-off-by: NeroBurner <pyro4hell@gmail.com>
This commit is contained in:
NeroBurner 2019-11-04 11:00:01 +01:00 committed by J0WI
parent ec394822aa
commit d5ecc2149f

View file

@ -347,16 +347,28 @@ You're already using Nextcloud and want to switch to docker? Great! Here are som
1. Define your whole Nextcloud infrastructure in a `docker-compose` file and run it with `docker-compose up -d` to get the base installation, volumes and database. Work from there. 1. Define your whole Nextcloud infrastructure in a `docker-compose` file and run it with `docker-compose up -d` to get the base installation, volumes and database. Work from there.
2. Restore your database from a mysqldump (nextcloud\_db\_1 is the name of your db container) 2. Restore your database from a mysqldump (nextcloud\_db\_1 is the name of your db container)
```console - To import from a MySQL dump use the following commands
docker cp ./database.dmp nextcloud_db_1:/dmp ```console
docker-compose exec db sh -c "mysql -u USER -pPASSWORD nextcloud < /dmp" docker cp ./database.dmp nextcloud_db_1:/dmp
docker-compose exec db rm /dmp docker-compose exec db sh -c "mysql -u USER -pPASSWORD nextcloud < /dmp"
``` docker-compose exec db rm /dmp
```
- To import from a PostgreSQL dump use to following commands
```console
docker cp ./database.dmp nextcloud_db_1:/dmp
docker-compose exec db sh -c "psql -U USER --set ON_ERROR_STOP=on nextcloud < /dmp"
docker-compose exec db rm /dmp
```
3. Edit your config.php 3. Edit your config.php
1. Set database connection 1. Set database connection
```php - In case of MySQL database
'dbhost' => 'db:3306', ```php
``` 'dbhost' => 'db:3306',
```
- In case of PostgreSQL database
```php
'dbhost' => 'db:5432',
```
2. Make sure you have no configuration for the `apps_paths`. Delete lines like these 2. Make sure you have no configuration for the `apps_paths`. Delete lines like these
```diff ```diff
- "apps_paths" => array ( - "apps_paths" => array (
@ -366,7 +378,22 @@ docker-compose exec db rm /dmp
- "writable" => true, - "writable" => true,
- ), - ),
``` ```
3. Make sure your data directory is set to /var/www/html/data 3. Make sure to have the `apps` directory non writable and the `custom_apps` directory writable
```php
'apps_paths' => array (
0 => array (
'path' => '/var/www/html/apps',
'url' => '/apps',
'writable' => false,
),
1 => array (
'path' => '/var/www/html/custom_apps',
'url' => '/custom_apps',
'writable' => true,
),
),
```
4. Make sure your data directory is set to /var/www/html/data
```php ```php
'datadirectory' => '/var/www/html/data', 'datadirectory' => '/var/www/html/data',
``` ```
@ -374,16 +401,16 @@ docker-compose exec db rm /dmp
4. Copy your data (nextcloud_app_1 is the name of your Nextcloud container): 4. Copy your data (nextcloud_app_1 is the name of your Nextcloud container):
```console ```console
docker cp ./data/ nextcloud_app_1:/var/www/html/data docker cp ./data/ nextcloud_app_1:/var/www/html/
docker-compose exec app chown -R www-data:www-data /var/www/html/data docker-compose exec app chown -R www-data:www-data /var/www/html/data
docker cp ./theming/ nextcloud_app_1:/var/www/html/theming docker cp ./theming/ nextcloud_app_1:/var/www/html/
docker-compose exec app chown -R www-data:www-data /var/www/html/theming docker-compose exec app chown -R www-data:www-data /var/www/html/theming
docker cp ./config/config.php nextcloud_app_1:/var/www/html/config docker cp ./config/config.php nextcloud_app_1:/var/www/html/config
docker-compose exec app chown -R www-data:www-data /var/www/html/config docker-compose exec app chown -R www-data:www-data /var/www/html/config
``` ```
5. Copy only the custom apps you use (or simply redownload them from the web interface): 5. Copy only the custom apps you use (or simply redownload them from the web interface):
```console ```console
docker cp ./apps/ nextcloud_data:/var/www/html/custom_apps docker cp ./custom_apps/ nextcloud_data:/var/www/html/
docker-compose exec app chown -R www-data:www-data /var/www/html/custom_apps docker-compose exec app chown -R www-data:www-data /var/www/html/custom_apps
``` ```