This repository contains a Docker compose file which can be used to easily create a Nextcloud instance.
- Fully-featured Nextcloud instance backed by a MySQL database
- Automatic SSL certificate issuance and renewal (using
nginx-proxy-letsencrypt-companion
) - Automated encrypted backups to Backblaze B2 using
duplicacy-autobackup
. Can be customized to use any storage backend supported by duplicacy (S3, Hubic, etc.).
Here are the various containers involved.
nextcloud
: the actual Nextcloud servermysql
: the database used by Nextcloud to store its configurationreverse-proxy
: a nginx reverse proxy in front of Nextcloud and doing SSL terminationletsencrypt-companion
: an utility container which issues and renews SSL certificatesbackups
: an utility container which regularly backups the Nextcloud files and database
Follow the steps below. If you don't want any backups, just remove the backups:
section in docker-compose.yml
, jump to step 2, and ignore the instructions related to Backblaze B2.
-
Sign up for a Backblaze account at https://www.backblaze.com/b2/sign-up.html.
-
Write down your Backblaze account ID and secret key (TODO) for later
-
Create a B2 bucket (e.g.
christophetd-nextcloud-backups
) and write down its name for later
-
If you don't have any, spin up a VPS on any cloud provider (AWS EC2, Digital Ocean, OVH...). If you use the following referral link, you'll benefit from $10 of free credit on Digital Ocean (and I will get $25): https://m.do.co/c/1504134cd374.
-
Point your subdomain (e.g.
nextcloud.christophetd.fr
) to this newly created VPS
Edit the .env
file, and change at least the following:
HOST
: the hostname of your VPS (e.g.nextcloud.christophetd.fr
)B2_BUCKET
: the name of the B2 bucket you created in step 1B2_ID
andB2_KEY
: your B2 credentials from step 1BACKUP_ENCRYPTION_KEY
: set it to a random passphrase. It will be used to encrypt your backups before shipping them to Backblaze.
Run:
$ docker-compose up -d
You'll need to wait a few minutes on first launch, as there is some certificate generation involved. Then, you should be able to access your Nextcloud instance!
You can now define your administrator credentials and use Nextcloud.