NextCloud Docker Setup

I found NextCloud to be very powerful, flexible and expandable. Specifically, I setup NextCloud on my synology NAS via docker, manually upload my file (while will be essentially faster) for the initial sync, then use NextCloud as a combination of Dropbox and Google Drive.

Setup

  1. Setup a new network for the docker;
  2. Setup path as a folder to store data;
  3. Using the following docker compose file to build docker images (sensitive information is masked in < and >). The command for set up is docker-compose up -d, and the command for update is sudo docker-compose pull && sudo docker-compose up -d;
  4. Login with setting database to mariadb;
  5. After manually uploading files to the destination, you can add files to nextcloud by sudo -u www-data php occ files:scan --path "<username>/files/<path_under_files>;
  6. To recursively delete, use find . -type d -name '@eaDir' -exec rm -r {} +;
  7. Remember to add trusted domains.
version: '3.2'
services:
  nextcloud:
    image: nextcloud
    container_name: nextcloud
    restart: always
    networks:
      - net
    ports:
      - 3222:80
    labels:
      - "traefik.docker.network=net"
      - "traefik.enable=true"
      - "traefik.backend=nextcloud"
      - "traefik.port=80"
      - "traefik.protocol=http"
      - "traefik.frontend.rule=Host:<domain name>"
      - "traefik.frontend.headers.customResponseHeaders=Strict-Transport-Security:15552000"
      - "traefik.frontend.passHostHeader=true"
      - "traefik.frontend.redirect.permanent:true"
      - "traefik.frontend.redirect.regex:https://(.*)/.well-known/(card|cal)dav"
      - "traefik.frontend.redirect.replacement:https://$$1/remote.php/dav/"
    depends_on:
      - nextcloud_db
    volumes:
      - <path>/nextcloud:/var/www/html
      - <path>/config:/var/www/html/config
      - <path>/data:/var/www/html/data
      - "MYSQL_HOST=nextcloud_db"
      - "NEXTCLOUD_TRUSTED_DOMAINS=<domain>"
      - "REDIS_HOST=nextcloud_redis"
    depends_on:
      - nextcloud_db
      - redis

  nextcloud_db:
    image: mariadb
    container_name: nextcloud_db
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    restart: always
    networks:
      - net
    volumes:
      - <path>/db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=<password>
      - MYSQL_PASSWORD=<password>
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud

  redis:
    image: redis
    container_name: nextcloud_redis
    networks:
      - net

  cron:
    image: nextcloud
    container_name: nextcloud_cron
    restart: always
    networks:
      - net
    volumes:
      - <path>/nextcloud:/var/www/html
    entrypoint: /cron.sh
    depends_on:
      - nextcloud_db
      - redis

volumes:
  nextcloud:
  nextcloud_db:
  nextcloud_cron:

networks:
  net:
    external: true
Avatar
Liyuan Liu
Senior Researcher @ MSR

Understand the underlying mechanism of pretraining heuristics.

Related