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
Romain Courteaud
slapos
Commits
676c7443
Commit
676c7443
authored
Nov 14, 2022
by
Boxiang Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
peertube: parameter mechanism update
parent
cd8f7c43
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
96 additions
and
46 deletions
+96
-46
software/peertube/instance-peertube-input-schema.json
software/peertube/instance-peertube-input-schema.json
+6
-0
software/peertube/instance-peertube-output-schema.json
software/peertube/instance-peertube-output-schema.json
+19
-0
software/peertube/instance.cfg.in
software/peertube/instance.cfg.in
+53
-30
software/peertube/software.cfg.json
software/peertube/software.cfg.json
+1
-0
software/peertube/template-nginx.cfg.in
software/peertube/template-nginx.cfg.in
+1
-1
software/peertube/template-peertube-service.sh.in
software/peertube/template-peertube-service.sh.in
+2
-1
software/peertube/template-peertube.yaml.in
software/peertube/template-peertube.yaml.in
+14
-14
No files found.
software/peertube/instance-peertube-input-schema.json
View file @
676c7443
...
@@ -4,6 +4,12 @@
...
@@ -4,6 +4,12 @@
"description"
:
"Parameters to instantiate Peertube"
,
"description"
:
"Parameters to instantiate Peertube"
,
"additionalProperties"
:
false
,
"additionalProperties"
:
false
,
"properties"
:
{
"properties"
:
{
"fronted-url"
:
{
"title"
:
"Frontend URL"
,
"description"
:
"Frontend URL"
,
"default"
:
""
,
"type"
:
"string"
},
"name"
:
{
"name"
:
{
"title"
:
"Instance Title"
,
"title"
:
"Instance Title"
,
"description"
:
"The name of your peertube instance."
,
"description"
:
"The name of your peertube instance."
,
...
...
software/peertube/instance-peertube-output-schema.json
0 → 100644
View file @
676c7443
{
"$schema"
:
"http://json-schema.org/draft-04/schema#"
,
"description"
:
"Values returned by Peertube instanciation"
,
"properties"
:
{
"backend-url"
:
{
"description"
:
"Peertube Backend URL"
,
"type"
:
"string"
},
"username"
:
{
"description"
:
"Peertube username"
,
"type"
:
"string"
},
"password"
:
{
"description"
:
"Peertube password"
,
"type"
:
"string"
}
},
"type"
:
"object"
}
software/peertube/instance.cfg.in
View file @
676c7443
...
@@ -10,7 +10,7 @@ parts =
...
@@ -10,7 +10,7 @@ parts =
nginx-service
nginx-service
peertube-service
peertube-service
publish-connection-parameter
publish-connection-parameter
peertube-
urlparse
peertube-
parameters
dcron-service
dcron-service
activate-crontab-file
activate-crontab-file
peertube-backup-cron
peertube-backup-cron
...
@@ -45,6 +45,12 @@ storage = $${:peertube_directory}/storage
...
@@ -45,6 +45,12 @@ storage = $${:peertube_directory}/storage
versions = $${:peertube_directory}/versions
versions = $${:peertube_directory}/versions
ssl = $${:etc}/ssl
ssl = $${:etc}/ssl
[peertube-passwd]
recipe = slapos.cookbook:generate.password
storage-path = $${directory:etc}/.peertube_user
bytes = 8
username = root
[peertube-yaml]
[peertube-yaml]
recipe = slapos.recipe.template
recipe = slapos.recipe.template
url = ${template-peertube:output}
url = ${template-peertube:output}
...
@@ -79,11 +85,6 @@ ipv4 = $${instance-parameter:ipv4-random}
...
@@ -79,11 +85,6 @@ ipv4 = $${instance-parameter:ipv4-random}
ipv6 =
ipv6 =
port = 5432
port = 5432
[service-postgresql]
recipe = slapos.cookbook:postgres
bin = ${postgresql10:location}/bin
services= $${directory:service}
#################################
#################################
# Nginx service
# Nginx service
#################################
#################################
...
@@ -211,6 +212,7 @@ name = PeerTube Server Frontend
...
@@ -211,6 +212,7 @@ 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}
...
@@ -223,33 +225,51 @@ partition = $${slap_connection:partition_id}
...
@@ -223,33 +225,51 @@ 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}
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.'
[peertube-
text-content
]
[peertube-
parameters
]
recipe = slapos.recipe.build
recipe = slapos.recipe.build
slapparameter-dict = $${slap-configuration:configuration}
slapparameter-dict = $${slap-configuration:configuration}
init =
default-frontend-url = $${frontend:config-url}
options['name'] = options['slapparameter-dict'].get('name') or 'Peertube in Slapos'
working-dir = ${peertube:location}
options['short_description'] = options['slapparameter-dict'].get('short_description') or ''
node-config-dir=$${directory:config}
options['description'] = options['slapparameter-dict'].get('description') or ''
ipv4-port=9000
options['terms'] = options['slapparameter-dict'].get('terms') or ''
node-env=production
options['code_of_conduct'] = options['slapparameter-dict'].get('code_of_conduct') or ''
npm-bin=${nodejs:location}/bin/npm
options['moderation_information'] = options['slapparameter-dict'].get('moderation_information') or ''
default-parameters =
options['creation_reason'] = options['slapparameter-dict'].get('creation_reason') or ''
{
options['administrator'] = options['slapparameter-dict'].get('administrator') or ''
"name" : "Peertube in Slapos",
options['maintenance_lifetime'] = options['slapparameter-dict'].get('maintenance_lifetime') or ''
"frontend-url" : "",
options['business_model'] = options['slapparameter-dict'].get('business_model') or ''
"short_description" : "PeerTube, an ActivityPub-federated video streaming platform using P2P directly in your web browser.",
options['hardware_information'] = options['slapparameter-dict'].get('hardware_information') or ''
"description" : "Welcome to this PeerTube instance!",
"terms" : "No terms for now.",
[peertube-urlparse]
"code_of_conduct" : "",
recipe = slapos.recipe.build
"moderation_information" : "",
slapparameter-dict = $${slap-configuration:configuration}
"creation_reason" : "",
url = $${publish-connection-parameter:frontend-url}
"administrator" : "",
"maintenance_lifetime" : "",
"business_model" : "",
"hardware_information" : ""
}
init =
init =
from six.moves.urllib.parse import urlparse
from six.moves.urllib.parse import urlparse
url = urlparse(options.get('url'))
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:
if url.port:
options['host'] = '[' + url.hostname + ']'
options['host'] = '[' + url.hostname + ']'
options['port'] = str(url.port)
options['port'] = str(url.port)
...
@@ -259,6 +279,9 @@ init =
...
@@ -259,6 +279,9 @@ init =
[publish-connection-parameter]
[publish-connection-parameter]
recipe = slapos.cookbook:publish
recipe = slapos.cookbook:publish
frontend-url = $${frontend:connection-secure_access}
frontend-hostname = $${frontend:connection-domain}
frontend-hostname = $${frontend:connection-domain}
ipv4-port = 9000
frontend-url = $${peertube-parameters:frontend-url}
backend-url = $${frontend:config-url}
password = $${peertube-passwd:passwd}
username = root
software/peertube/software.cfg.json
View file @
676c7443
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
"software-type"
:
"default"
,
"software-type"
:
"default"
,
"description"
:
"Default"
,
"description"
:
"Default"
,
"request"
:
"instance-peertube-input-schema.json"
,
"request"
:
"instance-peertube-input-schema.json"
,
"response"
:
"instance-peertube-output-schema.json"
,
"index"
:
1
"index"
:
1
}
}
}
}
...
...
software/peertube/template-nginx.cfg.in
View file @
676c7443
...
@@ -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}:$${p
ublish-connection-parameter
:ipv4-port};
server $${instance-parameter:ipv4-random}:$${p
eertube-parameters
:ipv4-port};
}
}
server {
server {
...
...
software/peertube/template-peertube-service.sh.in
View file @
676c7443
...
@@ -30,5 +30,6 @@ echo "I: PostgreSQL ready." 1>&2
...
@@ -30,5 +30,6 @@ echo "I: PostgreSQL ready." 1>&2
cd ${peertube:location}
cd ${peertube:location}
exec env NODE_ENV=peertube NODE_CONFIG_DIR=$${directory:config} PATH=${ffmpeg:location}/bin:$PATH\
exec env PT_INITIAL_ROOT_PASSWORD=$${peertube-passwd:passwd} NODE_ENV=peertube\
NODE_CONFIG_DIR=$${directory:config} PATH=${ffmpeg:location}/bin:$PATH\
${nodejs:location}/bin/node ${peertube:location}/dist/server
${nodejs:location}/bin/node ${peertube:location}/dist/server
software/peertube/template-peertube.yaml.in
View file @
676c7443
listen:
listen:
hostname: '$${instance-parameter:ipv4-random}'
hostname: '$${instance-parameter:ipv4-random}'
port: $${p
ublish-connection-parameter
:ipv4-port}
port: $${p
eertube-parameters
:ipv4-port}
# Correspond to your reverse proxy server_name/listen configuration (i.e., your public PeerTube instance URL)
# Correspond to your reverse proxy server_name/listen configuration (i.e., your public PeerTube instance URL)
webserver:
webserver:
https: true
https: true
hostname: '$${peertube-
urlparse
:host}'
hostname: '$${peertube-
parameters
:host}'
port: $${peertube-
urlparse
:port}
port: $${peertube-
parameters
:port}
# Secrets you need to generate the first time you run PeerTube
# Secrets you need to generate the first time you run PeerTube
secrets:
secrets:
...
@@ -564,30 +564,30 @@ auto_blacklist:
...
@@ -564,30 +564,30 @@ auto_blacklist:
# Instance settings
# Instance settings
instance:
instance:
name: '$${peertube-
text-content
:name}' #'Peertube'
name: '$${peertube-
parameters
:name}' #'Peertube'
short_description: '$${peertube-
text-content
:short_description}'
short_description: '$${peertube-
parameters
:short_description}'
description: '$${peertube-
text-content
:description}'
description: '$${peertube-
parameters
:description}'
terms: '$${peertube-
text-content
:terms}'
terms: '$${peertube-
parameters
:terms}'
code_of_conduct: '$${peertube-
text-content
:code_of_conduct}'
code_of_conduct: '$${peertube-
parameters
:code_of_conduct}'
# Who moderates the instance? What is the policy regarding NSFW videos? Political videos? etc
# Who moderates the instance? What is the policy regarding NSFW videos? Political videos? etc
moderation_information: '$${peertube-
text-content
:moderation_information}'
moderation_information: '$${peertube-
parameters
:moderation_information}'
# Why did you create this instance?
# Why did you create this instance?
creation_reason: '$${peertube-
text-content
:creation_reason}'
creation_reason: '$${peertube-
parameters
:creation_reason}'
# Who is behind the instance? A single person? A non profit?
# Who is behind the instance? A single person? A non profit?
administrator: '$${peertube-
text-content
:administrator}'
administrator: '$${peertube-
parameters
:administrator}'
# How long do you plan to maintain this instance?
# How long do you plan to maintain this instance?
maintenance_lifetime: '$${peertube-
text-content
:maintenance_lifetime}'
maintenance_lifetime: '$${peertube-
parameters
:maintenance_lifetime}'
# How will you pay the PeerTube instance server? With your own funds? With users donations? Advertising?
# How will you pay the PeerTube instance server? With your own funds? With users donations? Advertising?
business_model: '$${peertube-
text-content
:business_model}'
business_model: '$${peertube-
parameters
:business_model}'
# If you want to explain on what type of hardware your PeerTube instance runs
# If you want to explain on what type of hardware your PeerTube instance runs
# Example: '2 vCore, 2GB RAM...'
# Example: '2 vCore, 2GB RAM...'
hardware_information: '$${peertube-
text-content
:hardware_information}'
hardware_information: '$${peertube-
parameters
:hardware_information}'
# What are the main languages of your instance? To interact with your users for example
# What are the main languages of your instance? To interact with your users for example
# Uncomment or add the languages you want
# Uncomment or add the languages you want
...
...
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