Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
slapos
Commits
96d96922
Commit
96d96922
authored
Nov 17, 2022
by
Boxiang Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
peertube: use double template
parent
929143e3
Pipeline
#24835
passed with stage
in 0 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
240 additions
and
248 deletions
+240
-248
software/peertube/buildout.hash.cfg
software/peertube/buildout.hash.cfg
+3
-3
software/peertube/instance-peertube.cfg.in
software/peertube/instance-peertube.cfg.in
+193
-20
software/peertube/instance.cfg.in
software/peertube/instance.cfg.in
+35
-196
software/peertube/software.cfg
software/peertube/software.cfg
+4
-27
software/peertube/template-nginx.cfg.in
software/peertube/template-nginx.cfg.in
+2
-1
software/peertube/template-peertube.yaml.in
software/peertube/template-peertube.yaml.in
+3
-1
No files found.
software/peertube/buildout.hash.cfg
View file @
96d96922
...
...
@@ -17,12 +17,12 @@ filename = instance.cfg.in
# md5sum = a1f5431f98c2401282064d40bf809eed
[instance-peertube]
filename
= instance-peertube.cfg.in
# md5sum =
458870b70c33a1621b68961ae2372ad5
_update_hash_filename_
= instance-peertube.cfg.in
# md5sum =
edac55a3dd6b666a1134a2f4d9bd5cfd
[template-nginx-service]
filename = template-nginx-service.sh.in
md5sum = 458870b70c33a1621b68961ae2372ad5
#
md5sum = 458870b70c33a1621b68961ae2372ad5
[template-peertube-service]
filename = template-peertube-service.sh.in
...
...
software/peertube/instance-peertube.cfg.in
View file @
96d96922
[buildout]
extends =
${monitor-template:output
}
{{ monitor_template }
}
parts =
service-redis
promise-redis
postgresql
postgresql-binary-link
nginx-service
nginx-listen-promise
peertube-yaml
peertube-service
peertube-listen-promise
peertube-parameters
dcron-service
activate-crontab-file
peertube-backup-cron
peertube-database-resiliency-after-import-script
peertube-database-resiliency-exclude-file
publish-connection-parameter
eggs-directory =
${buildout:eggs-directory
}
develop-eggs-directory =
${buildout:develop-eggs-directory
}
eggs-directory =
{{ eggs_directory }
}
develop-eggs-directory =
{{ develop_eggs_directory }
}
offline = true
[directory]
recipe = slapos.cookbook:mkdirectory
etc = ${buildout:directory}/etc
srv = ${buildout:directory}/srv
var = ${buildout:directory}/var
log = ${:var}/log
run = ${:var}/run
www = ${:var}/www
crontabs = ${:etc}/crontabs
cron-entries = ${:etc}/cron.d
cronstamps = ${:etc}/cronstamps
cron-lines = ${:etc}/cron.lines
nginx = ${:etc}/nginx
peertube_nginx_log = ${:log}/nginx
varnginx = ${:var}/nginx
services = ${:etc}/service
peertube_directory = ${:www}/peertube
config = ${:peertube_directory}/config
storage = ${:peertube_directory}/storage
versions = ${:peertube_directory}/versions
ssl = ${:etc}/ssl
##################
# Postgresql #
##################
[postgresql-password]
recipe = slapos.cookbook:generate.password
[postgresql]
recipe = slapos.cookbook:postgres
bin = {{ postgresql10_location }}/bin/
services = ${directory:services}
dbname = peertube_prod
superuser = peertube
password = ${postgresql-password:passwd}
pgdata-directory = ${directory:srv}/postgresql
ipv44 = {{ slapparameter_dict.get('ipv4-random') }}
ipv4 = {{ ipv4_random }}
# disable listening on ipv6
ipv6 =
port = 5432
[postgresql-binary-link]
recipe = slapos.cookbook:symbolic.link
target-directory = ${directory:bin}
link-binary = ${postgresql:bin}/postgres ${postgresql:bin}/psql
#############
# Nginx #
#############
[nginx-service]
recipe = slapos.recipe.template
url = {{ tempalte_nginx_service }}
output = ${directory:services}/nginx
virtual-depends =
${nginx-configuration:ip}
[nginx-listen-promise]
<= monitor-promise-base
promise = check_url_available
name = nginx_listen.py
config-verify = 0
config-url = https://[${nginx-configuration:ip}]:${nginx-configuration:port}
[nginx-configuration]
recipe = slapos.recipe.template
url = {{ template_nginx_configration }}
output = ${directory:etc}/nginx.cfg
access_log = ${directory:log}/nginx-access.log
error_log = ${directory:log}/nginx-error.log
ipv6 = {{ slapparameter_dict.get('ipv6-random') }}
ip = {{ ipv6_random }}
port = 9443
ssl_key = ${directory:ssl}/nginx.key
ssl_csr = ${directory:ssl}/nginx.csr
ssl_crt = ${directory:ssl}/nginx.crt
#############
# Redis #
#############
[redis]
recipe = slapos.cookbook:mkdirectory
srv = ${directory:srv}/redis
log = ${directory:log}/redis
[service-redis]
recipe = slapos.cookbook:redis.server
wrapper = ${directory:services}/redis
promise-wrapper = ${directory:bin}/redis-promise
server-dir = ${redis:srv}
config-file = ${directory:etc}/redis.conf
log-file = ${redis:log}/redis.log
pid-file = ${directory:run}/redis.pid
use-passwd = false
unixsocket = ${:server-dir}/redis.socket
# port = 0 means "don't listen on TCP at all" - listen only on unix socket
ipv6 = ::1
port = 0
server-bin = {{ redis_binprefix }}/redis-server
cli-bin = {{ redis_binprefix }}/redis-cli
depend =
${logrotate-entry-redis:recipe}
[promise-redis]
<= monitor-promise-base
promise = check_command_execute
name = promise-redis.py
config-command = ${service-redis:promise-wrapper}
[logrotate-entry-redis]
<= logrotate-entry-base
log = ${redis:log}/*.log
name = redis
################
# Peertube #
################
[peertube-passwd]
recipe = slapos.cookbook:generate.password
storage-path =
{{ directory_etc }
}/.peertube_user
storage-path =
${directory:etc
}/.peertube_user
bytes = 8
username = root
[peertube-yaml]
recipe = slapos.recipe.template
url =
${template-peertube-yaml:output
}
output =
{{ directory_config }
}/peertube.yaml
url =
{{ template_peertube_yaml }
}
output =
${directory:config
}/peertube.yaml
[peertube-listen-promise]
<= monitor-promise-base
promise = check_url_available
name = peertube_listen.py
config-verify = 0
config-url = https://$
$
{frontend:connection-domain}
config-url = https://${frontend:connection-domain}
[peertube-service]
recipe = slapos.recipe.template
url = ${template-peertube-service:output}
output = {{ directory_services }}/peertube
url = {{ tempalte_peertube_service }}
output = ${directory:services}/peertube
[peertube-database-resiliency-exclude-file]
recipe = slapos.recipe.template:jinja2
inline = {{ "${postgresql:pgdata-directory}/**" }}
output = ${directory:srv}/exporter.exclude
[peertube-database-resiliency-after-import-script]
recipe = collective.recipe.template
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
output = ${directory:srv}/runner-import-restore
mode = 755
#################################
# Cron service #
#################################
[dcron-service]
recipe = slapos.recipe.template
url = {{ template_dcron_service }}
output = ${directory:services}/crond
logfile = ${directory:log}/crond.log
[peertube-backup-script]
recipe = slapos.recipe.template
url = {{ tempalte_peertube_backup }}
output = ${directory:etc}/${:_buildout_section_name_}
[peertube-backup-cron]
recipe = slapos.recipe.template
url = {{ template_crontab_line }}
output = ${directory:cron-lines}/${:_buildout_section_name_}
script = ${peertube-backup-script:output}
frequency = daily
[activate-crontab-file]
# XXX File is never removed
recipe = plone.recipe.command
stop-on-error = true
command = {{ coreutils_cat }} {{ template_crontab }} ${peertube-backup-cron:output} | {{ dcron_output }} -c ${directory:crontabs} -
[frontend]
<= slap-connection
...
...
@@ -48,17 +220,18 @@ state = stopped
{% endif -%}
config-type = websocket
config-websocket-path-list = /socket.io /socket /tracker/socket
config-url = https://[
{{ nginx_ip }}]:{{ nginx_port }
}
config-url = https://[
${nginx-configuration:ip}]:${nginx-configuration:port
}
return = domain secure_access
[peertube-parameters]
recipe = slapos.recipe.build
slapparameter-dict = {{ slapparameter_dict }}
default-frontend-url = $${frontend:config-url}
working-dir = ${peertube:location}
node-config-dir={{ directory_config }}
slapparameter-dict = {{ dumps(slapparameter_dict) }}
default-frontend-url = ${frontend:config-url}
working-dir = {{ peertube_location }}
ipv4-port=9000
node-config-dir=${directory:config}
node-env=production
npm-bin=
${nodejs:location
}/bin/npm
npm-bin=
{{ nodejs_location }
}/bin/npm
default-parameters =
{
"name" : "Peertube in Slapos",
...
...
@@ -103,8 +276,8 @@ init =
[publish-connection-parameter]
recipe = slapos.cookbook:publish
frontend-hostname = $
$
{frontend:connection-domain}
backend-url = $
$
{frontend:config-url}
frontend-url = $
$
{peertube-parameters:frontend-url}
password = $
$
{peertube-passwd:passwd}
frontend-hostname = ${frontend:connection-domain}
backend-url = ${frontend:config-url}
frontend-url = ${peertube-parameters:frontend-url}
password = ${peertube-passwd:passwd}
username = root
software/peertube/instance.cfg.in
View file @
96d96922
[buildout]
extends =
{{ monitor_template_output }}
parts =
service-redis
promise-redis
postgresql
postgresql-binary-link
nginx-service
dcron-service
activate-crontab-file
peertube-backup-cron
peertube-database-resiliency-after-import-script
peertube-database-resiliency-exclude-file
nginx-listen-promise
switch-softwaretype
eggs-directory =
{{ eggs_directory }
}
develop-eggs-directory =
{{ develop_eggs_directory }
}
eggs-directory =
${buildout:eggs-directory
}
develop-eggs-directory =
${buildout:develop-eggs-directory
}
offline = true
[directory]
recipe = slapos.cookbook:mkdirectory
etc = ${buildout:directory}/etc
srv = ${buildout:directory}/srv
var = ${buildout:directory}/var
log = ${:var}/log
run = ${:var}/run
www = ${:var}/www
crontabs = ${:etc}/crontabs
cron-entries = ${:etc}/cron.d
cronstamps = ${:etc}/cronstamps
cron-lines = ${:etc}/cron.lines
nginx = ${:etc}/nginx
peertube_nginx_log = ${:log}/nginx
varnginx = ${:var}/nginx
services = ${:etc}/service
peertube_directory = ${:www}/peertube
config = ${:peertube_directory}/config
storage = ${:peertube_directory}/storage
versions = ${:peertube_directory}/versions
ssl = ${:etc}/ssl
[peertube]
recipe = slapos.recipe.template:jinja2
url = {{ instance_peertube }}
output = ${buildout:directory}/instance-peertube.cfg
extensions = jinja2.ext.do
url = ${instance-peertube:target}
output = $${buildout:directory}/instance-peertube.cfg
context =
key develop_eggs_directory buildout:develop-eggs-directory
key eggs_directory buildout:eggs-directory
key develop_eggs_directory buildout:develop-eggs-directory
raw monitor_template ${monitor2-template:output}
key slapparameter_dict slap-configuration:configuration
key nginx_ip nginx-configuration:ip
key nginx_port nginx-configuration:port
raw directory_etc ${directory:etc}
raw directory_config ${directory:config}
raw directory_services ${directory:services}
ipv4_port = 9000
[postgresql-password]
recipe = slapos.cookbook:generate.password
[postgresql]
recipe = slapos.cookbook:postgres
bin = {{ postgresql10_location }}/bin/
services = ${directory:services}
dbname = peertube_prod
superuser = peertube
password = ${postgresql-password:passwd}
pgdata-directory = ${directory:srv}/postgresql
ipv4 = ${instance-parameter:ipv4-random}
# disable listening on ipv6
ipv6 =
port = 5432
[postgresql-binary-link]
recipe = slapos.cookbook:symbolic.link
target-directory = ${directory:bin}
link-binary = ${postgresql:bin}/postgres ${postgresql:bin}/psql
#################################
# Nginx service
#################################
[nginx-service]
recipe = slapos.recipe.template
url = {{ tempalte_nginx_service }}
output = ${directory:services}/nginx
virtual-depends =
${nginx-configuration:ip}
[nginx-listen-promise]
<= monitor-promise-base
promise = check_url_available
name = nginx_listen.py
config-verify = 0
config-url = https://[${nginx-configuration:ip}]:${nginx-configuration:port}
[nginx-configuration]
recipe = slapos.recipe.template
url = {{ template_nginx_configration }}
output = ${directory:etc}/nginx.cfg
access_log = ${directory:log}/nginx-access.log
error_log = ${directory:log}/nginx-error.log
ip = ${instance-parameter:ipv6-random}
port = 9443
ssl_key = ${directory:ssl}/nginx.key
ssl_csr = ${directory:ssl}/nginx.csr
ssl_crt = ${directory:ssl}/nginx.crt
#############
# Redis #
#############
[redis]
recipe = slapos.cookbook:mkdirectory
srv = ${directory:srv}/redis
log = ${directory:log}/redis
[service-redis]
recipe = slapos.cookbook:redis.server
wrapper = ${directory:services}/redis
promise-wrapper = ${directory:bin}/redis-promise
server-dir = ${redis:srv}
config-file = ${directory:etc}/redis.conf
log-file = ${redis:log}/redis.log
pid-file = ${directory:run}/redis.pid
use-passwd = false
unixsocket = ${:server-dir}/redis.socket
# port = 0 means "don't listen on TCP at all" - listen only on unix socket
ipv6 = ::1
port = 0
# server-bin = ${buildout:parts-directory}/redis/bin/redis-server
server-bin = {{ redis_binprefix }}/redis-server
cli-bin = {{ redis_binprefix }}/redis-cli
depend =
${logrotate-entry-redis:recipe}
[promise-redis]
<= monitor-promise-base
promise = check_command_execute
name = promise-redis.py
config-command = ${service-redis:promise-wrapper}
[logrotate-entry-redis]
<= logrotate-entry-base
log = ${redis:log}/*.log
name = redis
#################################
# Cron service
#################################
[dcron-service]
recipe = slapos.recipe.template
url = {{ template_dcron_service }}
output = ${directory:services}/crond
logfile = ${directory:log}/crond.log
[peertube-backup-script]
recipe = slapos.recipe.template
url = {{ tempalte_peertube_backup }}
output = ${directory:etc}/${:_buildout_section_name_}
[peertube-backup-cron]
recipe = slapos.recipe.template
url = {{ template_crontab_line }}
output = ${directory:cron-lines}/${:_buildout_section_name_}
script = ${peertube-backup-script:output}
frequency = daily
[activate-crontab-file]
# XXX File is never removed
recipe = plone.recipe.command
stop-on-error = true
command = {{ coreutils_cat }} {{ template_crontab }} ${peertube-backup-cron:output} | {{ dcron_output }} -c ${directory:crontabs} -
[peertube-database-resiliency-exclude-file]
recipe = slapos.recipe.template:jinja2
inline = {{ "${postgresql:pgdata-directory}/**" }}
output = ${directory:srv}/exporter.exclude
[peertube-database-resiliency-after-import-script]
recipe = collective.recipe.template
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
output = ${directory:srv}/runner-import-restore
mode = 755
#################################
# SlapOS service
#################################
[instance-parameter]
recipe = slapos.cookbook:slapconfiguration
computer = ${slap-connection:computer-id}
partition = ${slap-connection:partition-id}
url = ${slap-connection:server-url}
key = ${slap-connection:key-file}
cert = ${slap-connection:cert-file}
configuration._ = {}
raw ipv6_random $${slap-configuration:ipv6-random}
raw ipv4_random $${slap-configuration:ipv4-random}
raw template_peertube_yaml ${template-peertube-yaml:output}
raw template_nginx_configration ${template-nginx-configuration: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}
[switch-softwaretype]
recipe = slapos.cookbook:switch-softwaretype
RootSoftwareInstance = $${:default}
default = peertube:output
[slap-configuration]
recipe = slapos.cookbook:slapconfiguration
computer = ${slap_connection:computer_id}
partition = ${slap_connection:partition_id}
url = ${slap_connection:server_url}
key = ${slap_connection:key_file}
cert = ${slap_connection:cert_file}
recipe = slapos.cookbook:slapconfiguration.serialised
computer= $${slap-connection:computer-id}
partition=$${slap-connection:partition-id}
url = $${slap-connection:server-url}
key = $${slap-connection:key-file}
cert = $${slap-connection:cert-file}
software/peertube/software.cfg
View file @
96d96922
...
...
@@ -58,7 +58,6 @@ parts =
peertube
peertube-build
instance-profile
instance-peertube
[nodejs]
<= nodejs-16.13.2
...
...
@@ -83,37 +82,15 @@ post-install =
rm -rf ${buildout:directory}/.cache/yarn/
rm -rf ${buildout:directory}/parts/peertube/client/node_modules/chromedriver/
[peertube-postgresql-setup.in]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/${:_update_hash_filename_}
destination = ${buildout:directory}/${:_buildout_section_name_}
[instance-profile]
recipe = slapos.recipe.template
:jinja2
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/${:filename}
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 instance_peertube ${instance-peertube: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 template_peertube_yaml ${template-peertube-yaml:output}
raw template_peertube_service ${template-peertube-service:output}
[instance-peertube]
recipe
= slapos.recipe.template
url
= ${:_profile_base_location_}/${:filename
}
output = ${buildout:directory}/instance-peertube.cfg.in
recipe
= slapos.recipe.build:download
url
= ${:_profile_base_location_}/${:_update_hash_filename_
}
destination = ${buildout:directory}/${:_buildout_section_name_}
[template-peertube-service]
recipe = slapos.recipe.template
...
...
software/peertube/template-nginx.cfg.in
View file @
96d96922
...
...
@@ -51,11 +51,12 @@ http {
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
upstream backend {
server $${
instance-parameter:ipv4-random}:$${peertube:ipv4_
port};
server $${
slap-configuration:ipv4-random}:$${peertube-parameters:ipv4-
port};
}
server {
listen [$${nginx-configuration:ip}]:$${nginx-configuration:port};
#$${nginx-configuration:ipv6}
access_log $${directory:peertube_nginx_log}/peertube.access.log; # reduce I/0 with buffer=10m flush=5m
error_log $${directory:peertube_nginx_log}/peertube.error.log;
...
...
software/peertube/template-peertube.yaml.in
View file @
96d96922
listen:
hostname: '$${
instance-parameter
:ipv4-random}'
hostname: '$${
slap-configuration
:ipv4-random}'
port: $${peertube-parameters:ipv4-port}
# Correspond to your reverse proxy server_name/listen configuration (i.e., your public PeerTube instance URL)
webserver:
https: true
# hostname: 'softinst176929.host.vifib.net'
# port: 443
hostname: '$${peertube-parameters:host}'
port: $${peertube-parameters:port}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment