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
bd007c64
Commit
bd007c64
authored
Nov 16, 2022
by
Boxiang Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
peertube: Add a sub jinja template
parent
631492bc
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
141 additions
and
106 deletions
+141
-106
software/peertube/buildout.hash.cfg
software/peertube/buildout.hash.cfg
+5
-1
software/peertube/instance-peertube.cfg.in
software/peertube/instance-peertube.cfg.in
+110
-0
software/peertube/instance.cfg.in
software/peertube/instance.cfg.in
+15
-99
software/peertube/software.cfg
software/peertube/software.cfg
+10
-5
software/peertube/template-nginx.cfg.in
software/peertube/template-nginx.cfg.in
+1
-1
No files found.
software/peertube/buildout.hash.cfg
View file @
bd007c64
...
@@ -16,6 +16,10 @@
...
@@ -16,6 +16,10 @@
filename = instance.cfg.in
filename = instance.cfg.in
# md5sum = a1f5431f98c2401282064d40bf809eed
# md5sum = a1f5431f98c2401282064d40bf809eed
[instance-peertube]
filename = instance-peertube.cfg.in
# md5sum = 458870b70c33a1621b68961ae2372ad5
[template-nginx-service]
[template-nginx-service]
filename = template-nginx-service.sh.in
filename = template-nginx-service.sh.in
md5sum = 458870b70c33a1621b68961ae2372ad5
md5sum = 458870b70c33a1621b68961ae2372ad5
...
@@ -24,7 +28,7 @@ md5sum = 458870b70c33a1621b68961ae2372ad5
...
@@ -24,7 +28,7 @@ md5sum = 458870b70c33a1621b68961ae2372ad5
filename = template-peertube-service.sh.in
filename = template-peertube-service.sh.in
# md5sum = 458870b70c33a1621b68961ae2372ad5
# md5sum = 458870b70c33a1621b68961ae2372ad5
[template-peertube]
[template-peertube
-yaml
]
filename = template-peertube.yaml.in
filename = template-peertube.yaml.in
# md5sum = 458870b70c33a1621b68961ae2372ad5
# md5sum = 458870b70c33a1621b68961ae2372ad5
...
...
software/peertube/instance-peertube.cfg.in
0 → 100644
View file @
bd007c64
[buildout]
extends =
${monitor-template:output}
parts =
peertube-yaml
peertube-service
peertube-listen-promise
peertube-parameters
publish-connection-parameter
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
[peertube-passwd]
recipe = slapos.cookbook:generate.password
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
[peertube-listen-promise]
<= monitor-promise-base
promise = check_url_available
name = peertube_listen.py
config-verify = 0
config-url = https://$${frontend:connection-domain}
[peertube-service]
recipe = slapos.recipe.template
url = ${template-peertube-service:output}
output = {{ directory_services }}/peertube
[frontend]
<= slap-connection
recipe = slapos.cookbook:requestoptional
name = PeerTube Server Frontend
# XXX We have hardcoded SR URL here.
software-url = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg
slave = true
{% if slapparameter_dict.get('frontend-url', 'false') != 'false' -%}
state = stopped
{% endif -%}
config-type = websocket
config-websocket-path-list = /socket.io /socket /tracker/socket
config-url = https://[{{ nginx_ip }}]:{{ nginx_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 }}
node-env=production
npm-bin=${nodejs:location}/bin/npm
default-parameters =
{
"name" : "Peertube in Slapos",
"frontend-url" : "",
"short_description" : "PeerTube, an ActivityPub-federated video streaming platform using P2P directly in your web browser.",
"description" : "Welcome to this PeerTube instance!",
"terms" : "No terms for now.",
"code_of_conduct" : "",
"moderation_information" : "",
"creation_reason" : "",
"administrator" : "",
"maintenance_lifetime" : "",
"business_model" : "",
"hardware_information" : ""
}
init =
from six.moves.urllib.parse import urlparse
import json
default_parameters = json.loads(options.get('default-parameters').strip())
default_parameters['frontend-url'] = options['default-frontend-url']
parameters = dict(default_parameters, **options['slapparameter-dict'])
# options is not a dict...
options['name'] = parameters['name']
options['frontend-url'] = parameters['frontend-url']
options['short_description'] = parameters['short_description']
options['description'] = parameters['description']
options['terms'] = parameters['terms']
options['code_of_conduct'] = parameters['code_of_conduct']
options['moderation_information'] = parameters['moderation_information']
options['creation_reason'] = parameters['creation_reason']
options['administrator'] = parameters['administrator']
options['maintenance_lifetime'] = parameters['maintenance_lifetime']
options['business_model'] = parameters['business_model']
options['hardware_information'] = parameters['hardware_information']
url = urlparse(options.get('frontend-url'))
if url.port:
options['host'] = '[' + url.hostname + ']'
options['port'] = str(url.port)
else:
options['host'] = url.hostname
options['port'] = str(443)
[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}
username = root
software/peertube/instance.cfg.in
View file @
bd007c64
...
@@ -7,18 +7,13 @@ parts =
...
@@ -7,18 +7,13 @@ parts =
promise-redis
promise-redis
postgresql
postgresql
postgresql-binary-link
postgresql-binary-link
peertube-yaml
nginx-service
nginx-service
peertube-service
publish-connection-parameter
peertube-parameters
dcron-service
dcron-service
activate-crontab-file
activate-crontab-file
peertube-backup-cron
peertube-backup-cron
peertube-database-resiliency-after-import-script
peertube-database-resiliency-after-import-script
peertube-database-resiliency-exclude-file
peertube-database-resiliency-exclude-file
nginx-listen-promise
nginx-listen-promise
peertube-listen-promise
eggs-directory = {{ eggs_directory }}
eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
...
@@ -46,28 +41,21 @@ storage = ${:peertube_directory}/storage
...
@@ -46,28 +41,21 @@ storage = ${:peertube_directory}/storage
versions = ${:peertube_directory}/versions
versions = ${:peertube_directory}/versions
ssl = ${:etc}/ssl
ssl = ${:etc}/ssl
[peertube-passwd]
[peertube]
recipe = slapos.cookbook:generate.password
recipe = slapos.recipe.template:jinja2
storage-path = ${directory:etc}/.peertube_user
url = {{ instance_peertube }}
bytes = 8
output = ${buildout:directory}/instance-peertube.cfg
username = root
extensions = jinja2.ext.do
context =
[peertube-yaml]
key develop_eggs_directory buildout:develop-eggs-directory
recipe = slapos.recipe.template
key eggs_directory buildout:eggs-directory
url = {{ template_peertube }}
key slapparameter_dict slap-configuration:configuration
output = ${directory:config}/peertube.yaml
key nginx_ip nginx-configuration:ip
key nginx_port nginx-configuration:port
[peertube-listen-promise]
raw directory_etc ${directory:etc}
<= monitor-promise-base
raw directory_config ${directory:config}
promise = check_url_available
raw directory_services ${directory:services}
name = peertube_listen.py
ipv4_port = 9000
config-verify = 0
config-url = https://${frontend:connection-domain}
[peertube-service]
recipe = slapos.recipe.template
url = {{ tempalte_peertube_service }}
output = ${directory:services}/peertube
[postgresql-password]
[postgresql-password]
recipe = slapos.cookbook:generate.password
recipe = slapos.cookbook:generate.password
...
@@ -211,18 +199,6 @@ key = ${slap-connection:key-file}
...
@@ -211,18 +199,6 @@ key = ${slap-connection:key-file}
cert = ${slap-connection:cert-file}
cert = ${slap-connection:cert-file}
configuration._ = {}
configuration._ = {}
[frontend]
<= slap-connection
recipe = slapos.cookbook:requestoptional
name = PeerTube Server Frontend
# XXX We have hardcoded SR URL here.
software-url = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg
slave = true
config-type = websocket
config-websocket-path-list = /socket.io /socket /tracker/socket
config-url = https://[${nginx-configuration:ip}]:${nginx-configuration:port}
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}
...
@@ -230,63 +206,3 @@ partition = ${slap_connection:partition_id}
...
@@ -230,63 +206,3 @@ 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]
recipe = slapos.recipe.build
slapparameter-dict = ${slap-configuration:configuration}
default-frontend-url = ${frontend:config-url}
working-dir = {{ peertube_location }}
node-config-dir=${directory:config}
ipv4-port=9000
node-env=production
npm-bin={{ nodejs_location }}/bin/npm
default-parameters =
{
"name" : "Peertube in Slapos",
"frontend-url" : "",
"short_description" : "PeerTube, an ActivityPub-federated video streaming platform using P2P directly in your web browser.",
"description" : "Welcome to this PeerTube instance!",
"terms" : "No terms for now.",
"code_of_conduct" : "",
"moderation_information" : "",
"creation_reason" : "",
"administrator" : "",
"maintenance_lifetime" : "",
"business_model" : "",
"hardware_information" : ""
}
init =
from six.moves.urllib.parse import urlparse
import json
default_parameters = json.loads(options.get('default-parameters').strip())
default_parameters['frontend-url'] = options['default-frontend-url']
parameters = dict(default_parameters, **options['slapparameter-dict'])
# options is not a dict...
options['name'] = parameters['name']
options['frontend-url'] = parameters['frontend-url']
options['short_description'] = parameters['short_description']
options['description'] = parameters['description']
options['terms'] = parameters['terms']
options['code_of_conduct'] = parameters['code_of_conduct']
options['moderation_information'] = parameters['moderation_information']
options['creation_reason'] = parameters['creation_reason']
options['administrator'] = parameters['administrator']
options['maintenance_lifetime'] = parameters['maintenance_lifetime']
options['business_model'] = parameters['business_model']
options['hardware_information'] = parameters['hardware_information']
url = urlparse(options.get('frontend-url'))
if url.port:
options['host'] = '[' + url.hostname + ']'
options['port'] = str(url.port)
else:
options['host'] = url.hostname
options['port'] = str(443)
[publish-connection-parameter]
recipe = slapos.cookbook:publish
frontend-hostname = ${frontend:connection-domain}
frontend-url = ${peertube-parameters:frontend-url}
backend-url = ${frontend:config-url}
password = ${peertube-passwd:passwd}
username = root
software/peertube/software.cfg
View file @
bd007c64
...
@@ -58,6 +58,7 @@ parts =
...
@@ -58,6 +58,7 @@ parts =
peertube
peertube
peertube-build
peertube-build
instance-profile
instance-profile
instance-peertube
[nodejs]
[nodejs]
<= nodejs-16.13.2
<= nodejs-16.13.2
...
@@ -96,8 +97,7 @@ context =
...
@@ -96,8 +97,7 @@ context =
key eggs_directory buildout:eggs-directory
key eggs_directory buildout:eggs-directory
raw template_nginx_configration ${template-nginx-configuration:output}
raw template_nginx_configration ${template-nginx-configuration:output}
raw monitor_template_output ${monitor-template:output}
raw monitor_template_output ${monitor-template:output}
raw template_peertube ${template-peertube:output}
raw instance_peertube ${instance-peertube:output}
raw tempalte_peertube_service ${template-peertube-service:output}
raw postgresql10_location ${postgresql10:location}
raw postgresql10_location ${postgresql10:location}
raw tempalte_nginx_service ${template-nginx-service:output}
raw tempalte_nginx_service ${template-nginx-service:output}
raw redis_binprefix ${redis28:location}/bin
raw redis_binprefix ${redis28:location}/bin
...
@@ -107,15 +107,20 @@ context =
...
@@ -107,15 +107,20 @@ context =
raw coreutils_cat ${coreutils-output:cat}
raw coreutils_cat ${coreutils-output:cat}
raw template_crontab ${template-crontab:output}
raw template_crontab ${template-crontab:output}
raw dcron_output ${dcron-output:crontab}
raw dcron_output ${dcron-output:crontab}
raw peertube_location ${peertube:location}
raw template_peertube_yaml ${template-peertube-yaml:output}
raw nodejs_location ${nodejs:location}
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
[template-peertube-service]
[template-peertube-service]
recipe = slapos.recipe.template
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/${:filename}
url = ${:_profile_base_location_}/${:filename}
output = ${buildout:directory}/${:filename}
output = ${buildout:directory}/${:filename}
[template-peertube]
[template-peertube
-yaml
]
recipe = slapos.recipe.template
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/${:filename}
url = ${:_profile_base_location_}/${:filename}
output = ${buildout:directory}/${:filename}
output = ${buildout:directory}/${:filename}
...
...
software/peertube/template-nginx.cfg.in
View file @
bd007c64
...
@@ -51,7 +51,7 @@ http {
...
@@ -51,7 +51,7 @@ http {
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
upstream backend {
upstream backend {
server $${instance-parameter:ipv4-random}:$${peertube
-parameters:ipv4-
port};
server $${instance-parameter:ipv4-random}:$${peertube
:ipv4_
port};
}
}
server {
server {
...
...
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