Commit 109b4362 authored by Alain Takoudjou's avatar Alain Takoudjou

nextcloud sr: update config after nextcloud installation if any changes

parent cf8ca3a4
{% set trusted_domain_list = [] -%}
{% set proxy_list = [] -%}
{% for trusted_domain in parameter_dict['trusted-domain-list'].split() -%}
{% if trusted_domain.strip() -%}
{% do trusted_domain_list.append(trusted_domain.strip()) -%}
{% endif -%}
{% endfor -%}
{% for proxy in parameter_dict['trusted-proxy-list'].strip().split(' ') -%}
{% if proxy -%}
{% do proxy_list.append(proxy) -%}
{% endif -%}
{% endfor -%}
{
"system": {
"overwrite.cli.url": "{{ parameter_dict['cli-url'] }}",
"trusted_domains": [
{% if len(trusted_domain_list) > 0 -%}
{{ ' "' ~ trusted_domain_list | join('",\n "') ~ '"' }}
{% endif -%}
],
"trusted_proxies": [
{% if len(proxy_list) > 0 -%}
{{ ' "' ~ proxy_list | join('",\n "') ~ '"' }}
{% endif -%}
],
"dbname": "nextcloud",
"dbhost": "10.0.151.118:2099",
"mysql.utf8mb4": true,
"dbuser": "nextcloud",
"dbpassword": "insecure",
"redis": {
"host": "{{ parameter_dict['redis-socket'] }}",
"port": 0,
"timeout": 0
},
"logfile": "{{ parameter_dict['data-dir'] }}/nextcloud.log",
"datadirectory": "{{ parameter_dict['data-dir'] }}"
}
}
\ No newline at end of file
...@@ -123,6 +123,11 @@ ...@@ -123,6 +123,11 @@
"title": "Second authorized domain on nextcloud", "title": "Second authorized domain on nextcloud",
"description": "Trusted domain used to connect to Nextcloud instance.", "description": "Trusted domain used to connect to Nextcloud instance.",
"type": "string" "type": "string"
},
"instance.trusted-domain-3": {
"title": "Third authorized domain on nextcloud",
"description": "Trusted domain used to connect to Nextcloud instance.",
"type": "string"
} }
} }
} }
\ No newline at end of file
...@@ -41,6 +41,8 @@ trusted-domain-list = ...@@ -41,6 +41,8 @@ trusted-domain-list =
[${apache-php-configuration:ip}]:${apache-php-configuration:port} [${apache-php-configuration:ip}]:${apache-php-configuration:port}
${slap-parameter:instance.trusted-domain-1} ${slap-parameter:instance.trusted-domain-1}
${slap-parameter:instance.trusted-domain-2} ${slap-parameter:instance.trusted-domain-2}
${slap-parameter:instance.trusted-domain-3}
trusted-proxy-list = ${slap-parameter:instance.trusted-proxy-list} trusted-proxy-list = ${slap-parameter:instance.trusted-proxy-list}
cli-url = ${slap-parameter:instance.cli-url} cli-url = ${slap-parameter:instance.cli-url}
data-dir = ${nc-directory:data} data-dir = ${nc-directory:data}
...@@ -86,6 +88,7 @@ depends = ...@@ -86,6 +88,7 @@ depends =
${nextcloud-apache-httpd:recipe} ${nextcloud-apache-httpd:recipe}
${nextcloud-backup-cron:recipe} ${nextcloud-backup-cron:recipe}
${nextcloud-news-updater:recipe} ${nextcloud-news-updater:recipe}
${nextcloud-config-update:recipe}
[nextcloud-apache-httpd] [nextcloud-apache-httpd]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
...@@ -148,6 +151,26 @@ input = inline:#!/bin/sh ...@@ -148,6 +151,26 @@ input = inline:#!/bin/sh
output = ${directory:scripts}/nextcloud-news-updater output = ${directory:scripts}/nextcloud-news-updater
mode = 744 mode = 744
[nextcloud-config.json]
recipe = slapos.recipe.template:jinja2
template = {{ nextcloud_parameter_json }}
rendered = ${directory:etc}/nextcloud-config.json
extensions = jinja2.ext.do
context =
section parameter_dict instance-parameter
mode = 600
[nextcloud-config-update]
output = ${directory:scripts}/nextcloud-update
recipe = collective.recipe.template
input = inline:#!/bin/sh
if [ -f "${instance-parameter:nextcloud}/config/CAN_INSTALL" ]; then
# do not run this script if nextcloud is not installed yet.
exit 1;
fi
${php-bin:wrapper-path} ${instance-parameter:nextcloud}/occ config:import ${nextcloud-config.json:rendered}
mode = 744
[php-bin] [php-bin]
recipe = slapos.cookbook:wrapper recipe = slapos.cookbook:wrapper
wrapper-path = ${directory:bin}/php wrapper-path = ${directory:bin}/php
...@@ -172,6 +195,7 @@ instance.turn-server = ...@@ -172,6 +195,7 @@ instance.turn-server =
instance.turn-secret = instance.turn-secret =
instance.cli-url = ${apache-php-configuration:url} instance.cli-url = ${apache-php-configuration:url}
instance.trusted-domain-1 = instance.trusted-domain-1 =
instance.trusted-domain-2 = instance.trusted-domain-2 =
instance.trusted-domain-3 =
instance.trusted-proxy-list = instance.trusted-proxy-list =
\ No newline at end of file
...@@ -16,7 +16,7 @@ mode = 0644 ...@@ -16,7 +16,7 @@ mode = 0644
url = https://download.nextcloud.com/server/releases/nextcloud-16.0.3.tar.bz2 url = https://download.nextcloud.com/server/releases/nextcloud-16.0.3.tar.bz2
md5sum = d81902d2dec5d547779bec6336a438be md5sum = d81902d2dec5d547779bec6336a438be
[template-nextcloud-install.sh] [template-nextcloud-install.sh]
<= nc-download-base <= nc-download-base
filename = nextcloud-install.sh.in filename = nextcloud-install.sh.in
md5sum = a2281f86f6a26a8ff40a57a495505977 md5sum = a2281f86f6a26a8ff40a57a495505977
...@@ -26,12 +26,17 @@ md5sum = a2281f86f6a26a8ff40a57a495505977 ...@@ -26,12 +26,17 @@ md5sum = a2281f86f6a26a8ff40a57a495505977
filename = apache-httpd.conf.in filename = apache-httpd.conf.in
md5sum = f3bca64bf991526fd8221035a86aacbf md5sum = f3bca64bf991526fd8221035a86aacbf
[template-nextcloud-config.json]
<= nc-download-base
filename = nextcloud-config.json.in
md5sum = c6eb032b17b38f3d04d4a029c9bdcc60
[template-nextcloud-instance] [template-nextcloud-instance]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
template = ${:_profile_base_location_}/nextcloud-instance.cfg.in template = ${:_profile_base_location_}/nextcloud-instance.cfg.in
rendered = ${buildout:directory}/instance-nextcloud.cfg rendered = ${buildout:directory}/instance-nextcloud.cfg
extensions = jinja2.ext.do extensions = jinja2.ext.do
md5sum = 0dd3eea61be79135810b0c2286c520b5 md5sum = 5c721c7eb8a06147b849a65ba92becba
context = context =
key gzip_location gzip:location key gzip_location gzip:location
key python3_location python3.6.6:location key python3_location python3.6.6:location
...@@ -41,6 +46,7 @@ context = ...@@ -41,6 +46,7 @@ context =
raw redis_cli ${redis:location}/bin/redis-cli raw redis_cli ${redis:location}/bin/redis-cli
raw nextcloud_install_sh ${template-nextcloud-install.sh:location}/${template-nextcloud-install.sh:filename} raw nextcloud_install_sh ${template-nextcloud-install.sh:location}/${template-nextcloud-install.sh:filename}
raw nextcloud_apache_httpd ${template-apache-httpd:location}/${template-apache-httpd:filename} raw nextcloud_apache_httpd ${template-apache-httpd:location}/${template-apache-httpd:filename}
raw nextcloud_parameter_json ${template-nextcloud-config.json:location}/${template-nextcloud-config.json:filename}
[custom-application-deployment] [custom-application-deployment]
path = ${template-nextcloud-instance:rendered} path = ${template-nextcloud-instance:rendered}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment