Commit 0c0706e4 authored by Eric Zheng's avatar Eric Zheng

software/headless-chromium: use '-' instead of '_' in section/option names

parent 4f42e59c
[template-cfg]
filename = instance.cfg.in
md5sum = 86805fd3eb34659dffe03e6114e45c56
md5sum = 6f7839ca86234df72f7685bf329b7fd6
[instance-headless-chromium]
_update_hash_filename_ = instance_headless-chromium.cfg.in
md5sum = edb13d051635af4c906362eb7915bd13
[template-chromium-launcher]
_update_hash_filename_ = templates/launcher.in
md5sum = 578df08913415c427486093787b4aea6
md5sum = 511ae700572956dcfba8b61a7c5fc5a0
[template-nginx-conf]
_update_hash_filename_ = templates/nginx.conf.in
md5sum = 57ac1a50f95ad07b9a0832ab3f645e91
[template-nginx-launcher]
_update_hash_filename_ = templates/nginx_launcher.in
md5sum = 597e0926f27892ec8d488980bc47b5e9
md5sum = 6763407a952a1126cc5517952a48d4ce
......@@ -7,11 +7,9 @@ develop-eggs-directory = {{ buildout['develop-eggs-directory'] }}
offline = true
[profile-common]
nginx_location = {{ nginx_location }}
chromium_wrapper = {{ chromium_wrapper }}
template_launcher = {{ template_launcher_target }}
template_nginx_config = {{ template_nginx_config_target }}
template_nginx_launcher = {{ template_nginx_launcher_target }}
nginx-location = {{ nginx_location }}
chromium-wrapper = {{ chromium_wrapper }}
template-nginx-config = {{ template_nginx_config_target }}
[instance-headless-chromium]
recipe = slapos.recipe.template:jinja2
......
......@@ -21,42 +21,42 @@ log = ${:home}/log
ip = {{ partition_ipv6 }}
remote-debugging-port = 9222
url = https://example.com
remote_debug_url = http://[${:ip}]:${:remote-debugging-port}
remote-debug-url = http://[${:ip}]:${:remote-debugging-port}
nginx-port = 9345
proxy_url = http://[${:ip}]:${:nginx-port}
nginx_config_target = ${directory:etc}/nginx.conf
nginx_pid_path = ${directory:log}/nginx.pid
nginx_temp_path = ${directory:tmp}
nginx_error_log = ${directory:log}/nginx-error.log
nginx_access_log = ${directory:log}/nginx-access.log
proxy-url = http://[${:ip}]:${:nginx-port}
nginx-config-target = ${directory:etc}/nginx.conf
nginx-pid-path = ${directory:log}/nginx.pid
nginx-temp-path = ${directory:tmp}
nginx-error-log = ${directory:log}/nginx-error.log
nginx-access-log = ${directory:log}/nginx-access.log
# Create a launcher script for the headless shell executable.
[chromium-launcher]
recipe = slapos.cookbook:wrapper
command-line = {{ parameter_list['chromium_wrapper'] }} --remote-debugging-address=:: --remote-debugging-port=${headless-chromium:remote-debugging-port} ${headless-chromium:url}
command-line = {{ parameter_list['chromium-wrapper'] }} --remote-debugging-address=:: --remote-debugging-port=${headless-chromium:remote-debugging-port} ${headless-chromium:url}
wrapper-path = ${directory:service}/chromium
# Create a configuration file for the proxy server.
[nginx-config]
recipe = slapos.recipe.template:jinja2
template = {{ parameter_list['template_nginx_config'] }}
rendered = ${headless-chromium:nginx_config_target}
template = {{ parameter_list['template-nginx-config'] }}
rendered = ${headless-chromium:nginx-config-target}
mode = 700
context =
section param_chromium_headless headless-chromium
section param_headless_chromium headless-chromium
# Create a launcher script for the proxy server.
[nginx-launcher]
recipe = slapos.cookbook:wrapper
command-line = {{ parameter_list['nginx_location'] }}/sbin/nginx -c ${headless-chromium:nginx_config_target}
command-line = {{ parameter_list['nginx-location'] }}/sbin/nginx -c ${headless-chromium:nginx-config-target}
wrapper-path = ${directory:service}/nginx
[publish-connection-information]
recipe = slapos.cookbook:publish
remote_debug_url = ${headless-chromium:remote_debug_url}
proxy_url = ${headless-chromium:proxy_url}
cdn_url = ${remote-debugging-frontend:connection-secure_access}
remote-debug-url = ${headless-chromium:remote-debug-url}
proxy-url = ${headless-chromium:proxy-url}
frontend-url = ${remote-debugging-frontend:connection-secure_access}
# Request a frontend URL from the CDN for the remote debugging interface.
[remote-debugging-frontend]
......@@ -65,7 +65,7 @@ recipe = slapos.cookbook:requestoptional
name = Headless Chromium Remote Debugging Frontend
software-url = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg
slave = true
config-url = ${headless-chromium:proxy_url}
config-url = ${headless-chromium:proxy-url}
config-https-only = true
config-type = websocket
config-websocket-path-list = /devtools
......
......@@ -18,9 +18,7 @@ context =
section buildout buildout
key nginx_location nginx:location
key chromium_wrapper chromium-wrapper:location
key template_launcher_target template-chromium-launcher:target
key template_nginx_config_target template-nginx-conf:target
key template_nginx_launcher_target template-nginx-launcher:target
key template_instance_headless_chromium_target instance-headless-chromium:target
[download-base]
......
pid {{ param_chromium_headless['nginx_pid_path'] }};
error_log {{ param_chromium_headless['nginx_error_log'] }};
pid {{ param_headless_chromium['nginx-pid-path'] }};
error_log {{ param_headless_chromium['nginx-error-log'] }};
events {
worker_connections 1024;
}
http {
access_log {{ param_chromium_headless['nginx_access_log'] }};
access_log {{ param_headless_chromium['nginx-access-log'] }};
server {
listen [{{ param_chromium_headless['ip'] }}]:{{ param_chromium_headless['nginx-port'] }};
listen [{{ param_headless_chromium['ip'] }}]:{{ param_headless_chromium['nginx-port'] }};
client_body_temp_path {{ param_chromium_headless['nginx_temp_path'] }};
proxy_temp_path {{ param_chromium_headless['nginx_temp_path'] }};
fastcgi_temp_path {{ param_chromium_headless['nginx_temp_path'] }};
uwsgi_temp_path {{ param_chromium_headless['nginx_temp_path'] }};
scgi_temp_path {{ param_chromium_headless['nginx_temp_path'] }};
client_body_temp_path {{ param_headless_chromium['nginx-temp-path'] }};
proxy_temp_path {{ param_headless_chromium['nginx-temp-path'] }};
fastcgi_temp_path {{ param_headless_chromium['nginx-temp-path'] }};
uwsgi_temp_path {{ param_headless_chromium['nginx-temp-path'] }};
scgi_temp_path {{ param_headless_chromium['nginx-temp-path'] }};
# All websocket connections are served from /devtools.
location /devtools {
proxy_http_version 1.1;
proxy_set_header Host [{{ param_chromium_headless['ip'] }}]:{{ param_chromium_headless['remote-debugging-port'] }};
proxy_pass {{ param_chromium_headless['remote_debug_url'] }};
proxy_set_header Host [{{ param_headless_chromium['ip'] }}]:{{ param_headless_chromium['remote-debugging-port'] }};
proxy_pass {{ param_headless_chromium['remote-debug-url'] }};
proxy_set_header Upgrade "websocket";
proxy_set_header Connection "Upgrade";
}
......@@ -31,11 +31,11 @@ http {
# The proxy must set the Host header to an IP address, since the headless Chromium shell refuses to run otherwise, for security reasons.
# See https://bugs.chromium.org/p/chromium/issues/detail?id=813540.
proxy_set_header Host [{{ param_chromium_headless['ip'] }}]:{{ param_chromium_headless['remote-debugging-port'] }};
proxy_pass {{ param_chromium_headless['remote_debug_url'] }};
proxy_set_header Host [{{ param_headless_chromium['ip'] }}]:{{ param_headless_chromium['remote-debugging-port'] }};
proxy_pass {{ param_headless_chromium['remote-debug-url'] }};
# The browser security policy will prevent us from loading the Websocket connection without TLS, so we have to go through the frontend CDN URL. The tricky thing is that the frontend URL is not available yet when this file is built; what we do instead is use the given Host header. This is possibly fragile; perhaps alternatives are worth investigating.
sub_filter "ws=[{{ param_chromium_headless['ip'] }}]:{{ param_chromium_headless['remote-debugging-port'] }}" "wss=$host";
sub_filter "ws=[{{ param_headless_chromium['ip'] }}]:{{ param_headless_chromium['remote-debugging-port'] }}" "wss=$host";
sub_filter_once on;
sub_filter_types application/json;
}
......
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