Commit 60e1cdc2 authored by Eteri's avatar Eteri

caddy: add proxy

parent 09f2f83b
...@@ -10,12 +10,33 @@ tls {{ custom_cert_dict['cert-file'] }} {{ custom_cert_dict['key-file'] }} { ...@@ -10,12 +10,33 @@ tls {{ custom_cert_dict['cert-file'] }} {{ custom_cert_dict['key-file'] }} {
log {{caddy_configuration_dict['access_log']}} log {{caddy_configuration_dict['access_log']}}
errors {{caddy_configuration_dict['error_log']}}
root {{ directory_dict['public_html'] }} root {{ directory_dict['public_html'] }}
{% if parameter_dict['enable-basic-auth'] == 'true' -%} {% if parameter_dict['enable-basic-auth'] == 'true' -%}
basicauth / {{ parameter_dict['username'] }} {{parameter_dict['password']}} basicauth / {{ parameter_dict['username'] }} {{parameter_dict['password']}}
{%- endif %} {%- endif %}
{% if parameter_dict['proxy'] == 'true' -%}
{% if parameter_dict['zope'] == 'true' -%}
proxy / {{parameter_dict['url']}}/VirtualHostBase/https/{{ parameter_dict['domain'] }}/VirtualHostRoot/ {
insecure_skip_verify
}
{% else %}
proxy / {{parameter_dict['url']}}
{%- endif %}
{%- endif %}
bind {{caddy_configuration_dict['ipv6']}}
} }
{%- endif %} {%- endif %}
...@@ -30,22 +51,43 @@ basicauth / {{ parameter_dict['username'] }} {{parameter_dict['password']}} ...@@ -30,22 +51,43 @@ basicauth / {{ parameter_dict['username'] }} {{parameter_dict['password']}}
log {{caddy_configuration_dict['access_log']}} log {{caddy_configuration_dict['access_log']}}
errors {{caddy_configuration_dict['error_log']}}
root {{ directory_dict['public_html'] }} root {{ directory_dict['public_html'] }}
{% if parameter_dict['enable-basic-auth'] == 'true' -%} {% if parameter_dict['enable-basic-auth'] == 'true' -%}
basicauth / {{ parameter_dict['username'] }} {{parameter_dict['password']}} basicauth / {{ parameter_dict['username'] }} {{parameter_dict['password']}}
{%- endif %} {%- endif %}
{% if parameter_dict['proxy'] == 'true' -%}
{% if parameter_dict['zope'] == 'true' -%}
proxy / {{parameter_dict['url']}}/VirtualHostBase/https/[{{caddy_configuration_dict['ipv6']}}]:{{parameter_dict['port-ipv6']}}/VirtualHostRoot/ {
insecure_skip_verify
}
{% else %}
proxy / {{parameter_dict['url']}}
{%- endif %}
{%- endif %}
bind {{caddy_configuration_dict['ipv6']}}
} }
[{{caddy_configuration_dict['local_ip']}}]:{{parameter_dict['port-ipv4']}} { [{{caddy_configuration_dict['local_ip']}}]:{{parameter_dict['port-ipv4']}} {
log {{caddy_configuration_dict['access_log']}} log {{caddy_configuration_dict['access_log']}}
errors {{caddy_configuration_dict['error_log']}}
root {{ directory_dict['public_html'] }} root {{ directory_dict['public_html'] }}
{% if parameter_dict['enable-basic-auth'] == 'true' -%} {% if parameter_dict['enable-basic-auth'] == 'true' -%}
basicauth / {{ parameter_dict['username'] }} {{parameter_dict['password']}} basicauth / {{ parameter_dict['username'] }} {{parameter_dict['password']}}
{%- endif %} {%- endif %}
bind {{caddy_configuration_dict['local_ip']}}
} }
\ No newline at end of file
...@@ -27,7 +27,7 @@ mode = 0644 ...@@ -27,7 +27,7 @@ mode = 0644
[template-caddyfile] [template-caddyfile]
recipe = slapos.recipe.build:download recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/Caddyfile.in url = ${:_profile_base_location_}/Caddyfile.in
#md5sum = bb3b314ebeb58e9875d547a053a9f268 #md5sum = ebaaf7b7c5f8f4f29786a3d6e221f25c
filename = Caddyfile.in filename = Caddyfile.in
location = ${buildout:parts-directory}/${:_buildout_section_name_} location = ${buildout:parts-directory}/${:_buildout_section_name_}
mode = 0644 mode = 0644
...@@ -35,21 +35,21 @@ mode = 0644 ...@@ -35,21 +35,21 @@ mode = 0644
[template-caddy] [template-caddy]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-caddy.cfg.in url = ${:_profile_base_location_}/instance-caddy.cfg.in
md5sum = 3b796dee5c509393fd396fd019914a2e #md5sum = b1b53184863a2acc953531c0506e13bf
output = ${buildout:directory}/instance-caddy.cfg.in output = ${buildout:directory}/instance-caddy.cfg.in
mode = 0644 mode = 0644
[template-public-html] [template-public-html]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/templates/index.html url = ${:_profile_base_location_}/templates/index.html
md5sum = b5794ac8b10ed90173ad566e6e324b35 #md5sum = b5794ac8b10ed90173ad566e6e324b35
output = ${buildout:directory}/index.html output = ${buildout:directory}/index.html
mode = 0644 mode = 0644
[template-caddy-service] [template-caddy-service]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/template-caddy-service.sh.in url = ${:_profile_base_location_}/template-caddy-service.sh.in
md5sum = 5467fac7b95acde681e613ae98ce990d #md5sum = 5467fac7b95acde681e613ae98ce990d
output = ${buildout:directory}/template-caddy-service.sh.in output = ${buildout:directory}/template-caddy-service.sh.in
mode = 0644 mode = 0644
......
...@@ -119,7 +119,7 @@ user = $${slap-parameter:username} ...@@ -119,7 +119,7 @@ user = $${slap-parameter:username}
secure_access = https://[$${caddy-configuration:ipv6}]:$${slap-parameter:port-ipv6} secure_access = https://[$${caddy-configuration:ipv6}]:$${slap-parameter:port-ipv6}
[slap-parameter] [slap-parameter]
domain = domain = caddy-test.erp5.net:9443
key-content = key-content =
cert-content = cert-content =
caddy-ca-certificate = caddy-ca-certificate =
...@@ -129,3 +129,6 @@ enable-quic = true ...@@ -129,3 +129,6 @@ enable-quic = true
enable-basic-auth = enable-basic-auth =
username = admin username = admin
password = $${htpasswd:passwd} password = $${htpasswd:passwd}
proxy = true
zope = true
url = https://[2001:67c:1254:72::5d03]:2151
\ No newline at end of file
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