Skip to content

daylicron/puppet-nextcloud

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

nextcloud

Table of contents

  1. Overview
  2. Module Description - What the module does
  3. Setup - The basics of getting started with nextcloud
  4. Usage - Configuration options and additional functionality
  5. Limitations - OS compatibility, etc.
  6. Development - Guide for contributing to the module

Overview

The nextcloud module lets you install, configure and update a nextcloud instance.

Module description

This module can install a blank nextcloud without any configuration. It can in addition configure your nextcloud, do the first installation and install plugins. The scope is to maintain a nextcloud instance autonomous.

Setup

Setup requirements

This module depends on the following puppet modules:

Cloning git repositories: https://forge.puppet.com/puppetlabs/vcsrepo

Unzip nextcloud archives: https://forge.puppet.com/puppet/archive

Useful things: https://forge.puppet.com/puppetlabs/stdlib

Beginning with nextcloud

Let's start with a blank nextcloud installation, doing no configuration at all:

class { 'nextcloud':
  version => '16.0.0',
}

Usage

All parameters can be provided via hiera too. For a full list of all parameters, see the init.pp.

You can configure you're nextcloud on different levels:

Initial installation

When you're doing an initial installation from scratch, you can skip the installer if you like:

class { 'nextcloud':
  version          => '16.0.0',
  skip_nc_install  => false,
  ac_db_type       => 'mysql',
  ac_db_name       => 'nextcloud',
  ac_db_user       => 'nextcloud',
  ac_db_password   => 'yourpasswordgoeshere',
  ac_db_host       => 'localhost'
  ac_adminuser     => 'admin',
  ac_adminpw       => 'yourpasswordgoeshere',
  ac_datadirectory =>  '/mnt/storage/nextcloud_data',
}

Configure your instance

You can configure your instance as if you would edit your config.php. Meaning you can provide every key and value pair you like inside the nc_conifg hash. Due to reasons I had to seperate the trust_domains configurarion. Nextcloud itself wants this in a particular structure which can only be provided when this option is seperated.

class { 'nextcloud':
  version          => '16.0.0',
  nc_config => {
    'datadirectory' => '/mnt/storage/nextcloud_data',
    'dbtype' => 'mysql',
    'dbhost' => 'localhost',
    'dbname' => 'nextcloud',
    'dbuser' => 'nextcloud',
    'dbpassword' => 'yourpasswordgoeshere',
  },
  nc_trust_domains => {
    0: 'yoururlgoeshere'
    1: 'maybeyouripgoeshere'
  },
}

Use auto upgrade

You can let puppet upgrade your nextcloud instance when you deploy a new version.

class { 'nextcloud':
  version          => '16.0.0',
  auto_upgrade     => true,
  nc_config        => {
    'datadirectory' => '/mnt/storage/nextcloud_data',
    'dbtype' => 'mysql',
    'dbhost' => 'localhost',
    'dbname' => 'nextcloud',
    'dbuser' => 'nextcloud',
    'dbpassword' => 'yourpasswordgoeshere',
  },
  nc_trust_domains => {
    0: 'yoururlgoeshere'
    1: 'maybeyouripgoeshere'
  },
}

Install plugins

!!Be aware that the official github source needs to be provided in the params.pp for this.!!

Last but not least you can install plugins too. You only need to provide the official name and version tag.

class { 'nextcloud':
  version          => '16.0.0',
  auto_upgrade     => true,
  nc_config        => {
    'datadirectory' => '/mnt/storage/nextcloud_data',
    'dbtype' => 'mysql',
    'dbhost' => 'localhost',
    'dbname' => 'nextcloud',
    'dbuser' => 'nextcloud',
    'dbpassword' => 'yourpasswordgoeshere',
  },
  nc_trust_domains => {
    0: 'yoururlgoeshere'
    1: 'maybeyouripgoeshere'
  },
  plguins          => {
    calendar => 'v1.7.0',
    contacts => 'v3.1.1',
  },
}

Limitations

Unfortunately nextcloud is not easy to automate. Lot's of stuff is configured inside the config.php. This file is edited by nextcloud itself, administrators using the webinterface and now puppet.

This leads to some special cases and things that have to be taken care of.

  1. As mentioned before, the trust_domains parameter has to be seperated vom the nc_config hash.
  2. When you provide config using the nc_config hash, you must provide the nextcloud version again. Otherwise you will run into trouble. 2.1 The worst thing about this is, that the version inside the config.php cannot be predicted, at least I found no way. This means: When you provide '16.0.0' inside the nc_config hash as version and you do a php occ upgrade, then nextcloud will change this version to something like: '16.0.0.9'. Afterwards you must provide this new version via puppet inside the nc_config hash. Otherwise puppet will revert the version to '16.0.0' and the nextcloud webinterface forces you to rerun the upgrade.
  3. Unfortunately you need to check for the different app version tags for yourself. VCSrepo does not provide an option to download the latest tag. Building this process with execs felt too ugly for me.

Development

This is my first own public puppet module. Any pull requests are very welcome. :)

About

Nextcloud module for puppet

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages