Nextcloud
NextCloud is an online colloborative platform. Fundamentally a browser based file manager with editors and viewers for many file types; including an OnlyOffice plugin for documents.
NextCloud is ran inside docker compose - it can be run with a MySQL service or linking to a docker network for access to an existing MySQL server.
Docker-Compose
Dedicated MySQL instance
Replace inst with customer shortcode
Docker-Compose.yml file
version: '3.3'
volumes:
inst_files:
external: true
inst_ncdb:
services:
db:
image: mariadb:10.5
restart: unless-stopped
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
volumes:
- inst_ncdb:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=ROOTPW
- MYSQL_PASSWORD=USERPW
- MYSQL_DATABASE=instnxtcld
- MYSQL_USER=nextcloud
app:
image: nextcloud:stable-apache
restart: unless-stopped
ports:
- 8160:80
links:
- db
volumes:
- inst_files:/var/www/html
environment:
- MYSQL_PASSWORD=USERPW
- MYSQL_DATABASE=instnxtcld
- MYSQL_USER=nextcloud
- MYSQL_HOST=dbConnect to Existing MySQL instance
A NextCloud container can be connected to an existing MySQL instance, by:
- create the database, and grant permissions to the NextCloud db user
- connect the NextCloud Instance to the docker-compose network of the database host.
Connecting to the network need two stanzas in the docker compose file:
- a network block which includes _external: true
- link the NextCloud service to the network named above.
The SQL commands to create the database and grant permissions are:
- create database instnxtcld;
- grant all to instnxtcld.* to ’nextcloud’@’%';
- flush privileges;
Docker-Compose.yml file
version: '3.3'
volumes:
inst_files:
external: true
services:
app:
image: nextcloud:stable-apache
restart: unless-stopped
ports:
- 8120:80
volumes:
- inst_files:/var/www/html
environment:
- MYSQL_PASSWORD=du01CNCDB
- MYSQL_DATABASE=instnxtcld
- MYSQL_USER=nextcloud
- MYSQL_HOST=db.NETWORK_NAME
networks:
- network1
networks:
network1:
name: NETWORK_NAME
external: trueMigrating files
Files from the old owncloud instance were successfully migrated by:
- create the user
- once they had logged in, their folder was created: docker_host:/var/lib/docker/volumes/volume_name/_data/data/username/files/
- copy all relevant files into that folder
- ensure they are owned by www-data:www-data (chown -R www-data:www-data .)
- login to docker container (docker exec -it nextcloud-app-container-name bash)
- perform file scan (./occ files:scan – username)