Commit 713defde authored by Łukasz Nowak's avatar Łukasz Nowak

software/erp5testnode: Replace caddy with haproxy

parent 2337e24a
...@@ -18,4 +18,4 @@ md5sum = 5bd72da73a8b84f70f568686924d7d6c ...@@ -18,4 +18,4 @@ md5sum = 5bd72da73a8b84f70f568686924d7d6c
[template-default] [template-default]
filename = instance-default.cfg.jinja.in filename = instance-default.cfg.jinja.in
md5sum = 2aafd7708aac85847da3a8679b84fe34 md5sum = 96fb2221c8a91fb44dc5b931c29e0af9
...@@ -107,23 +107,43 @@ inline = ...@@ -107,23 +107,43 @@ inline =
--unixdomain-only=$${:socket}:$(id -u):$(id -g):0600 \ --unixdomain-only=$${:socket}:$(id -u):$(id -g):0600 \
--service "/:$(id -u):$(id -g):HOME:$${shell-environment:shell} -l" --service "/:$(id -u):$(id -g):HOME:$${shell-environment:shell} -l"
[shellinabox-frontend-certificate]
recipe = plone.recipe.command
command =
if [ ! -e $${:cert-file} ]
then
${openssl-output:openssl} req -x509 -nodes -days 3650 \
-subj "/C=AA/ST=X/L=X/O=Dis/CN=$${:common-name}" \
-newkey rsa:2048 -keyout $${:cert-file} \
-out $${:cert-file}
fi
update-command = $${:command}
cert-file = $${directory:var}/$${:_buildout_section_name_}.pem
common-name = $${:ipv6}
location =
$${:cert-file}
ipv6 = {{ partition_ipv6 }}
[shellinabox-frontend-config] [shellinabox-frontend-config]
recipe = slapos.recipe.template recipe = slapos.recipe.template:jinja2
url = ${stack-haproxy-default-backend-config:target}
output = $${directory:etc}/$${:_buildout_section_name_} output = $${directory:etc}/$${:_buildout_section_name_}
inline = context =
https://$${:hostname}:$${:port} { key pidfile :pidfile
bind $${:ipv6} key content :content
tls self_signed pidfile = $${:pidfile}
gzip content =
log stdout userlist auth
errors stderr user $${:username} insecure-password $${:passwd}
proxy / unix:$${shellinabox:socket}
basicauth $${:username} $${:passwd} { listen app
realm "Test Node $${testnode:test-node-title}" log global
/ acl auth_ok http_auth(auth)
} http-request auth realm "Test Node $${testnode:test-node-title}" unless auth_ok
} bind $${:ipv6}:$${:port} ssl crt $${shellinabox-frontend-certificate:cert-file} alpn h2,http/1.1
ipv6 = {{ partition_ipv6 }} server app unix@$${shellinabox:socket}
ipv6 = $${shellinabox-frontend-certificate:ipv6}
hostname = [$${:ipv6}] hostname = [$${:ipv6}]
port = 8080 port = 8080
username = testnode username = testnode
...@@ -131,24 +151,24 @@ passwd = $${pwgen:passwd} ...@@ -131,24 +151,24 @@ passwd = $${pwgen:passwd}
cert-file = $${directory:shellinabox}/public.crt cert-file = $${directory:shellinabox}/public.crt
key-file = $${directory:shellinabox}/private.key key-file = $${directory:shellinabox}/private.key
backend-url = https://$${:username}:$${:passwd}@$${:hostname}:$${:port} backend-url = https://$${:username}:$${:passwd}@$${:hostname}:$${:port}
pidfile = $${basedirectory:run}/shellinabox-haproxy.pid
[shellinabox-frontend] [shellinabox-frontend]
recipe = slapos.cookbook:wrapper recipe = slapos.cookbook:wrapper
wrapper-path = $${rootdirectory:bin}/$${:_buildout_section_name_} wrapper-path = $${rootdirectory:bin}/$${:_buildout_section_name_}
command-line = command-line =
${caddy:output} -conf $${shellinabox-frontend-config:output} -pidfile $${:pidfile} ${haproxy:location}/sbin/haproxy -f $${shellinabox-frontend-config:output}
url = $${shellinabox-frontend-config:backend-url} url = $${shellinabox-frontend-config:backend-url}
hostname = $${shellinabox-frontend-config:ipv6} hostname = $${shellinabox-frontend-config:ipv6}
port = $${shellinabox-frontend-config:port} port = $${shellinabox-frontend-config:port}
pidfile = $${basedirectory:run}/$${:_buildout_section_name_}.pid pidfile = $${shellinabox-frontend-config:pidfile}
[shellinabox-frontend-reload] [shellinabox-frontend-reload]
recipe = slapos.cookbook:wrapper recipe = slapos.cookbook:wrapper
wrapper-path = $${basedirectory:services}/$${:_buildout_section_name_} wrapper-path = $${basedirectory:services}/$${:_buildout_section_name_}
command-line = command-line =
${bash:location}/bin/bash -c ${bash:location}/bin/bash -c
"kill -s USR1 $$(${coreutils:location}/bin/cat $${shellinabox-frontend:pidfile}) \ "kill -s USR2 $$(${coreutils:location}/bin/cat $${shellinabox-frontend:pidfile}) \
&& ${coreutils:location}/bin/sleep infinity" && ${coreutils:location}/bin/sleep infinity"
hash-files = hash-files =
$${shellinabox-frontend-config:output} $${shellinabox-frontend-config:output}
......
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
extends = extends =
buildout.hash.cfg buildout.hash.cfg
../../stack/slapos.cfg ../../stack/slapos.cfg
../../stack/haproxy/default-backend.cfg
../../component/git/buildout.cfg ../../component/git/buildout.cfg
../../component/lxml-python/buildout.cfg ../../component/lxml-python/buildout.cfg
../../component/zip/buildout.cfg ../../component/zip/buildout.cfg
../../component/bash/buildout.cfg ../../component/bash/buildout.cfg
../../component/caddy/buildout.cfg
../../component/coreutils/buildout.cfg ../../component/coreutils/buildout.cfg
../../component/shellinabox/buildout.cfg ../../component/shellinabox/buildout.cfg
../../component/pwgen/buildout.cfg ../../component/pwgen/buildout.cfg
......
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