- 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
- Create
.env,db.envfiles in this project folder as they are required for docker compose yaml files..env_sampleanddb_sample.envfiles can be used for reference - Create
backup_scripts/config.batandbackup_scripts/config.shfiles in this project folder as they are required for the backup and restore setup.backup_scripts/config_sample.batandbackup_scripts/config_sample.shfiles can be used for reference - Create
certsfolder in the project folder and place the ssl certificate files (certificate file, key file, certificate chain file) of nextcloud, collabora and signal domains
- For valid CA-issued certificates, skip the self-signed generators and instead save the valid cert/key/chain into the
certsfolder. Also setSKIP_CERT_VERIFY=falsein.envso 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,omgwtfssl3containers. The following commands will generate self-signed certificates for nextcloud, collabora and signal domains in thecertsfolder
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- 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-datauser to run php occ commands -docker exec -it -u www-data app bash
-
Ensure
.env,db.env,backup_scripts/config.batandbackup_scripts/config.shfiles are setup as per the requirement -
Ensure SSL certificates are present in the
certsfolder -
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.localhosts 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
collaboracontainer (for nextcloud office online editor)
docker compose -f nextcloud.yaml up -d --build collabora
- Run
nc-talkcontainer (for nextcloud talk high performance backend)
docker compose -f nextcloud.yaml up -d --build nc-talk
- Run
proxycontainer (reverse proxy for nextcloud)
docker compose -f nextcloud.yaml up -d --build proxy
- Run
appcontainer (nextcloud)
docker compose -f nextcloud.yaml up -d --build app
- Run
-
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.shTo 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
docker exec -u www-data app php /var/www/html/cron.phpevery 5 mins so that cron.php is run the machine running the nextcloud docker container - Run
sudo crontab -e -u www-dataand add the line*/5 * * * * docker exec -u www-data app php /var/www/html/cron.php
- Nextcloud files and database logical backup file are backed up using
resticbackup backup_scripts/run_backup.batscript runs backup and stores it in the restic backup vault- All the backup and restore scripts will require a
backup_scripts/config.batorbackup_scripts/config.shfile that contains the required configuration variables
Database logical backup and restore is done in run_backup.sh using pg_dump and pg_restore postgres commands
list_backups.sh will display restic backup IDs that are present in the backup storage
- when
restore_backup.batis run, latest snapshot is restored - when
restore_backup.bat a1b2c3d4is run, snapshot ida1b2c3d4is restored
- 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_STORAGEandEXTERNAL_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
https://youtube.com/playlist?list=PLZJ6Et6SUNyE&si=lico35g9POjSjy-3
- Nextlcoud
occcommand docs - https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/occ_command.html#using-the-occ-command - Nextcloud docker setup blog - https://help.nextcloud.com/t/howto-ubuntu-docker-nextcloud-talk-collabora/76430
- Official docker nextcloud GitHub repo - https://github.com/nextcloud/docker
- Run user defined scripts in nextcloud docker image using hook scripts - https://github.com/nextcloud/docker?tab=readme-ov-file#auto-configuration-via-hook-folders
- nextcloud collabora integration guide - https://help.nextcloud.com/t/collabora-integration-guide/151879
- nextcloud talk occ commands - https://nextcloud-talk.readthedocs.io/en/latest/occ/
