Skip to main content

Nextcloud

version: '3.3'

volumes:
  nextcloud:
  db:
services:
  db:
    image: mariadb
    restart: unless-stopped
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW --innodb-file-per-table=1 --skip-innodb-read-only-compressed
    volumes:
      - /srv/path/Nextcloud/db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=XXXXXX
      - MYSQL_PASSWORD=xxxxxx
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
  app:
    image: nextcloud
    restart: unless-stopped
    ports:
      - 8080:80
    links:
      - db
    volumes:
      - /srv/path/Nextcloud/data:/var/www/html
    environment:
      - MYSQL_PASSWORD=xxxxxx
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_HOST=db

Host is db  mariadb To find out, docker ps -a and see what matches nextcloud_db_1 ex: 8f867eda8f45   mariadb   "docker-entrypoint.s…"   2 minutes ago...

sudo nano /srv/path/NextCloud/config/config.php

edit   'overwrite.cli.url' => 'https://your.domain1.com',
ajout   'overwriteprotocol' => 'https',

Trusted domains:

  array (
    0 => '192.168.x.x:8080',
    1 => 'your.domain1.com', # no https://
    2 => 'your.domain2.com'  # no https://
  ),

Upload large files: https://www.youtube.com/watch?v=2-EbM9MyRBs

Edit Nextcloud/data/.user.ini:

php_value upload_max_filesize 10G
php_value post_max_size 10G
php_value max_input_time 3600
php_value max_execution_time 3600

Edd this to your nginx reverse proxy settings:

fastcgi_connect_timeout 60;
fastcgi_send_timeout 1800;
fastcgi_read_timeout 1800;

Do not acitvate the Cache Assets switch in Nginx Proxy Manager

Update to a newer version

Updating the Nextcloud container is done by pulling the new image, throwing away the old container and starting the new one.

It is only possible to upgrade one major version at a time. For example, if you want to upgrade from version 14 to 16, you will have to upgrade from version 14 to 15, then from 15 to 16.

Since all data is stored in volumes, nothing gets lost. The startup script will check for the version in your volume and the installed docker version. If it finds a mismatch, it automatically starts the upgrade process. Don't forget to add all the volumes to your new container, so it works as expected.

$ docker pull nextcloud
$ docker stop <your_nextcloud_container>
$ docker rm <your_nextcloud_container>
$ docker run <OPTIONS> -d nextcloud

Beware that you have to run the same command with the options that you used to initially start your Nextcloud. That includes volumes, port mapping.

When using docker-compose your compose file takes care of your configuration, so you just have to run:

$ docker-compose pull
$ docker-compose up -d


Locked files / folders ?

Try this :

sudo docker exec -ti --user www-data nextcloud-app-1 /var/www/html/occ files:scan --all

OR

sudo docker exec -ti --user www-data nextcloud-app-1 /var/www/html/occ files:scan username

docker exec --user www-data nextcloud-app-1 php occ maintenance:mode --on

docker exec nextcloud-db-1 mysql --user=root --password=SQLROOTPASSWDOLOL -D nextcloud -e 'delete from oc_file_locks where 1'

docker exec --user www-data nextcloud-app-1 php occ maintenance:mode --off

 sudo docker exec -ti --user www-data nextcloud-app-1 /var/www/html/occ config:app:set files max_chunk_size --value 0

My last know docker-compose
version: '2'

volumes:
  nextcloud:
  db:

services:
  db:
    image: mariadb:10.5
    restart: unless-stopped
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    volumes:
      - /srv/dev-disk-by-uuid-7fe66601-5ca0-4c09-bc13-a015025fe53a/Nextcloud/db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=xxxxxxxxxxxx!
      - MYSQL_PASSWORD=xxxxxxxxxxxx
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud

  app:
    image: nextcloud
    restart: unless-stopped
    ports:
      - 8080:80
    links:
      - db
    volumes:
      - /srv/dev-disk-by-uuid-7fe66601-5ca0-4c09-bc13-a015025fe53a/Nextcloud/data:/var/www/html
    environment:
      - MYSQL_PASSWORD=xxxxxxxxxxxx
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_HOST=db