nextcloud config in metadata
This commit is contained in:
parent
2afc41a9f4
commit
43bd31f5d5
3 changed files with 68 additions and 55 deletions
bundles/nextcloud
|
@ -1,44 +1,3 @@
|
||||||
<?php
|
<?php
|
||||||
# https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/config_sample_php_parameters.html#multiple-config-php-file
|
# https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/config_sample_php_parameters.html#multiple-config-php-file
|
||||||
$CONFIG = array (
|
$CONFIG = json_decode(file_get_contents("/etc/nextcloud/managed.config.json"));
|
||||||
"dbuser" => "nextcloud",
|
|
||||||
"dbpassword" => "${db_password}",
|
|
||||||
"dbname" => "nextcloud",
|
|
||||||
"dbhost" => "localhost",
|
|
||||||
"dbtype" => "pgsql",
|
|
||||||
"datadirectory" => "/var/lib/nextcloud",
|
|
||||||
"dbport" => "5432",
|
|
||||||
"apps_paths" => [
|
|
||||||
[
|
|
||||||
"path" => "/opt/nextcloud/apps",
|
|
||||||
"url" => "/apps",
|
|
||||||
"writable" => false,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"path" => "/var/lib/nextcloud/.userapps",
|
|
||||||
"url" => "/userapps",
|
|
||||||
"writable" => true,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
"cache_path" => "/var/lib/nextcloud/.cache",
|
|
||||||
"upgrade.disable-web" => true,
|
|
||||||
"memcache.local" => "\\OC\\Memcache\\Redis",
|
|
||||||
"memcache.locking" => "\\OC\\Memcache\\Redis",
|
|
||||||
"memcache.distributed" => "\OC\Memcache\Redis",
|
|
||||||
"redis" => [
|
|
||||||
"host" => "/var/run/redis/nextcloud.sock",
|
|
||||||
],
|
|
||||||
'trusted_domains' =>
|
|
||||||
array (
|
|
||||||
0 => 'localhost',
|
|
||||||
1 => '127.0.0.1',
|
|
||||||
2 => '${hostname}',
|
|
||||||
),
|
|
||||||
"log_type" => "syslog",
|
|
||||||
"syslog_tag" => "nextcloud",
|
|
||||||
"logfile" => "",
|
|
||||||
"loglevel" => 3,
|
|
||||||
"default_phone_region" => "DE",
|
|
||||||
"versions_retention_obligation" => "auto, 90",
|
|
||||||
"simpleSignUpLink.shown" => false,
|
|
||||||
);
|
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
assert node.has_bundle('php')
|
import json
|
||||||
|
|
||||||
from shlex import quote
|
|
||||||
from os.path import join
|
assert node.has_bundle('php')
|
||||||
from mako.template import Template
|
|
||||||
|
|
||||||
version = node.metadata.get('nextcloud/version')
|
version = node.metadata.get('nextcloud/version')
|
||||||
|
|
||||||
|
@ -69,19 +68,22 @@ symlinks = {
|
||||||
|
|
||||||
files = {
|
files = {
|
||||||
'/etc/nextcloud/managed.config.php': {
|
'/etc/nextcloud/managed.config.php': {
|
||||||
'content_type': 'mako',
|
|
||||||
'owner': 'www-data',
|
'owner': 'www-data',
|
||||||
'group': 'www-data',
|
'group': 'www-data',
|
||||||
'mode': '640',
|
'mode': '640',
|
||||||
'context': {
|
|
||||||
'db_password': node.metadata.get('postgresql/roles/nextcloud/password'),
|
|
||||||
'hostname': node.metadata.get('nextcloud/hostname'),
|
|
||||||
},
|
|
||||||
'needs': [
|
'needs': [
|
||||||
'directory:/etc/nextcloud',
|
'directory:/etc/nextcloud',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
}
|
'/etc/nextcloud/managed.config.json': {
|
||||||
|
'content': json.dumps(node.metadata.get('nextcloud/config'), indent=4, sort_keys=True),
|
||||||
|
'owner': 'www-data',
|
||||||
|
'group': 'www-data',
|
||||||
|
'mode': '640',
|
||||||
|
'needs': [
|
||||||
|
'directory:/etc/nextcloud',
|
||||||
|
],
|
||||||
|
},}
|
||||||
|
|
||||||
# SETUP
|
# SETUP
|
||||||
|
|
||||||
|
@ -124,7 +126,7 @@ files['/opt/nextcloud_upgrade_status.php'] = {
|
||||||
'action:extract_nextcloud',
|
'action:extract_nextcloud',
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
actions['upgrade_nextcloud'] = {
|
actions['upgrade_nextcloud'] = {
|
||||||
'command': repo.libs.nextcloud.occ('upgrade'),
|
'command': repo.libs.nextcloud.occ('upgrade'),
|
||||||
'unless': 'sudo -u www-data php /opt/nextcloud_upgrade_status.php; test $? -ne 99',
|
'unless': 'sudo -u www-data php /opt/nextcloud_upgrade_status.php; test $? -ne 99',
|
||||||
|
|
|
@ -45,7 +45,8 @@ defaults = {
|
||||||
},
|
},
|
||||||
'nextcloud': {
|
'nextcloud': {
|
||||||
'admin_user': 'admin',
|
'admin_user': 'admin',
|
||||||
'admin_pass': repo.vault.password_for(f'{node.name} nextcloud admin pw'),
|
'admin_pass': repo.vault.password_for(f'{node.name} nextcloud admin pw').value,
|
||||||
|
'config': {},
|
||||||
},
|
},
|
||||||
'php': {
|
'php': {
|
||||||
'post_max_size': '32G',
|
'post_max_size': '32G',
|
||||||
|
@ -65,7 +66,7 @@ defaults = {
|
||||||
'postgresql': {
|
'postgresql': {
|
||||||
'roles': {
|
'roles': {
|
||||||
'nextcloud': {
|
'nextcloud': {
|
||||||
'password': repo.vault.password_for(f'{node.name} nextcloud db pw'),
|
'password': repo.vault.password_for(f'{node.name} nextcloud db pw').value,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'databases': {
|
'databases': {
|
||||||
|
@ -93,6 +94,57 @@ defaults = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@metadata_reactor.provides(
|
||||||
|
'nextcloud/config',
|
||||||
|
)
|
||||||
|
def config(metadata):
|
||||||
|
return {
|
||||||
|
'nextcloud': {
|
||||||
|
'config': {
|
||||||
|
'dbuser': 'nextcloud',
|
||||||
|
'dbpassword': metadata.get('postgresql/roles/nextcloud/password'),
|
||||||
|
'dbname': 'nextcloud',
|
||||||
|
'dbhost': 'localhost',
|
||||||
|
'dbtype': 'pgsql',
|
||||||
|
'datadirectory': '/var/lib/nextcloud',
|
||||||
|
'dbport': '5432',
|
||||||
|
'apps_paths': [
|
||||||
|
{
|
||||||
|
'path': '/opt/nextcloud/apps',
|
||||||
|
'url': '/apps',
|
||||||
|
'writable': False
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'path': '/var/lib/nextcloud/.userapps',
|
||||||
|
'url': '/userapps',
|
||||||
|
'writable': True
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'cache_path': '/var/lib/nextcloud/.cache',
|
||||||
|
'upgrade.disable-web': True,
|
||||||
|
'memcache.local': '\OC\Memcache\Redis',
|
||||||
|
'memcache.locking': '\OC\Memcache\Redis',
|
||||||
|
'memcache.distributed': '\OC\Memcache\Redis',
|
||||||
|
'redis':{
|
||||||
|
'host': '/var/run/redis/nextcloud.sock'
|
||||||
|
},
|
||||||
|
'trusted_domains':[
|
||||||
|
'localhost',
|
||||||
|
'127.0.0.1',
|
||||||
|
metadata.get('nextcloud/hostname'),
|
||||||
|
],
|
||||||
|
'log_type': 'syslog',
|
||||||
|
'syslog_tag': 'nextcloud',
|
||||||
|
'logfile': '',
|
||||||
|
'loglevel':3,
|
||||||
|
'default_phone_region': 'DE',
|
||||||
|
'versions_retention_obligation': 'auto, 90',
|
||||||
|
'simpleSignUpLink.shown': False,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@metadata_reactor.provides(
|
@metadata_reactor.provides(
|
||||||
'zfs/datasets',
|
'zfs/datasets',
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue