Skip to content

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Repository files navigation

Overview

  • This repository is a docker compose based setup for nextcloud along with
    • Collabora (for web based document editing support)
    • Redis caching
    • Nextcloud talk
    • Apache reverse proxy
  • This repository also has the scripts for docker based scripts to incrementally backup and restore the nextcloud data periodically
  • This repository also has the docker compose based setup to generate self-signed certificates if required for the nextcloud, collabora and signal domains

architecture.svg

Config files

  • Create .env, db.env files in this project folder as they are required for docker compose yaml files. .env_sample and db_sample.env files can be used for reference
  • Create backup_scripts/config.bat and backup_scripts/config.sh files in this project folder as they are required for the backup and restore setup. backup_scripts/config_sample.bat and backup_scripts/config_sample.sh files can be used for reference
  • Create certs folder in the project folder and place the ssl certificate files (certificate file, key file, certificate chain file) of nextcloud, collabora and signal domains

SSL Certificate files

  • For valid CA-issued certificates, skip the self-signed generators and instead save the valid cert/key/chain into the certs folder. Also set SKIP_CERT_VERIFY=false in .env so services require trusted certificate verification.
  • If there are no SSL certifiactes present for the domains, self-signed SSLs can be generated by running omgwtfssl, omgwtfssl2, omgwtfssl3 containers. The following commands will generate self-signed certificates for nextcloud, collabora and signal domains in the certs folder
docker compose -f self_signed_certs_gen.yaml up -d --build omgwtfssl
docker compose -f self_signed_certs_gen.yaml up -d --build omgwtfssl2
docker compose -f self_signed_certs_gen.yaml up -d --build omgwtfssl3

Docker instructions

  • command to run docker compose - docker compose -f nextcloud.yaml up -d --build. This spins up all the nextcloud application's docker containers
  • command to run a container named app inside docker compose - docker compose -f nextcloud.yaml up -d --build app
  • config file location in nextcloud docker container - /var/www/html/config/config.php
  • access docker container as www-data user to run php occ commands - docker exec -it -u www-data app bash

Steps to run

  • Ensure .env, db.env, backup_scripts/config.bat and backup_scripts/config.sh files are setup as per the requirement

  • Ensure SSL certificates are present in the certs folder

  • If no DNS is configured for the domain names - Add the following dns entries in hosts file (since we are not using a real public domain)

127.0.0.1 nextcloud.local
127.0.0.1 collabora.local
127.0.0.1 signal.local

hosts file in windows is located at C:\Windows\System32\drivers\etc\hosts hosts file in debian is located at /etc/hosts

  • Run the whole docker compose with docker compose -f nextcloud.yaml up -d --build

    • Run collabora container (for nextcloud office online editor)
    docker compose -f nextcloud.yaml up -d --build collabora
    • Run nc-talk container (for nextcloud talk high performance backend)
    docker compose -f nextcloud.yaml up -d --build nc-talk
    • Run proxy container (reverse proxy for nextcloud)
    docker compose -f nextcloud.yaml up -d --build proxy
    • Run app container (nextcloud)
    docker compose -f nextcloud.yaml up -d --build app
  • If the post-installation scripts could not run correctly due to some reason, they can be run again using the following scripts

docker exec -u www-data -i app sh < ./nextcloud/appHooks/post-installation/00_indicate_rev_proxy_https.sh
docker exec -u www-data -i app sh < ./nextcloud/appHooks/post-installation/01_install_apps.sh

To run script from windows, use the following commands instead

docker exec -u www-data -i app sh < .\nextcloud\appHooks\post-installation\00_indicate_rev_proxy_https.sh
docker exec -u www-data -i app sh < .\nextcloud\appHooks\post-installation\01_install_apps.sh

Run cron nextcloud cron job

  • run docker exec -u www-data app php /var/www/html/cron.php every 5 mins so that cron.php is run the machine running the nextcloud docker container
  • Run sudo crontab -e -u www-data and add the line */5 * * * * docker exec -u www-data app php /var/www/html/cron.php

Backup

  • Nextcloud files and database logical backup file are backed up using restic backup
  • backup_scripts/run_backup.bat script runs backup and stores it in the restic backup vault
  • All the backup and restore scripts will require a backup_scripts/config.bat or backup_scripts/config.sh file that contains the required configuration variables

Database backup

Database logical backup and restore is done in run_backup.sh using pg_dump and pg_restore postgres commands

List all backups

list_backups.sh will display restic backup IDs that are present in the backup storage

Restore latest or specific bcakup using its ID

  • when restore_backup.bat is run, latest snapshot is restored
  • when restore_backup.bat a1b2c3d4 is run, snapshot id a1b2c3d4 is restored

External Storage Support

Docker host's local / NAS folder

  • A local folder location of the docker host can be used as an external storage location in docker
  • In the .env file, mention docker host folder details as shown below using the variables ENABLE_EXTERNAL_STORAGE and EXTERNAL_STORAGE_PATH
ENABLE_EXTERNAL_STORAGE=true
EXTERNAL_STORAGE_PATH=/folder/path
  • If the docker host is linux, make sure the UID and GID 33 have write permissions to the folder. Because the nextcloud container's www-data user always runs with UID 33 and GID 33
# Set ownership to UID 33 and GID 33
sudo chown -R 33:33 /folder/path

# Set proper read/write permissions
sudo chmod -R 750 /folder/path
  • External NAS can also be mounted as a local folder and then used as a nextcloud external storage. Backup and restore of NAS or any external storage should be handled separately

Nextcloud NAS setup

Videos

https://youtube.com/playlist?list=PLZJ6Et6SUNyE&si=lico35g9POjSjy-3

References

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages