Commit 631492bc authored by Boxiang Sun's avatar Boxiang Sun

peertube: Convert instance.cfg.in to jinja template

parent 0847a714
Pipeline #24799 passed with stage
in 0 seconds
[buildout] [buildout]
extends = extends =
${monitor-template:output} {{ monitor_template_output }}
parts = parts =
service-redis service-redis
...@@ -20,144 +20,144 @@ parts = ...@@ -20,144 +20,144 @@ parts =
nginx-listen-promise nginx-listen-promise
peertube-listen-promise peertube-listen-promise
eggs-directory = ${buildout:eggs-directory} eggs-directory = {{ eggs_directory }}
develop-eggs-directory = ${buildout:develop-eggs-directory} develop-eggs-directory = {{ develop_eggs_directory }}
offline = true offline = true
[directory] [directory]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc etc = ${buildout:directory}/etc
srv = $${buildout:directory}/srv srv = ${buildout:directory}/srv
var = $${buildout:directory}/var var = ${buildout:directory}/var
log = $${:var}/log log = ${:var}/log
run = $${:var}/run run = ${:var}/run
www = $${:var}/www www = ${:var}/www
crontabs = $${:etc}/crontabs crontabs = ${:etc}/crontabs
cron-entries = $${:etc}/cron.d cron-entries = ${:etc}/cron.d
cronstamps = $${:etc}/cronstamps cronstamps = ${:etc}/cronstamps
cron-lines = $${:etc}/cron.lines cron-lines = ${:etc}/cron.lines
nginx = $${:etc}/nginx nginx = ${:etc}/nginx
peertube_nginx_log = $${:log}/nginx peertube_nginx_log = ${:log}/nginx
varnginx = $${:var}/nginx varnginx = ${:var}/nginx
services = $${:etc}/service services = ${:etc}/service
peertube_directory = $${:www}/peertube peertube_directory = ${:www}/peertube
config = $${:peertube_directory}/config config = ${:peertube_directory}/config
storage = $${:peertube_directory}/storage storage = ${:peertube_directory}/storage
versions = $${:peertube_directory}/versions versions = ${:peertube_directory}/versions
ssl = $${:etc}/ssl ssl = ${:etc}/ssl
[peertube-passwd] [peertube-passwd]
recipe = slapos.cookbook:generate.password recipe = slapos.cookbook:generate.password
storage-path = $${directory:etc}/.peertube_user storage-path = ${directory:etc}/.peertube_user
bytes = 8 bytes = 8
username = root username = root
[peertube-yaml] [peertube-yaml]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${template-peertube:output} url = {{ template_peertube }}
output = $${directory:config}/peertube.yaml output = ${directory:config}/peertube.yaml
[peertube-listen-promise] [peertube-listen-promise]
<= monitor-promise-base <= monitor-promise-base
promise = check_url_available promise = check_url_available
name = peertube_listen.py name = peertube_listen.py
config-verify = 0 config-verify = 0
config-url = https://$${frontend:connection-domain} config-url = https://${frontend:connection-domain}
[peertube-service] [peertube-service]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${template-peertube-service:output} url = {{ tempalte_peertube_service }}
output = $${directory:services}/peertube output = ${directory:services}/peertube
[postgresql-password] [postgresql-password]
recipe = slapos.cookbook:generate.password recipe = slapos.cookbook:generate.password
[postgresql] [postgresql]
recipe = slapos.cookbook:postgres recipe = slapos.cookbook:postgres
bin = ${postgresql10:location}/bin/ bin = {{ postgresql10_location }}/bin/
services = $${directory:services} services = ${directory:services}
dbname = peertube_prod dbname = peertube_prod
superuser = peertube superuser = peertube
password = $${postgresql-password:passwd} password = ${postgresql-password:passwd}
pgdata-directory = $${directory:srv}/postgresql pgdata-directory = ${directory:srv}/postgresql
ipv4 = $${instance-parameter:ipv4-random} ipv4 = ${instance-parameter:ipv4-random}
# disable listening on ipv6 # disable listening on ipv6
ipv6 = ipv6 =
port = 5432 port = 5432
[postgresql-binary-link] [postgresql-binary-link]
recipe = slapos.cookbook:symbolic.link recipe = slapos.cookbook:symbolic.link
target-directory = $${directory:bin} target-directory = ${directory:bin}
link-binary = $${postgresql:bin}/postgres $${postgresql:bin}/psql link-binary = ${postgresql:bin}/postgres ${postgresql:bin}/psql
################################# #################################
# Nginx service # Nginx service
################################# #################################
[nginx-service] [nginx-service]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${template-nginx-service:output} url = {{ tempalte_nginx_service }}
output = $${directory:services}/nginx output = ${directory:services}/nginx
virtual-depends = virtual-depends =
$${nginx-configuration:ip} ${nginx-configuration:ip}
[nginx-listen-promise] [nginx-listen-promise]
<= monitor-promise-base <= monitor-promise-base
promise = check_url_available promise = check_url_available
name = nginx_listen.py name = nginx_listen.py
config-verify = 0 config-verify = 0
config-url = https://[$${nginx-configuration:ip}]:$${nginx-configuration:port} config-url = https://[${nginx-configuration:ip}]:${nginx-configuration:port}
[nginx-configuration] [nginx-configuration]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${template-nginx-configuration:output} url = {{ template_nginx_configration }}
output = $${directory:etc}/nginx.cfg output = ${directory:etc}/nginx.cfg
access_log = $${directory:log}/nginx-access.log access_log = ${directory:log}/nginx-access.log
error_log = $${directory:log}/nginx-error.log error_log = ${directory:log}/nginx-error.log
ip = $${instance-parameter:ipv6-random} ip = ${instance-parameter:ipv6-random}
port = 9443 port = 9443
ssl_key = $${directory:ssl}/nginx.key ssl_key = ${directory:ssl}/nginx.key
ssl_csr = $${directory:ssl}/nginx.csr ssl_csr = ${directory:ssl}/nginx.csr
ssl_crt = $${directory:ssl}/nginx.crt ssl_crt = ${directory:ssl}/nginx.crt
############# #############
# Redis # # Redis #
############# #############
[redis] [redis]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
srv = $${directory:srv}/redis srv = ${directory:srv}/redis
log = $${directory:log}/redis log = ${directory:log}/redis
[service-redis] [service-redis]
recipe = slapos.cookbook:redis.server recipe = slapos.cookbook:redis.server
wrapper = $${directory:services}/redis wrapper = ${directory:services}/redis
promise-wrapper = $${directory:bin}/redis-promise promise-wrapper = ${directory:bin}/redis-promise
server-dir = $${redis:srv} server-dir = ${redis:srv}
config-file = $${directory:etc}/redis.conf config-file = ${directory:etc}/redis.conf
log-file = $${redis:log}/redis.log log-file = ${redis:log}/redis.log
pid-file = $${directory:run}/redis.pid pid-file = ${directory:run}/redis.pid
use-passwd = false use-passwd = false
unixsocket = $${:server-dir}/redis.socket unixsocket = ${:server-dir}/redis.socket
# port = 0 means "don't listen on TCP at all" - listen only on unix socket # port = 0 means "don't listen on TCP at all" - listen only on unix socket
ipv6 = ::1 ipv6 = ::1
port = 0 port = 0
# server-bin = ${buildout:parts-directory}/redis/bin/redis-server # server-bin = ${buildout:parts-directory}/redis/bin/redis-server
server-bin = ${redis28:location}/bin/redis-server server-bin = {{ redis_binprefix }}/redis-server
cli-bin = ${redis28:location}/bin/redis-cli cli-bin = {{ redis_binprefix }}/redis-cli
depend = depend =
$${logrotate-entry-redis:recipe} ${logrotate-entry-redis:recipe}
[promise-redis] [promise-redis]
<= monitor-promise-base <= monitor-promise-base
promise = check_command_execute promise = check_command_execute
name = promise-redis.py name = promise-redis.py
config-command = $${service-redis:promise-wrapper} config-command = ${service-redis:promise-wrapper}
[logrotate-entry-redis] [logrotate-entry-redis]
<= logrotate-entry-base <= logrotate-entry-base
log = $${redis:log}/*.log log = ${redis:log}/*.log
name = redis name = redis
################################# #################################
...@@ -165,38 +165,38 @@ name = redis ...@@ -165,38 +165,38 @@ name = redis
################################# #################################
[dcron-service] [dcron-service]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${template-dcron-service:output} url = {{ template_dcron_service }}
output = $${directory:services}/crond output = ${directory:services}/crond
logfile = $${directory:log}/crond.log logfile = ${directory:log}/crond.log
[peertube-backup-script] [peertube-backup-script]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${template-peertube-backup-script:output} url = {{ tempalte_peertube_backup }}
output = $${directory:etc}/$${:_buildout_section_name_} output = ${directory:etc}/${:_buildout_section_name_}
[peertube-backup-cron] [peertube-backup-cron]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${template-crontab-line:output} url = {{ template_crontab_line }}
output = $${directory:cron-lines}/$${:_buildout_section_name_} output = ${directory:cron-lines}/${:_buildout_section_name_}
script = $${peertube-backup-script:output} script = ${peertube-backup-script:output}
frequency = daily frequency = daily
[activate-crontab-file] [activate-crontab-file]
# XXX File is never removed # XXX File is never removed
recipe = plone.recipe.command recipe = plone.recipe.command
stop-on-error = true stop-on-error = true
command = ${coreutils-output:cat} ${template-crontab:output} $${peertube-backup-cron:output} | ${dcron-output:crontab} -c $${directory:crontabs} - command = {{ coreutils_cat }} {{ template_crontab }} ${peertube-backup-cron:output} | {{ dcron_output }} -c ${directory:crontabs} -
[peertube-database-resiliency-exclude-file] [peertube-database-resiliency-exclude-file]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
inline = {{ "$${postgresql:pgdata-directory}/**" }} inline = {{ "${postgresql:pgdata-directory}/**" }}
output = $${directory:srv}/exporter.exclude output = ${directory:srv}/exporter.exclude
[peertube-database-resiliency-after-import-script] [peertube-database-resiliency-after-import-script]
recipe = collective.recipe.template recipe = collective.recipe.template
input = inline: #!/bin/sh input = inline: #!/bin/sh
$${postgresql:bin}/pg_restore -h $${postgresql:pgdata-directory} -c -U peertube -d peertube_prod $${directory:peertube_directory}/peertube_prod-dump.db ${postgresql:bin}/pg_restore -h ${postgresql:pgdata-directory} -c -U peertube -d peertube_prod ${directory:peertube_directory}/peertube_prod-dump.db
output = $${directory:srv}/runner-import-restore output = ${directory:srv}/runner-import-restore
mode = 755 mode = 755
################################# #################################
...@@ -204,11 +204,11 @@ mode = 755 ...@@ -204,11 +204,11 @@ mode = 755
################################# #################################
[instance-parameter] [instance-parameter]
recipe = slapos.cookbook:slapconfiguration recipe = slapos.cookbook:slapconfiguration
computer = $${slap-connection:computer-id} computer = ${slap-connection:computer-id}
partition = $${slap-connection:partition-id} partition = ${slap-connection:partition-id}
url = $${slap-connection:server-url} url = ${slap-connection:server-url}
key = $${slap-connection:key-file} key = ${slap-connection:key-file}
cert = $${slap-connection:cert-file} cert = ${slap-connection:cert-file}
configuration._ = {} configuration._ = {}
[frontend] [frontend]
...@@ -218,29 +218,28 @@ name = PeerTube Server Frontend ...@@ -218,29 +218,28 @@ name = PeerTube Server Frontend
# XXX We have hardcoded SR URL here. # XXX We have hardcoded SR URL here.
software-url = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg software-url = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg
slave = true slave = true
state = stopped
config-type = websocket config-type = websocket
config-websocket-path-list = /socket.io /socket /tracker/socket config-websocket-path-list = /socket.io /socket /tracker/socket
config-url = https://[$${nginx-configuration:ip}]:$${nginx-configuration:port} config-url = https://[${nginx-configuration:ip}]:${nginx-configuration:port}
return = domain secure_access return = domain secure_access
[slap-configuration] [slap-configuration]
recipe = slapos.cookbook:slapconfiguration recipe = slapos.cookbook:slapconfiguration
computer = $${slap_connection:computer_id} computer = ${slap_connection:computer_id}
partition = $${slap_connection:partition_id} partition = ${slap_connection:partition_id}
url = $${slap_connection:server_url} url = ${slap_connection:server_url}
key = $${slap_connection:key_file} key = ${slap_connection:key_file}
cert = $${slap_connection:cert_file} cert = ${slap_connection:cert_file}
[peertube-parameters] [peertube-parameters]
recipe = slapos.recipe.build recipe = slapos.recipe.build
slapparameter-dict = $${slap-configuration:configuration} slapparameter-dict = ${slap-configuration:configuration}
default-frontend-url = $${frontend:config-url} default-frontend-url = ${frontend:config-url}
working-dir = ${peertube:location} working-dir = {{ peertube_location }}
node-config-dir=$${directory:config} node-config-dir=${directory:config}
ipv4-port=9000 ipv4-port=9000
node-env=production node-env=production
npm-bin=${nodejs:location}/bin/npm npm-bin={{ nodejs_location }}/bin/npm
default-parameters = default-parameters =
{ {
"name" : "Peertube in Slapos", "name" : "Peertube in Slapos",
...@@ -285,9 +284,9 @@ init = ...@@ -285,9 +284,9 @@ init =
[publish-connection-parameter] [publish-connection-parameter]
recipe = slapos.cookbook:publish recipe = slapos.cookbook:publish
frontend-hostname = $${frontend:connection-domain} frontend-hostname = ${frontend:connection-domain}
frontend-url = $${peertube-parameters:frontend-url} frontend-url = ${peertube-parameters:frontend-url}
backend-url = $${frontend:config-url} backend-url = ${frontend:config-url}
password = $${peertube-passwd:passwd} password = ${peertube-passwd:passwd}
username = root username = root
...@@ -88,9 +88,27 @@ url = ${:_profile_base_location_}/${:_update_hash_filename_} ...@@ -88,9 +88,27 @@ url = ${:_profile_base_location_}/${:_update_hash_filename_}
destination = ${buildout:directory}/${:_buildout_section_name_} destination = ${buildout:directory}/${:_buildout_section_name_}
[instance-profile] [instance-profile]
recipe = slapos.recipe.template recipe = slapos.recipe.template:jinja2
url = ${:_profile_base_location_}/${:filename} url = ${:_profile_base_location_}/${:filename}
output = ${buildout:directory}/instance.cfg output = ${buildout:directory}/instance.cfg
context =
key develop_eggs_directory buildout:develop-eggs-directory
key eggs_directory buildout:eggs-directory
raw template_nginx_configration ${template-nginx-configuration:output}
raw monitor_template_output ${monitor-template:output}
raw template_peertube ${template-peertube:output}
raw tempalte_peertube_service ${template-peertube-service:output}
raw postgresql10_location ${postgresql10:location}
raw tempalte_nginx_service ${template-nginx-service:output}
raw redis_binprefix ${redis28:location}/bin
raw template_dcron_service ${template-dcron-service:output}
raw tempalte_peertube_backup ${template-peertube-backup-script:output}
raw template_crontab_line ${template-crontab-line:output}
raw coreutils_cat ${coreutils-output:cat}
raw template_crontab ${template-crontab:output}
raw dcron_output ${dcron-output:crontab}
raw peertube_location ${peertube:location}
raw nodejs_location ${nodejs:location}
[template-peertube-service] [template-peertube-service]
recipe = slapos.recipe.template recipe = slapos.recipe.template
......
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