Nextcloud delivered by Ansible
Self-hosted, entirely open-source collaboration solution setup in under 5 minutes.
Nextcloud server setup can be a little tricky depending on the stack that you will choose. It heavily depends on linux system libraries, it needs a web server with special configuration (not just a reverse proxy) to work with and PHP-FPM as the process manager for the php apps. It needs a caching solution for optimum performance. It also needs a relational database and a file system for the data.
We needed to streamline the set up procedure for our customers in order to be as declarative as possible for administrative and security reasons.
Ansible turned out to be the right tool for the job. We wrote a single playbook that you can run against a private server, public site, virtual machine etc.
Τhe stack was chosen based on simplicity, security and the experience of trouble-free operation over time as always.
Our stack of choice
|OS||Almalinux 9||Latest release|
|Database||PosgreSQL 13||Official almalinux repositories|
|Web server||Nginx 1.20||Official almalinux repositories|
|Cache / session management||Redis 6.2.6||Official almalinux repositories|
|Runtime||PHP 8.0||Official almalinux repositories|
|Application||Nextcloud 24||Latest stable release|
- We did not deal with TLS in the current setup. We are leaving this on customer's team because it is based on their own specific infrastructure. The procedure will deliver only a http service that is listening on a customizable port.
- We are using only almalinux official repositories and epel for some PHP modules.
- We did not make any nextcloud configuration via ansible. You can do this from application's UI or editing config.php after the setup. This includes database connection string, filesystem path for the data, memcache configuration, initial administrator account, ldap integration etc.
- The nginx configuration is the same that is currently recommended by documentation for customizable subdir of nginx's webroot: https://docs.nextcloud.com/server/latest/admin_manual/installation/nginx.html
- We tried to give every task, self-explanatory names. You can find the playbook along with the templates on this gitlab repository.
For a current version of our playbook you can visit our repository here:
For a quick clone:
git clone https://gitlab.com/automation180/nextcloud.git
Feel free to open any issue, suggestion or anything you find useful.
- Posted by Kostas Koutsogiannopoulos · June 23, 2022