Commit 7ea2e034 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

apache_frontend: introduce default virtualhost with notfound message, add per slave logging

parent f38903c1
<VirtualHost *:{{ https_port }}>
ServerName www.example.org
SSLEngine on
SSLProxyEngine on
SSLProtocol -ALL +SSLv3 +TLSv1
SSLHonorCipherOrder On
SSLCipherSuite RC4-SHA:HIGH:!ADH
# Rewrite part
ProxyVia On
ProxyPreserveHost On
ProxyTimeout 600
RewriteEngine On
ErrorDocument 404 /notfound.html
</VirtualHost>
<VirtualHost *:{{ http_port }}>
ServerName www.example.org
ErrorDocument 404 /notfound.html
</VirtualHost>
\ No newline at end of file
...@@ -15,6 +15,8 @@ context = ...@@ -15,6 +15,8 @@ context =
{% set slave_section_title = 'dynamic-template-slave-instance-%s' % slave_reference -%} {% set slave_section_title = 'dynamic-template-slave-instance-%s' % slave_reference -%}
{% set slave_parameter_dict = generic_instance_parameter_dict.copy() -%} {% set slave_parameter_dict = generic_instance_parameter_dict.copy() -%}
{% do part_list.append(slave_section_title) -%} {% do part_list.append(slave_section_title) -%}
{% do slave_parameter_dict.__setitem__('access_log', '/'.join([apache_log_directory, '%s_access_log' % slave_reference])) -%}
{% do slave_parameter_dict.__setitem__('error_log', '/'.join([apache_log_directory, '%s_error_log' % slave_reference])) -%}
[{{ slave_section_title }}] [{{ slave_section_title }}]
< = jinja2-template-base < = jinja2-template-base
template = {{ template_slave_configuration }} template = {{ template_slave_configuration }}
......
...@@ -104,6 +104,17 @@ recipe = slapos.recipe.build:download ...@@ -104,6 +104,17 @@ recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/apache-yakari.cfg.in url = ${:_profile_base_location_}/apache-yakari.cfg.in
mode = 640 mode = 640
[template-not-found-html]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/notfound.html
filename = notfound.html
mode = 640
[template-default-virtualhost]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/000.conf.in
mode = 640
[template-empty] [template-empty]
recipe = slapos.recipe.build:download recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/empty.in url = ${:_profile_base_location_}/empty.in
......
...@@ -17,6 +17,8 @@ parts = ...@@ -17,6 +17,8 @@ parts =
frontend-apache-graceful frontend-apache-graceful
cached-apache-graceful cached-apache-graceful
squid-reload squid-reload
dynamic-template-default-vh
not-found-html
promise-apache-frontend-v4-https promise-apache-frontend-v4-https
promise-apache-frontend-v4-http promise-apache-frontend-v4-http
promise-apache-frontend-v6-https promise-apache-frontend-v6-https
...@@ -89,6 +91,15 @@ context = ...@@ -89,6 +91,15 @@ context =
key slapparameter_dict instance-parameter:configuration key slapparameter_dict instance-parameter:configuration
$${:extra-context} $${:extra-context}
[dynamic-template-default-vh]
< = jinja2-template-base
template = ${template-default-virtualhost:target}
rendered = $${apache-directory:slave-configuration}/000.conf
extensions = jinja2.ext.do
extra-context =
key http_port instance-parameter:configuration.plain_http_port
key https_port instance-parameter:configuration.port
[dynamic-template-slave-list] [dynamic-template-slave-list]
< = jinja2-template-base < = jinja2-template-base
template = ${template-slave-list:target} template = ${template-slave-list:target}
...@@ -101,6 +112,7 @@ extra-context = ...@@ -101,6 +112,7 @@ extra-context =
key slave_instance_list instance-parameter:slave-instance-list key slave_instance_list instance-parameter:slave-instance-list
key rewrite_cached_configuration apache-configuration:cached-rewrite-file key rewrite_cached_configuration apache-configuration:cached-rewrite-file
key custom_ssl_directory apache-directory:vh-ssl key custom_ssl_directory apache-directory:vh-ssl
key apache_log_directory apache-directory:slave-log
raw empty_template ${template-empty:target} raw empty_template ${template-empty:target}
raw cache_access http://$${instance-parameter:ipv4-random}:$${apache-configuration:cache-port} raw cache_access http://$${instance-parameter:ipv4-random}:$${apache-configuration:cache-port}
raw template_slave_configuration ${template-slave-configuration:target} raw template_slave_configuration ${template-slave-configuration:target}
...@@ -203,6 +215,12 @@ wait-for-files = ...@@ -203,6 +215,12 @@ wait-for-files =
$${ca-frontend:cert-file} $${ca-frontend:cert-file}
$${ca-frontend:key-file} $${ca-frontend:key-file}
[not-found-html]
recipe = slapos.cookbook:symbolic.link
target-directory = $${apache-directory:document-root}
link-binary =
${template-not-found-html:target}
[apache-directory] [apache-directory]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
document-root = $${directory:srv}/htdocs document-root = $${directory:srv}/htdocs
...@@ -210,6 +228,7 @@ slave-configuration = $${directory:srv}/apache-slave-conf.d/ ...@@ -210,6 +228,7 @@ slave-configuration = $${directory:srv}/apache-slave-conf.d/
cache = $${directory:var}/cache cache = $${directory:var}/cache
mod-ssl = $${:cache}/httpd_mod_ssl mod-ssl = $${:cache}/httpd_mod_ssl
vh-ssl = $${:slave-configuration}/ssl vh-ssl = $${:slave-configuration}/ssl
slave-log = $${directory:log}/httpd
[apache-configuration] [apache-configuration]
frontend-configuration = $${directory:etc}/apache_frontend.conf frontend-configuration = $${directory:etc}/apache_frontend.conf
...@@ -305,7 +324,7 @@ state-file = $${directory:srv}/logrotate.status ...@@ -305,7 +324,7 @@ state-file = $${directory:srv}/logrotate.status
<= logrotate <= logrotate
recipe = slapos.cookbook:logrotate.d recipe = slapos.cookbook:logrotate.d
name = apache name = apache
log = $${apache-configuration:error-log} $${apache-configuration:access-log} log = $${apache-directory:slave-log}/*_log $${apache-configuration:error-log} $${apache-configuration:access-log}
frequency = daily frequency = daily
rotatep-num = 30 rotatep-num = 30
post = ${buildout:bin-directory}/killpidfromfile $${apache-configuration:pid-file} SIGUSR1 post = ${buildout:bin-directory}/killpidfromfile $${apache-configuration:pid-file} SIGUSR1
......
<html>
<head>
<title>Instance not found</title>
</head>
<body>
<h1>This instance has not been found.</h1>
<p>If this error persists, please check your instance URL and status on SlapOS Master.</p>
</body>
</html>
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