Nextcloud deployment made easy.
Well, I used deploying Nextcloud as an excuse (there is already an official image) to familiarize myself more with Docker Compose and its best practices.
Warning
This deployment strategy and the opitionated image are not officially supported by Nextcloud GmbH. Use at your own risk!
Copy the dot env file template and populate it.
cp .env.example .env
Create the credentials
directory and the files that contain the Docker Secrets, then populate the credentials with secure passwords.
mkdir credentials
# PostgreSQL database password
touch credentials/postgres_password.txt
# The password of the Nextcloud admin user
touch credentials/nextcloud_admin_password.txt
# Collabora Office administration password
touch credentials/collabora_password.txt
If you want to store files in another server or use custom volume drivers, create the volume manually and set the external volume configuration on the environmental variables file.
# Example external volume using a nfs share
docker volume create --driver "local" \
--opt "type=nfs" \
--opt "o=addr=<NFS SHARE HOST OR IP>,rw" \
--opt "device=:<NFS SHARE STORAGE DIRECTORY>" \
<VOLUME NAME>
Pull and start the containers in the Docker Compose file.
docker compose pull
docker compose up -d
Thats it 🎉, now you have your own Nextcloud instance up and running.