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
3834566e
Commit
3834566e
authored
Oct 14, 2022
by
Boxiang Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
peertube: Use template
parent
80ddc397
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
1798 additions
and
59 deletions
+1798
-59
software/peertube/buildout.hash.cfg
software/peertube/buildout.hash.cfg
+12
-0
software/peertube/instance.cfg.in
software/peertube/instance.cfg.in
+30
-56
software/peertube/software.cfg
software/peertube/software.cfg
+21
-2
software/peertube/template-peertube-default.yaml.in
software/peertube/template-peertube-default.yaml.in
+734
-0
software/peertube/template-peertube-nginx-available.in
software/peertube/template-peertube-nginx-available.in
+257
-0
software/peertube/template-peertube-production.yaml.in
software/peertube/template-peertube-production.yaml.in
+743
-0
software/peertube/template-peertube-service.sh.in
software/peertube/template-peertube-service.sh.in
+1
-1
No files found.
software/peertube/buildout.hash.cfg
View file @
3834566e
...
...
@@ -24,6 +24,18 @@ md5sum = 458870b70c33a1621b68961ae2372ad5
filename = template-peertube-service.sh.in
# md5sum = 458870b70c33a1621b68961ae2372ad5
[template-peertube-production]
filename = template-peertube-production.yaml.in
# md5sum = 458870b70c33a1621b68961ae2372ad5
[template-peertube-nginx-available]
filename = template-peertube-nginx-available.in
# md5sum = 458870b70c33a1621b68961ae2372ad5
[template-peertube-default]
filename = template-peertube-default.yaml.in
# md5sum = 458870b70c33a1621b68961ae2372ad5
[template-nginx-configuration]
filename = template-nginx.cfg.in
# md5sum = 6b11e79bcc7734d8629e1b6e6cb497e1
software/peertube/instance.cfg.in
View file @
3834566e
...
...
@@ -8,9 +8,11 @@ parts =
postgresql
nginx-service
nginx-listen-promise
peertube-nginx-available
peertube-nginx-enabled
peertube-default-yaml
peertube-production-yaml
peertube-service
peertube-setup
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
...
...
@@ -23,67 +25,39 @@ srv = $${buildout:directory}/srv
var = $${buildout:directory}/var
log = $${:var}/log
run = $${:var}/run
www = $${:
srv
}/www
www = $${:
var
}/www
nginx = $${:etc}/nginx
nginx_sites-available = $${:nginx}/sites-available
nginx_sites-enabled = $${:nginx}/sites-enabled
varnginx = $${:var}/nginx
services = $${:etc}/service
peertube_directory = $${:srv}/var/www/peertube
config = $${:var}/www/peertube/config
storage = $${:var}/www/peertube/storage
versions = $${:var}/www/peertube/versions
xoxox = $${buildout:directory}/xoxox
wwwx = $${:var}/wwwx
peertube_directory = $${:www}/peertube
config = $${:peertube_directory}/config
storage = $${:peertube_directory}/storage
versions = $${:peertube_directory}/versions
ssl = $${:etc}/ssl
[peertube-setup]
recipe = slapos.recipe.build
peertube_config = $${directory:config}
production_config_template = ${peertube:location}/config/production.yaml.example
production_config_prod = $${directory:config}/production.yaml
default_yaml = ${peertube:location}/config/default.yaml
default_yaml_prod = $${directory:config}/default.yaml
nginx_sites-available = ${peertube:location}/support/nginx/peertube
nginx_sites-available_prod = $${directory:nginx_sites-available}/peertube
nginx_sites-enabled_prod = $${directory:nginx_sites-enabled}/peertube
init =
import shutil, os
shutil.copyfile(options['default_yaml'], options['default_yaml_prod'])
with open(options['nginx_sites-available'], "r", encoding='utf-8') as example_file:
with open(options['nginx_sites-available_prod'], "w", encoding='utf-8') as prod_file:
for line in example_file:
if "WEBSERVER_HOST" in line:
line = line.replace('$', '')
line = line.replace("{WEBSERVER_HOST}", "https://[$${nginx-configuration:ip}]/$${nginx-configuration:port}")
if "{PEERTUBE_HOST}" in line:
line = line.replace('$', '')
line = line.replace("{PEERTUBE_HOST}", "127.0.0.1:9000")
if "ssl_certificate" in line:
line = ''
prod_file.write(line)
if not os.path.exists(options['nginx_sites-enabled_prod']):
os.symlink(options['nginx_sites-available_prod'], options['nginx_sites-enabled_prod'])
with open(options['production_config_template'], "r", encoding='utf-8') as config_template_file:
with open(options['production_config_prod'], "w", encoding='utf-8') as config_prod_file:
local_host_counter = 0
for line in config_template_file:
if "hostname: 'example.com'" in line:
line = line.replace("example.com", "https://[$${nginx-configuration:ip}]/$${nginx-configuration:port}")
elif "password: 'peertube'" in line:
line = line.replace("peertube", "$${postgresql:password}")
elif "hostname: 'localhost'" in line:
local_host_counter += 1
if local_host_counter == 2:
line = line.replace("localhost", "$${postgresql:ipv4}")
if local_host_counter == 3:
line = '' # set 'hostname' and 'port' to null, use redis.socket
elif "6379" in line:
line = line.replace("port: 6379", "unixsocket: $${service-redis:unixsocket}") # set 'hostname' and 'port' to null, use redis.socket
elif "/var/www/peertube" in line:
line = line.replace("/var/www/peertube", "$${directory:peertube_directory}")
config_prod_file.write(line)
[peertube-nginx-available]
recipe = slapos.recipe.template
url = ${template-peertube-nginx-available:output}
output = $${directory:nginx_sites-available}/peertube
[peertube-nginx-enabled]
recipe = slapos.recipe.template
url = ${template-peertube-nginx-available:output}
output = $${directory:nginx_sites-enabled}/peertube
[peertube-default-yaml]
recipe = slapos.recipe.template
url = ${template-peertube-default:output}
output = $${directory:config}/default.yaml
[peertube-production-yaml]
recipe = slapos.recipe.template
url = ${template-peertube-production:output}
output = $${directory:config}/production.yaml
[peertube-service]
recipe = slapos.recipe.template
...
...
software/peertube/software.cfg
View file @
3834566e
...
...
@@ -53,7 +53,6 @@ parts =
peertube
peertube-build
instance-profile
# postgresql-setup
[nodejs]
<= nodejs-16.13.2
...
...
@@ -67,7 +66,7 @@ md5sum = 1c9639748d66e8c49fc27e4705f87622
recipe = slapos.recipe.cmmi
path = ${peertube:location}
environment =
PATH=${unzip:location}/bin:${vim:location}/bin:${nodejs:location}/bin:${yarn:location}/bin:${python3:location}/bin:${nginx:location}/sbin:${postgresql
:location}/s
bin:${gcc-10.2:location}/bin:${redis:location}/bin:{git:location}/bin:{wget:location}/bin:%(PATH)s
PATH=${unzip:location}/bin:${vim:location}/bin:${nodejs:location}/bin:${yarn:location}/bin:${python3:location}/bin:${nginx:location}/sbin:${postgresql
10:location}/
bin:${gcc-10.2:location}/bin:${redis:location}/bin:{git:location}/bin:{wget:location}/bin:%(PATH)s
CPPFLAGS=-I${openssl:location}/include
LDFLAGS=-L${curl:location}/lib -Wl,-rpath -Wl,${openssl:location}/lib -Wl,-rpath -Wl
pre-configure =
...
...
@@ -75,6 +74,11 @@ pre-configure =
configure-command = true
make-binary = cd ${peertube:location} && ${yarn:location}/bin/yarn
[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
url = ${:_profile_base_location_}/${:filename}
...
...
@@ -85,6 +89,21 @@ recipe = slapos.recipe.template
url = ${:_profile_base_location_}/${:filename}
output = ${buildout:directory}/${:filename}
[template-peertube-production]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/${:filename}
output = ${buildout:directory}/${:filename}
[template-peertube-default]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/${:filename}
output = ${buildout:directory}/${:filename}
[template-peertube-nginx-available]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/${:filename}
output = ${buildout:directory}/${:filename}
[template-nginx-service]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/${:filename}
...
...
software/peertube/template-peertube-default.yaml.in
0 → 100644
View file @
3834566e
This diff is collapsed.
Click to expand it.
software/peertube/template-peertube-nginx-available.in
0 → 100644
View file @
3834566e
This diff is collapsed.
Click to expand it.
software/peertube/template-peertube-production.yaml.in
0 → 100644
View file @
3834566e
This diff is collapsed.
Click to expand it.
software/peertube/template-peertube-service.sh.in
View file @
3834566e
...
...
@@ -34,5 +34,5 @@ echo "I: PostgreSQL ready." 1>&2
# make sure unaccent extension is enabled for peertube db
# $${postgresql:bin}/psql -c 'CREATE EXTENSION IF NOT EXISTS unaccent;' $${postgresql:dbname} || die "unaccent setup failed"
exec env NODE_ENV=production NODE_CONFIG_DIR=$${
peertube-setup:peertube_
config} PATH=${ffmpeg:location}/bin:$PATH\
exec env NODE_ENV=production NODE_CONFIG_DIR=$${
directory:
config} PATH=${ffmpeg:location}/bin:$PATH\
${nodejs:location}/bin/node ${peertube:location}/dist/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