This commit is contained in:
mwiegand 2021-06-20 23:55:42 +02:00
parent 9ebc0209ce
commit db2ace238d
2 changed files with 39 additions and 34 deletions

View file

@ -8,4 +8,12 @@ $CONFIG = array (
'dbtype' => 'pgsql', 'dbtype' => 'pgsql',
'datadirectory' => '/var/lib/nextcloud', 'datadirectory' => '/var/lib/nextcloud',
'dbport' => '5432', 'dbport' => '5432',
'apps_paths' => [
[
'path'=> '/var/lib/nextcloud/.apps',
'url' => '/userapps',
'writable' => true,
],
],
'cache_path' => '/var/lib/nextcloud/.cache',
); );

View file

@ -16,10 +16,15 @@ downloads[f'/tmp/nextcloud-{version}.tar.bz2'] = {
'sha256': node.metadata.get('nextcloud/sha256'), 'sha256': node.metadata.get('nextcloud/sha256'),
'triggered': True, 'triggered': True,
} }
actions['delete_nextcloud'] = {
'command': f'rm -rf /opt/nextcloud/*',
'triggered': True,
}
actions['extract_nextcloud'] = { actions['extract_nextcloud'] = {
'command': f'tar xfvj /tmp/nextcloud-{version}.tar.bz2 --strip 1 -C /opt/nextcloud nextcloud', 'command': f'tar xfvj /tmp/nextcloud-{version}.tar.bz2 --strip 1 -C /opt/nextcloud nextcloud',
'unless': f"""php -r 'include "/opt/nextcloud/version.php"; echo "$OC_VersionString";' | grep -q '^{version}$'""", 'unless': f"""php -r 'include "/opt/nextcloud/version.php"; echo "$OC_VersionString";' | grep -q '^{version}$'""",
'preceded_by': [ 'preceded_by': [
'action:delete_nextcloud',
f'download:/tmp/nextcloud-{version}.tar.bz2', f'download:/tmp/nextcloud-{version}.tar.bz2',
], ],
'needs': [ 'needs': [
@ -27,47 +32,27 @@ actions['extract_nextcloud'] = {
], ],
} }
# DIRECTORIES # DIRECTORIES, FILES AND SYMLINKS
directories['/opt/nextcloud'] = {} directories['/opt/nextcloud'] = {}
directories['/opt/nextcloud/config'] = { directories['/opt/nextcloud/config'] = {
'owner': 'www-data', 'owner': 'www-data',
'group': 'www-data', 'group': 'www-data',
'mode': '0770',
'needs': [ 'needs': [
'action:extract_nextcloud', 'action:delete_nextcloud',
],
}
directories['/opt/nextcloud/apps'] = {
'owner': 'www-data',
'group': 'www-data',
'needs': [
'action:extract_nextcloud',
], ],
} }
directories['/var/lib/nextcloud'] = { directories['/var/lib/nextcloud'] = {
'owner': 'www-data', 'owner': 'www-data',
'group': 'www-data', 'group': 'www-data',
'mode': '0770',
} }
actions['chown_/opt/nextcloud/apps'] = { directories['/var/lib/nextcloud/.apps'] = {
'command': 'chown -R www-data:www-data /opt/nextcloud/apps', 'owner': 'www-data',
'unless': '! stat -c "%U:%G" /opt/nextcloud/apps/* | grep -vq www-data:www-data', 'group': 'www-data',
'needs': [ }
'action:extract_nextcloud', directories['/var/lib/nextcloud/.cache'] = {
],
}
# SETUP
files['/opt/nextcloud/config/config.php'] = {
'content_type': 'any',
'owner': 'www-data', 'owner': 'www-data',
'group': 'www-data', 'group': 'www-data',
'mode': '640',
'needs': [
'action:extract_nextcloud',
],
} }
files['/opt/nextcloud/config/managed.config.php'] = { files['/opt/nextcloud/config/managed.config.php'] = {
'content_type': 'mako', 'content_type': 'mako',
@ -78,9 +63,21 @@ files['/opt/nextcloud/config/managed.config.php'] = {
'db_password': node.metadata.get('postgresql/roles/nextcloud/password'), 'db_password': node.metadata.get('postgresql/roles/nextcloud/password'),
}, },
'needs': [ 'needs': [
'action:extract_nextcloud', 'action:delete_nextcloud',
'directory:/opt/nextcloud/config',
], ],
} }
actions['symlink_/opt/nextcloud/userapps'] = {
'command': f'ln -s /var/lib/nextcloud/.apps /opt/nextcloud/userapps && chown www-data:www-data /opt/nextcloud/userapps',
'unless': 'readlink /opt/nextcloud/userapps | grep -q /var/lib/nextcloud/.apps',
'needs': [
'action:delete_nextcloud',
'directory:/var/lib/nextcloud/.apps',
],
}
# SETUP
actions['install_nextcloud'] = { actions['install_nextcloud'] = {
'command': occ( 'command': occ(
'maintenance:install', 'maintenance:install',
@ -96,15 +93,15 @@ actions['install_nextcloud'] = {
), ),
'unless': occ('status') + ' | grep -q "installed: true"', 'unless': occ('status') + ' | grep -q "installed: true"',
'needs': [ 'needs': [
'postgres_db:nextcloud',
f"directory:/var/lib/nextcloud",
'directory:/opt/nextcloud', 'directory:/opt/nextcloud',
'directory:/opt/nextcloud/config', 'directory:/opt/nextcloud/config',
'directory:/opt/nextcloud/apps', 'directory:/var/lib/nextcloud',
'action:chown_/opt/nextcloud/apps', 'directory:/var/lib/nextcloud/.apps',
'action:extract_nextcloud', 'directory:/var/lib/nextcloud/.cache',
'file:/opt/nextcloud/config/config.php',
'file:/opt/nextcloud/config/managed.config.php', 'file:/opt/nextcloud/config/managed.config.php',
'action:extract_nextcloud',
'action:symlink_/opt/nextcloud/userapps',
'postgres_db:nextcloud',
], ],
} }