Skip to content

MarcMichalsky/nextcloud_docker_scripts

Repository files navigation

Nextcloud Docker Scripts

I'd like to share my collection of scripts to back up, upgrade and restore Nextcloud Docker installations. They come handy especially if you are managing multiple Nextcloud installations on your server.

I am using the Docker Homelab for my Nextcloud instances.

NOTE: This scripts will only work if you...

  • have installed your Nextcloud within a Docker container
  • are using a container for the Nextcloud app and a separate container for the MySQL database
  • are using a docker-compose file to bring up both containers

This scripts will only backup or restore the database and the config files of your Nextcloud installation!

Usage

Install requirements

pip3 install -r requirements.txt

Configuration

  1. Copy the example_config.yml.
cp example_config.yml config.yml
  1. Adjust the config.yml with an editor of your choice.

Back up a Nextcloud installation

The backup.py script will create a backup of the database and the configuration of your Nextcloud installations. You can adjust the backup directory and the maximum number of backups in the config.yml.

python3 backup.py

or without user prompt

python3 backup.py cloud1 cloud2

Restore a Nextcloud installation

The restor.py script will restore the database and the configuration of your Nextcloud installations.

python3 restore.py

or without user prompt

python3 restore.py cloud1 cloud2

Upgrade a Nextcloud installation

The upgrade.py script will first back up and then try to upgrade your Nextcloud installations.

python3 upgrade.py

or without user prompt

python3 upgrade.py cloud1 cloud2

Flags

Flag function
--yes won't ask for confirmation
--all will treat all Nextcloud installations defined in the config.yml
--quiet the script will produce no output on terminal
--nolog no logs will be written
--nocleanup there will be no cleanup of the backup directory afterwards
--nobackup no backup will be made before upgrade

Known issues

  • Sometimes the maintenance mode is not getting disabled properly after upgrades. A simple docker exec --user www-data <app-cotainer> php occ maintenance:mode --off does the trick.

About

Some scripts to backup, upgrade and restore Nextcloud Docker instances

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages