Commit 762ab365 authored by Łukasz Nowak's avatar Łukasz Nowak

caddy-frontend: Fix Nginx main configuration

jinja2 template is required, as some paramters might come from the network.
parent 6c80353c
...@@ -18,7 +18,7 @@ md5sum = 906e5bd66b1265b8109a86b6ab46e91f ...@@ -18,7 +18,7 @@ md5sum = 906e5bd66b1265b8109a86b6ab46e91f
[template-apache-frontend] [template-apache-frontend]
filename = instance-apache-frontend.cfg filename = instance-apache-frontend.cfg
md5sum = 3490155542f31cefd5c3f5aea8767586 md5sum = 2db996d2c48c0fe03c05f051e7a914bc
[template-apache-replicate] [template-apache-replicate]
filename = instance-apache-replicate.cfg.in filename = instance-apache-replicate.cfg.in
...@@ -82,7 +82,7 @@ md5sum = 117238225b3fc3c5b5be381815f44c67 ...@@ -82,7 +82,7 @@ md5sum = 117238225b3fc3c5b5be381815f44c67
[template-nginx-configuration] [template-nginx-configuration]
filename = templates/nginx.cfg.in filename = templates/nginx.cfg.in
md5sum = eae367cbf665816fbfe274026c848075 md5sum = 314a55a75b80009123df310b313a5483
[template-nginx-eventsource-slave-virtualhost] [template-nginx-eventsource-slave-virtualhost]
filename = templates/nginx-eventsource-slave.conf.in filename = templates/nginx-eventsource-slave.conf.in
......
...@@ -683,7 +683,7 @@ rendered = $${directory:bin}/nginx-wrapper ...@@ -683,7 +683,7 @@ rendered = $${directory:bin}/nginx-wrapper
mode = 0700 mode = 0700
extra-context = extra-context =
raw caddy ${caddy:output} raw caddy ${caddy:output}
key conf nginx-configuration:output key conf dynamic-nginx-frontend-template:rendered
key log nginx-configuration:error_log key log nginx-configuration:error_log
key grace instance-parameter:configuration.mpm-graceful-shutdown-timeout key grace instance-parameter:configuration.mpm-graceful-shutdown-timeout
...@@ -692,11 +692,20 @@ recipe = slapos.cookbook:wrapper ...@@ -692,11 +692,20 @@ recipe = slapos.cookbook:wrapper
command-line = $${nginx-wrapper:rendered} -pidfile $${nginx-configuration:pid-file} command-line = $${nginx-wrapper:rendered} -pidfile $${nginx-configuration:pid-file}
wrapper-path = $${directory:service}/frontend_nginx wrapper-path = $${directory:service}/frontend_nginx
[nginx-configuration] [dynamic-nginx-frontend-template]
recipe = slapos.recipe.template < = jinja2-template-base
url = ${template-nginx-configuration:output} template = ${template-nginx-configuration:output}
output = $${directory:etc}/nginx.cfg rendered = $${directory:etc}/nginx.cfg
mode = 0600 mode = 0600
extra-context =
key port nginx-configuration:port
key ssl_certificate nginx-configuration:ssl_certificate
key ssl_key nginx-configuration:ssl_key
key local_ip nginx-configuration:local_ip
key plain_port nginx-configuration:plain_port
key slave_configuration_directory nginx-configuration:slave-configuration-directory
[nginx-configuration]
access_log = $${directory:log}/nginx-access.log access_log = $${directory:log}/nginx-access.log
error_log = $${directory:log}/nginx-error.log error_log = $${directory:log}/nginx-error.log
ip = $${slap-network-information:global-ipv6} ip = $${slap-network-information:global-ipv6}
......
# Dummy site for starting Caddy correctly # Dummy site for starting Caddy correctly
https://www.example.org:$${nginx-configuration:port} { https://www.example.org:{{ port }} {
tls $${nginx-configuration:ssl_certificate} $${nginx-configuration:ssl_key} tls {{ ssl_certificate }} {{ ssl_key }}
bind $${nginx-configuration:local_ip} bind {{ local_ip }}
# Serve an error 204 (No Content) for favicon.ico # Serve an error 204 (No Content) for favicon.ico
status 204 /favicon.ico status 204 /favicon.ico
status 404 / status 404 /
} }
http://www.example.org:$${nginx-configuration:plain_port} { http://www.example.org:{{ plain_port }} {
bind $${nginx-configuration:local_ip} bind {{ local_ip }}
# Serve an error 204 (No Content) for favicon.ico # Serve an error 204 (No Content) for favicon.ico
status 204 /favicon.ico status 204 /favicon.ico
status 404 / status 404 /
...@@ -70,4 +70,4 @@ status 404 / ...@@ -70,4 +70,4 @@ status 404 /
# TODO-Caddy proxy_temp_path $${directory:varnginx} 1 2; # TODO-Caddy proxy_temp_path $${directory:varnginx} 1 2;
# TODO-Caddy } # TODO-Caddy }
import $${nginx-configuration:slave-configuration-directory}/*.conf import {{ slave_configuration_directory }}/*.conf
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