Commit 0c2b290b authored by Boxiang Sun's avatar Boxiang Sun

peertube: host fixup

parent 24be540a
...@@ -10,6 +10,7 @@ parts = ...@@ -10,6 +10,7 @@ parts =
nginx-service nginx-service
peertube-service peertube-service
publish-connection-parameter publish-connection-parameter
peertube-urlparse
nginx-listen-promise nginx-listen-promise
peertube-listen-promise peertube-listen-promise
...@@ -163,7 +164,7 @@ name = PeerTube Server Frontend ...@@ -163,7 +164,7 @@ name = PeerTube Server Frontend
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
config-type = websocket config-type = websocket
config-websocket-path-list = /socket.io /tracker 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}
return = domain secure_access return = domain secure_access
...@@ -194,8 +195,24 @@ init = ...@@ -194,8 +195,24 @@ init =
options['business_model'] = options['slapparameter-dict'].get('business_model') or '' options['business_model'] = options['slapparameter-dict'].get('business_model') or ''
options['hardware_information'] = options['slapparameter-dict'].get('hardware_information') or '' options['hardware_information'] = options['slapparameter-dict'].get('hardware_information') or ''
[peertube-urlparse]
recipe = slapos.recipe.build
slapparameter-dict = $${slap-configuration:configuration}
url = $${publish-connection-parameter:frontend-url}
init =
from six.moves.urllib.parse import urlparse
url = urlparse(options.get('url'))
if url.port:
options['host'] = '\'[' + url.hostname + '\']'
options['port'] = url.port
else:
options['host'] = url.hostname
options['port'] = 443
[publish-connection-parameter] [publish-connection-parameter]
recipe = slapos.cookbook:publish recipe = slapos.cookbook:publish
frontend-url = $${frontend:connection-secure_access} frontend-url = $${frontend:connection-secure_access}
frontend-hostname = $${frontend:connection-domain} frontend-hostname = $${frontend:connection-domain}
frontend-port = 9000 ipv4-port = 9000
...@@ -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}:$${publish-connection-parameter:frontend-port}; server $${instance-parameter:ipv4-random}:$${publish-connection-parameter:ipv4-port};
} }
server { server {
......
listen: listen:
hostname: '$${instance-parameter:ipv4-random}' hostname: '$${instance-parameter:ipv4-random}'
port: $${publish-connection-parameter:frontend-port} port: $${publish-connection-parameter: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: '$${publish-connection-parameter:frontend-hostname}' hostname: '$${peertube-urlparse:host}'
port: 443 port: $${peertube-urlparse: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:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment