Nextcloud role
Deploy Nextcloud, a self-hosted file sync and collaboration platform, with PostgreSQL 17 database backend.
Usage
Configure Nextcloud database credentials in your inventory:
1 2 | |
Include the role in your playbook:
1 2 3 4 | |
The role provides these tags:
- nextcloud-install - Deploy Nextcloud with PostgreSQL database
- nextcloud-uninstall - Remove Nextcloud containers and volumes
Docs
Deploy Nextcloud to your Docker host:
1 | |
Remove Nextcloud installation:
1 | |
Configuration Details
The role deploys Nextcloud with:
- Official Image: nextcloud (latest stable)
- Database: PostgreSQL 17.2 Alpine
- Persistent Storage: Separate volumes for Nextcloud data and PostgreSQL data
- Network: Uses external caddy_old network for reverse proxy integration
- Database Configuration: Automatic PostgreSQL connection setup via environment variables
Architecture
The deployment consists of two containers: 1. nextcloud - Main application container 2. nextcloud_db (db17) - PostgreSQL 17 database
The database is isolated on the internal nextcloud network, while the application connects to the reverse proxy via caddy_old network.
Accessing Nextcloud
Configure your reverse proxy (Caddy or Traefik) to route traffic to the nextcloud container on port 80.
On first access, Nextcloud will guide you through the admin account setup.
Storage
Two volumes are created:
- nc_data - Nextcloud application files and user data
- postgres17 - PostgreSQL database data
Database Connection
Nextcloud automatically connects to PostgreSQL using these environment variables:
- POSTGRES_HOST: nextcloud_db
- POSTGRES_DB: nextcloud
- POSTGRES_USER: nextcloud
- POSTGRES_PASSWORD: Configured via nextcloud_pg_password variable
