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
Labels
Merge Requests
104
Merge Requests
104
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos
Commits
75b9189f
Commit
75b9189f
authored
Aug 29, 2022
by
Alain Takoudjou
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
headless-chromium: fix software release and add more options
parent
bfd5cb9f
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
86 additions
and
48 deletions
+86
-48
software/headless-chromium/README.md
software/headless-chromium/README.md
+3
-0
software/headless-chromium/buildout.hash.cfg
software/headless-chromium/buildout.hash.cfg
+3
-3
software/headless-chromium/instance-headless-chromium-input-schema.json
...ess-chromium/instance-headless-chromium-input-schema.json
+26
-6
software/headless-chromium/instance-headless-chromium.cfg.in
software/headless-chromium/instance-headless-chromium.cfg.in
+47
-31
software/headless-chromium/instance.cfg.in
software/headless-chromium/instance.cfg.in
+5
-2
software/headless-chromium/templates/nginx.conf.in
software/headless-chromium/templates/nginx.conf.in
+2
-6
No files found.
software/headless-chromium/README.md
View file @
75b9189f
...
...
@@ -26,5 +26,8 @@ The following instance parameters can be configured:
-
remote-debugging-port: Port for Chromium to listen on.
-
nginx-proxy-port: Port for Ningx proxy to listen on.
-
monitor-httpd-port: Port for monitor.
-
incognito: Force Incognito mode
-
window-size: Initial windo size
-
block-new-web-contents: Block new web contents
See
`instance-headless-chromium-input-schema.json`
for default values.
software/headless-chromium/buildout.hash.cfg
View file @
75b9189f
[template-cfg]
filename = instance.cfg.in
md5sum =
4d73fe3c5d286163974bdb79c838e030
md5sum =
6315598b2c7c19f9e2d9cdf090492e2c
[instance-headless-chromium]
_update_hash_filename_ = instance-headless-chromium.cfg.in
md5sum =
d72e5f6e159081f1c204ceb7ec0c0caf
md5sum =
a350b7b5ac03971f1b8d66949905c164
[template-nginx-conf]
_update_hash_filename_ = templates/nginx.conf.in
md5sum =
c4d09d2b819f624087ef4c38551dfe2f
md5sum =
1f35f91fa7e490cd1e2194264a8a6ed8
[template-mime-types]
_update_hash_filename_ = templates/mime-types.in
...
...
software/headless-chromium/instance-headless-chromium-input-schema.json
View file @
75b9189f
{
"type"
:
"object"
,
"$schema"
:
"http://json-schema.org/draft-04/schema"
,
"required"
:
[
"target-url"
],
"title"
:
"Input Parameters"
,
"properties"
:
{
"target-url"
:
{
"description"
:
"URL for Chromium to load on startup."
,
"title"
:
"Target URL"
,
"type"
:
"string"
,
"default"
:
"https://www.example.com"
"description"
:
"Web site URL to load on headless chromium."
,
"title"
:
"Application target URL"
,
"type"
:
"string"
},
"remote-debugging-port"
:
{
"description"
:
"Port for Chromium to listen on."
,
"title"
:
"Remote Debugging Port"
,
"type"
:
"integer"
,
"default"
:
8081
"default"
:
9222
},
"nginx-proxy-port"
:
{
"description"
:
"Port for Nginx proxy to listen on."
,
"title"
:
"Nginx Proxy Port"
,
"type"
:
"integer"
,
"default"
:
8082
"default"
:
9224
},
"incognito"
:
{
"description"
:
"Force Incognito mode"
,
"title"
:
"Force Incognito mode"
,
"type"
:
"boolean"
,
"default"
:
true
},
"window-size"
:
{
"description"
:
"Set the initial window size. Provided as string in the format
\"
800,600
\"
."
,
"title"
:
"Initial windo size"
,
"type"
:
"string"
,
"default"
:
"800,600"
},
"block-new-web-contents"
:
{
"description"
:
"If true, then all pop-ups and calls to window.open will fail."
,
"title"
:
"Block new web contents"
,
"type"
:
"boolean"
,
"default"
:
false
},
"monitor-httpd-port"
:
{
"description"
:
"Port for monitor frontend."
,
...
...
software/headless-chromium/instance-headless-chromium.cfg.in
View file @
75b9189f
{% set parameter_dict = dict(default_parameter_dict, **slapparameter_dict) %}
[buildout]
parts =
chromium-launcher
generate-passwd-file
nginx-config
nginx-mime-types
nginx-launcher
logrotate-entry-nginx
publish-connection-information
frontend-ok-promise
frontend-secure-promise
eggs-directory = {{ buildout['eggs-directory'] }}
develop-eggs-directory = {{ buildout['develop-eggs-directory'] }}
offline = true
extends = {{ parameter_list['template-monitor'] }}
# Create necessary directories.
[directory]
recipe = slapos.cookbook:mkdirectory
...
...
@@ -34,7 +16,10 @@ service = ${:etc}/service
ipv4 = {{ partition_ipv4 }}
ipv6 = {{ partition_ipv6 }}
remote-debugging-port = {{ parameter_dict['remote-debugging-port'] }}
url = {{ parameter_dict['target-url'] }}
target-url = {{ parameter_dict['target-url'] }}
incognito = {{ parameter_dict['incognito'] }}
window-size = {{ parameter_dict['window-size'] }}
block-new-web-contents = {{ parameter_dict['block-new-web-contents'] }}
remote-debugging-address = ${:ipv4}:${:remote-debugging-port}
devtools-frontend-root = {{ parameter_list['devtools-frontend'] }}
...
...
@@ -51,19 +36,29 @@ nginx-cert-file = ${frontend-instance-certificate:cert-file}
nginx-mime-types = ${directory:etc}/mime-types
# Create a
launcher script in /etc/service
for the headless shell
# Create a
wrapper script in /bin/chromium
for the headless shell
# executable.
[chromium-launcher]
recipe = slapos.recipe.template
inline =
#!/bin/sh
[chromium-wrapper]
recipe = slapos.cookbook:wrapper
wrapper-path = ${directory:bin}/chromium
command-line =
{{ parameter_list['chromium-wrapper'] }}
--remote-debugging-address=${headless-chromium:ipv4}
--remote-debugging-port=${headless-chromium:remote-debugging-port}
--user-data-dir=${directory:tmp}
--window-size="${headless-chromium:window-size}"
{% if parameter_dict['incognito'] %}--incognito{% endif -%}
{% if parameter_dict['block-new-web-contents'] %}--block-new-web-contents{% endif -%}
{{ '\n "${headless-chromium:target-url}"' }}
environment =
FONTCONFIG_FILE=${font-config:output}
export FONTCONFIG_FILE=${font-config:output}
exec {{ parameter_list['chromium-wrapper'] }} \
--remote-debugging-address=${headless-chromium:ipv4} \
--remote-debugging-port=${headless-chromium:remote-debugging-port} \
${headless-chromium:url}
output = ${directory:service}/chromium
[chromium-launcher]
recipe = slapos.cookbook:wrapper
command-line = ${chromium-wrapper:wrapper-path}
wrapper-path = ${directory:service}/chromium
hash-existing-files = ${buildout:directory}/software_release/buildout.cfg
hash-files = ${chromium-wrapper:wrapper-path}
# Configure and launch the proxy server.
...
...
@@ -81,7 +76,9 @@ output = ${headless-chromium:nginx-mime-types}
[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
[logrotate-entry-nginx]
...
...
@@ -189,3 +186,22 @@ name = headless-chromium-frontend-secure.py
url = ${remote-debugging-frontend:connection-secure_access}
config-url = ${:url}
config-http-code = 401
[buildout]
extends = {{ parameter_list['template-monitor'] }}
parts =
chromium-launcher
generate-passwd-file
nginx-config
nginx-mime-types
nginx-launcher
logrotate-entry-nginx
remote-debugging-frontend
publish-connection-information
frontend-ok-promise
frontend-secure-promise
eggs-directory = {{ buildout['eggs-directory'] }}
develop-eggs-directory = {{ buildout['develop-eggs-directory'] }}
offline = true
software/headless-chromium/instance.cfg.in
View file @
75b9189f
...
...
@@ -32,8 +32,11 @@ context =
jsonkey default_parameter_dict :default-parameters
default-parameters =
{
"remote-debugging-port": 8081,
"nginx-proxy-port": 8082,
"remote-debugging-port": 9222,
"nginx-proxy-port": 9224,
"incognito": true,
"window-size": "800,600",
"block-new-web-contents": false,
"target-url": "https://www.example.com",
"monitor-httpd-port": 8083
}
...
...
software/headless-chromium/templates/nginx.conf.in
View file @
75b9189f
pid {{ param_headless_chromium['nginx-pid-path'] }};
error_log {{ param_headless_chromium['nginx-error-log'] }};
daemon off;
events {
worker_connections 1024;
}
...
...
@@ -11,12 +13,6 @@ http {
include {{ param_headless_chromium['nginx-mime-types'] }};
default_type application/octet-stream;
types {
text/html html;
text/css css;
application/javascript js;
}
server {
listen {{ param_headless_chromium['proxy-address'] }} ssl;
...
...
Jérome Perrin
@jerome
mentioned in merge request
!1477 (closed)
·
Nov 21, 2023
mentioned in merge request
!1477 (closed)
mentioned in merge request !1477
Toggle commit list
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