Nextcloud: Your Personalized Cloud Solution for Data Management and Collaboration

Description

Nextcloud is an open-source, self-hosted file synchronization and sharing platform. It allows individuals and organizations to store, access, and share files, documents, calendars, contacts, and more, all within their own private cloud environment. Nextcloud provides features similar to those of commercial cloud storage services like Dropbox or Google Drive, but with the added benefit of giving users full control over their data.

Here are some key features of Nextcloud:

  1. File Synchronization: Nextcloud allows users to sync files and folders across devices, ensuring that they have access to their data from anywhere.
  2. File Sharing: Users can easily share files and folders with others, either by generating public links or by sharing directly with specific users or groups.
  3. Collaboration Tools: Nextcloud includes collaborative tools such as document editing, calendars, contacts, and task management, making it suitable for teamwork and project management.
  4. Security: Nextcloud offers robust security features, including encryption, authentication mechanisms, and access control, to ensure the privacy and integrity of users' data.
  5. Self-Hosted: One of the key advantages of Nextcloud is that it can be self-hosted on private servers, giving users complete control over their data and eliminating reliance on third-party cloud providers.
  6. Extensibility: Nextcloud is highly extensible, with a wide range of apps and plugins available to add additional functionality, such as video conferencing, note-taking, or integration with other services.

Overall, Nextcloud provides a flexible and customizable solution for individuals and organizations seeking to manage their data securely while retaining full control over their cloud environment.

How to run in Docker

Create the directory structure ./nextcloud/data,  ./nextcloud/data/db, ./nextcloud/data/redis and a docker-compose.yml file.

---
version: '3'

services:
  nextcloud:
    image: nextcloud
    container_name: nextcloud
    restart: unless-stopped
    networks: 
      - cloud
    depends_on:
      - nextclouddb
      - redis
    ports:
      - 8081:80
    volumes:
      - ./nextcloud/data/nextcloud:/var/www/html
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Rome
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_PASSWORD=dbpassword
      - MYSQL_HOST=nextclouddb
      - REDIS_HOST=redis

  nextclouddb:
    image: mariadb
    container_name: nextcloud-db
    restart: unless-stopped
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    networks: 
      - cloud
    volumes:
      - ./nextcloud/data/db:/var/lib/mysql
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Rome
      - MYSQL_RANDOM_ROOT_PASSWORD=true
      - MYSQL_PASSWORD=dbpassword
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      
  collabora:
    image: collabora/code
    container_name: collabora
    restart: unless-stopped
    networks: 
      - cloud
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Rome
      - password=password
      - username=nextcloud
      - domain=example.com
      - extra_params=--o:ssl.enable=true
    ports:
      - 9980:9980

  redis:
    image: redis:alpine
    container_name: redis
    volumes:
      - ./nextcloud/data/redis:/data  
    networks: 
      - cloud
  
networks:
  cloud:
    name: cloud
    driver: bridge

docker-compose.yml

And then just run it:

docker compose up -d

Let's break it down

  • Version: Specifies the version of Docker Compose being used.
  • Services: Defines the different containers/services that will be running.

Nextcloud: This service runs the Nextcloud application. It pulls the official Nextcloud image from Docker Hub. Key points:

- container_name: Specifies the name for the container.
- restart: Sets the restart policy to "unless-stopped", meaning the container will restart unless explicitly stopped by the user.
- networks: Attaches the container to the "cloud" network.
- depends_on: Specifies that this service depends on the "nextclouddb" and "redis" services.
- ports: Maps port 8081 on the host to port 80 inside the container.
- volumes: Mounts a host directory to persist Nextcloud data.
- environment: Sets environment variables for Nextcloud configuration, such as database connection details and timezone.

Nextclouddb: This service runs the MariaDB database for Nextcloud.

- container_name: Specifies the name for the container.
- restart: Sets the restart policy to "unless-stopped".
- command: Specifies command-line options for MariaDB.
- networks: Attaches the container to the "cloud" network.
- volumes: Mounts a host directory to persist MariaDB data.
- environment: Sets environment variables for MariaDB configuration.

Collabora: This service runs Collabora Online, which integrates with Nextcloud for collaborative document editing.

- container_name: Specifies the name for the container.
- volumes: Mounts a host directory to persist Redis data.
- networks: Attaches the container to the "cloud" network.
  • Networks: Defines a custom bridge network named "cloud" for the services to communicate with each other.

This setup provides a robust Nextcloud deployment with database, caching, and collaborative document editing capabilities.