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
d9f64adb
Commit
d9f64adb
authored
Oct 12, 2022
by
Boxiang Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
peertube
parent
317abe56
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
28 deletions
+61
-28
software/peertube/buildout.hash.cfg
software/peertube/buildout.hash.cfg
+5
-1
software/peertube/instance.cfg.in
software/peertube/instance.cfg.in
+43
-26
software/peertube/software.cfg
software/peertube/software.cfg
+6
-1
software/peertube/template-nginx.cfg.in
software/peertube/template-nginx.cfg.in
+3
-0
software/peertube/template-peertube-service.sh.in
software/peertube/template-peertube-service.sh.in
+4
-0
No files found.
software/peertube/buildout.hash.cfg
View file @
d9f64adb
...
...
@@ -20,6 +20,10 @@ filename = instance.cfg.in
filename = template-nginx-service.sh.in
md5sum = 458870b70c33a1621b68961ae2372ad5
[template-peertube-service]
filename = template-peertube-service.sh.in
# md5sum = 458870b70c33a1621b68961ae2372ad5
[template-nginx-configuration]
filename = template-nginx.cfg.in
md5sum = 6b11e79bcc7734d8629e1b6e6cb497e1
#
md5sum = 6b11e79bcc7734d8629e1b6e6cb497e1
software/peertube/instance.cfg.in
View file @
d9f64adb
...
...
@@ -9,7 +9,9 @@ parts =
postgresql-extension
nginx-service
nginx-listen-promise
peertube-configuration-1
peertube-service
peertube-configuration
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
...
...
@@ -23,6 +25,9 @@ var = $${buildout:directory}/var
log = $${:var}/log
run = $${:var}/run
www = $${:srv}/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
...
...
@@ -31,45 +36,55 @@ storage = $${:var}/www/peertube/storage
versions = $${:var}/www/peertube/versions
ssl = $${:etc}/ssl
[peertube-configuration
-1
]
[peertube-configuration]
recipe = slapos.recipe.build
production_config_template = ${peertube:location}/config/production.yaml.example
peertube_directory = $${directory:peertube_directory}
production_config_prod = $${directory:config}/production.yaml
default_yaml = ${peertube:location}/config/default.yaml
default_yaml_prod = $${directory:config}/default.yaml
nginx_config = ${peertube:location}/support/nginx/peertube
nginx_config_prod = ${peertube:location}/support/nginx/peertube
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
peertube_service = ${peertube:location}/support/systemd/peertube.service
peertube_service_prod = $${directory:services}/peertube.service
peertube_config = $${directory:config}
peertube_code_dir = ${peertube:location}
install =
import shutil
import shutil
, os
shutil.copyfile(options['default_yaml'], options['default_yaml_prod'])
shutil.copyfile(options['default_yaml'], options['default_yaml_prod'])
with open(options['production_config_template'], "r", encoding='utf-8') as exmaple_file:
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 example_file:
with open(options['production_config_prod'], "w", encoding='utf-8') as prod_file:
for line in ex
ma
ple_file:
for line in ex
am
ple_file:
if "hostname: 'example.com'" in line:
line = line.replace("example.com", "https://[$${nginx-configuration:ip}]/$${nginx-configuration:port}")
if "password: 'peertube'" in line:
line = line.replace("peertube", "$${postgresql:password}")
print("Fuck!!!")
print(line
)
if "/var/www/peertube" in line:
line = line.replace("/var/www/peertube", options['peertube_directory']
)
prod_file.write(line)
# content = content.replace(old_content, new_content)
[peertube-configuration]
recipe = slapos.cookbook:wrapper
wrapper-path = $${directory:services}/$${:_buildout_section_name_}
command-line = echo "Hello!"
cd ${peertube:location}
cp ${peertube:location}/config/production.yaml.example ${peertube:location}/config/production.yaml
# Change config/production.yaml
environment =
PATH=${unzip:location}/bin:${vim:location}/bin:${nodejs:location}/bin:${yarn:location}/bin:${python3:location}/bin:${nginx:location}/sbin:${postgresql:location}/sbin:${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
[peertube-service]
recipe = slapos.recipe.template
url = ${template-peertube-service:output}
output = $${directory:services}/peertube
[postgresql-password]
recipe = slapos.cookbook:generate.password
...
...
@@ -124,6 +139,8 @@ url = ${template-nginx-configuration:output}
output = $${directory:etc}/nginx.cfg
access_log = $${directory:log}/nginx-access.log
error_log = $${directory:log}/nginx-error.log
nginx_sites-available = $${directory:nginx_sites-available}/peertube
nginx_sites-enabled = $${directory:nginx_sites-enabled}/peertube
ip = $${instance-parameter:ipv6-random}
port = 9443
ssl_key = $${directory:ssl}/nginx.key
...
...
software/peertube/software.cfg
View file @
d9f64adb
...
...
@@ -73,13 +73,18 @@ environment =
pre-configure =
${yarn:location}/bin/yarn install --production --pure-lockfile
configure-command = true
make-binary = cd
%(location)s
&& ${yarn:location}/bin/yarn
make-binary = cd
${peertube:location}
&& ${yarn:location}/bin/yarn
[instance-profile]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/${:filename}
output = ${buildout:directory}/instance.cfg
[template-peertube-service]
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-nginx.cfg.in
View file @
d9f64adb
...
...
@@ -16,6 +16,9 @@ http {
# Basic Settings
##
include $${nginx-configuration:nginx_sites-available};
include $${nginx-configuration:nginx_sites-enabled};
sendfile on;
tcp_nopush on;
tcp_nodelay on;
...
...
software/peertube/template-peertube-service.sh.in
0 → 100644
View file @
d9f64adb
exec cd ${peertube:location} && \
${nodejs:location}/bin/node \
env NODE_ENV=production NODE_CONFIG_DIR=$${peertube-configuration:peertube_config}\
${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