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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ekaterina
slapos
Commits
012eba7b
Commit
012eba7b
authored
Jul 25, 2018
by
Łukasz Nowak
Committed by
Łukasz Nowak
Jul 31, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
caddy-frontend: Minimize raw usage in jinja2
parent
615f4977
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
60 additions
and
53 deletions
+60
-53
software/caddy-frontend/buildout.hash.cfg
software/caddy-frontend/buildout.hash.cfg
+8
-8
software/caddy-frontend/instance-apache-frontend.cfg.in
software/caddy-frontend/instance-apache-frontend.cfg.in
+10
-5
software/caddy-frontend/templates/apache-custom-slave-list.cfg.in
.../caddy-frontend/templates/apache-custom-slave-list.cfg.in
+21
-19
software/caddy-frontend/templates/cached-virtualhost.conf.in
software/caddy-frontend/templates/cached-virtualhost.conf.in
+4
-4
software/caddy-frontend/templates/default-virtualhost.conf.in
...ware/caddy-frontend/templates/default-virtualhost.conf.in
+4
-4
software/caddy-frontend/templates/nginx-eventsource-slave.conf.in
.../caddy-frontend/templates/nginx-eventsource-slave.conf.in
+2
-2
software/caddy-frontend/templates/nginx-notebook-slave.conf.in
...are/caddy-frontend/templates/nginx-notebook-slave.conf.in
+4
-4
software/caddy-frontend/templates/template-log-access.conf.in
...ware/caddy-frontend/templates/template-log-access.conf.in
+7
-7
No files found.
software/caddy-frontend/buildout.hash.cfg
View file @
012eba7b
...
...
@@ -22,7 +22,7 @@ md5sum = c801b7f9f11f0965677c22e6bbe9281b
[template-apache-frontend]
filename = instance-apache-frontend.cfg.in
md5sum =
5221f4e8dc39a8f97c6a107549c4a682
md5sum =
29160773f60e5fc0eef25dc39553fadd
[template-apache-replicate]
filename = instance-apache-replicate.cfg.in
...
...
@@ -30,7 +30,7 @@ md5sum = 8d34141a9cd1e51462aba845c7bea85b
[template-slave-list]
filename = templates/apache-custom-slave-list.cfg.in
md5sum =
bdce0cf67a8f533891eabdec0b7eee87
md5sum =
8f29aaf247a6b8354292c78abe7a5ad6
[template-slave-configuration]
filename = templates/custom-virtualhost.conf.in
...
...
@@ -46,7 +46,7 @@ md5sum = 6689d96fc18d9aad78d77fe87770d4da
[template-custom-slave-list]
filename = templates/apache-custom-slave-list.cfg.in
md5sum =
bdce0cf67a8f533891eabdec0b7eee87
md5sum =
8f29aaf247a6b8354292c78abe7a5ad6
[caddy-backend-url-validator]
filename = templates/caddy-backend-url-validator.in
...
...
@@ -58,15 +58,15 @@ md5sum = f20d6c3d2d94fb685f8d26dfca1e822b
[template-default-slave-virtualhost]
filename = templates/default-virtualhost.conf.in
md5sum =
6da56d875f5cf396f8fd0685cf1a9a7a
md5sum =
8ed87061b9e20e2ad74aae9f80d1b53d
[template-cached-slave-virtualhost]
filename = templates/cached-virtualhost.conf.in
md5sum =
0e7d8df879ec363f771740d017cb7512
md5sum =
f149ab15334d7d15d8c525f02fc4d968
[template-log-access]
filename = templates/template-log-access.conf.in
md5sum =
cbf492b2fd8a955b0f92eb512fe9163f
md5sum =
36895c8d2631bde619456265a54f6203
[template-empty]
filename = templates/empty.in
...
...
@@ -90,11 +90,11 @@ md5sum = fadb2fcaf0f2b4fe735617fac222f7ed
[template-nginx-eventsource-slave-virtualhost]
filename = templates/nginx-eventsource-slave.conf.in
md5sum =
69d65e461cd7cd5ef5b1ccd0098b50c8
md5sum =
176cbca2070734a185a7ae5a4d1181c5
[template-nginx-notebook-slave-virtualhost]
filename = templates/nginx-notebook-slave.conf.in
md5sum =
21a102ac2ee98f9a7f168fa0a1390068
md5sum =
e018935e2cec2368991f743cab725741
[template-apache-lazy-script-call]
filename = templates/apache-lazy-script-call.sh.in
...
...
software/caddy-frontend/instance-apache-frontend.cfg.in
View file @
012eba7b
...
...
@@ -126,6 +126,10 @@ slave_instance_list = {{ dumps(instance_parameter['slave-instance-list']) }}
extra_slave_instance_list = ${configuration:extra_slave_instance_list}
local_ipv4 = {{ dumps(instance_parameter['ipv4-random']) }}
local_ipv6 = {{ dumps(instance_parameter['ipv6-random']) }}
software_type = single-custom-personal
bin_directory = {{ parameter_dict['bin_directory'] }}
sixtunnel_executable = {{ parameter_dict['sixtunnel'] }}/bin/6tunnel
service_directory = ${directory:service}
extra-context =
key caddy_configuration_directory caddy-directory:slave-configuration
key nginx_configuration_directory caddy-directory:nginx-slave-configuration
...
...
@@ -150,7 +154,7 @@ extra-context =
key template_cached_slave_configuration software-release-path:template-cached-slave-virtualhost
key template_eventsource_slave_configuration software-release-path:template-nginx-eventsource-slave-virtualhost
key template_notebook_slave_configuration software-release-path:template-nginx-notebook-slave-virtualhost
raw software_type single-custom-personal
key software_type :software_type
key frontend_lazy_graceful_reload frontend-caddy-lazy-graceful:rendered
section logrotate_dict logrotate
section frontend_configuration frontend-configuration
...
...
@@ -159,15 +163,15 @@ extra-context =
key monitor_base_url monitor-instance-parameter:monitor-base-url
key promise_directory monitor-directory:promises
key report_directory monitor-directory:reports
raw bin_directory {{ parameter_dict['bin_directory'] }}
key bin_directory :bin_directory
key login_certificate ca-frontend:cert-file
key login_key ca-frontend:key-file
key login_ca_crt ca-custom-frontend:rendered
key enable_http2_by_default configuration:enable-http2-by-default
key access_log caddy-configuration:access-log
key error_log caddy-configuration:error-log
raw sixtunnel_executable {{ parameter_dict['sixtunnel'] }}/bin/6tunnel
raw service_directory ${directory:service}
key sixtunnel_executable :sixtunnel_executable
key service_directory directory:service
key not_found_file caddy-configuration:not-found-file
[dynamic-virtualhost-template-slave]
...
...
@@ -502,9 +506,10 @@ template = {{ parameter_dict['template_caddy_lazy_script_call'] }}
rendered = ${directory:bin}/frontend-caddy-lazy-graceful
mode = 0700
pid-file = ${directory:run}/lazy-graceful.pid
wait_time = 60
extra-context =
key pid_file :pid-file
raw wait_time 60
key wait_time :wait_time
key lazy_command caddy-configuration:frontend-graceful-command
# Promises checking configuration:
...
...
software/caddy-frontend/templates/apache-custom-slave-list.cfg.in
View file @
012eba7b
...
...
@@ -193,6 +193,13 @@ cert-content = {{ dumps(slave_instance.get('ssl_crt')) }}
{# ########################################## #}
{# Set Slave Configuration #}
[{{ slave_configuration_section_name }}]
https_port = {{ dumps(https_port) }}
http_port = {{ dumps(http_port) }}
local_ipv4 = {{ dumps(local_ipv4) }}
nginx_http_port = {{ dumps(nginx_http_port) }}
nginx_https_port = {{ dumps(nginx_https_port) }}
cached_port = {{ dumps(cached_port) }}
ssl_cached_port = {{ (ssl_cached_port) }}
{# BBB: apache_custom_https and apache_custom_http #}
{% set caddy_custom_http = ((slave_instance.pop('caddy_custom_http', slave_instance.pop('apache_custom_http', ''))) % slave_parameter_dict) %}
{% set caddy_custom_https = ((slave_instance.pop('caddy_custom_https', slave_instance.pop('apache_custom_https', ''))) % slave_parameter_dict) %}
...
...
@@ -224,11 +231,6 @@ template = {{ template_default_slave_configuration }}
filename = {{ '%s.conf' % slave_reference }}
extra-context =
raw https_port {{ https_port }}
raw http_port {{ http_port }}
raw local_ipv4 {{ local_ipv4 }}
raw nginx_http_port {{ nginx_http_port }}
raw nginx_https_port {{ nginx_https_port }}
section slave_parameter {{ slave_configuration_section_name }}
{{ '\n' }}
...
...
@@ -315,9 +317,6 @@ rendered = {{ caddy_cached_configuration_directory }}/${:filename}
extensions = jinja2.ext.do
extra-context =
section slave_parameter {{ slave_configuration_section_name }}
raw cached_port {{ cached_port }}
raw ssl_cached_port {{ ssl_cached_port }}
raw local_ipv4 {{ local_ipv4 }}
{{ '\n' }}
{% endfor %}
...
...
@@ -364,6 +363,19 @@ ipv4-port = {{ nginx_https_port }}
ipv6-port = {{ nginx_https_port }}
{# Define log access #}
[caddy-log-access-parameters]
caddy_log_directory = {{ dumps(caddy_log_directory) }}
caddy_configuration_directory = {{ dumps(caddy_configuration_directory) }}
local_ipv4 = {{ dumps(local_ipv4) }}
global_ipv6 = {{ dumps(global_ipv6) }}
https_port = {{ dumps(https_port) }}
http_port = {{ dumps(http_port) }}
login_certificate = {{ dumps(login_certificate) }}
login_key = {{ dumps(login_key) }}
access_log = {{ dumps(access_log) }}
error_log = {{ dumps(error_log) }}
not_found_file = {{ dumps(not_found_file) }}
[caddy-log-access]
< = jinja2-template-base
template = {{frontend_configuration.get('template-log-access')}}
...
...
@@ -371,17 +383,7 @@ rendered = {{frontend_configuration.get('log-access-configuration')}}
extra-context =
section slave_log_directory slave-log-directory-dict
section slave_password slave-password
raw caddy_log_directory {{caddy_log_directory}}
raw caddy_configuration_directory {{caddy_configuration_directory}}
raw local_ipv4 {{ local_ipv4 }}
raw global_ipv6 {{ global_ipv6 }}
raw https_port {{ https_port }}
raw http_port {{ http_port }}
raw login_certificate {{ login_certificate }}
raw login_key {{ login_key }}
raw access_log {{ access_log }}
raw error_log {{ error_log }}
raw not_found_file {{ not_found_file }}
section parameter_dict caddy-log-access-parameters
{# Publish information for the instance #}
[publish-caddy-information]
...
...
software/caddy-frontend/templates/cached-virtualhost.conf.in
View file @
012eba7b
...
...
@@ -5,13 +5,13 @@
{%- set http_backend_host_list = [] %}
{%- set https_backend_host_list = [] %}
{%- for host in host_list %}
{%- do http_backend_host_list.append('http://%s:%s' % (host,
cached_port
)) %}
{%- do https_backend_host_list.append('http://%s:%s' % (host, s
sl_cached_port
)) %}
{%- do http_backend_host_list.append('http://%s:%s' % (host,
slave_parameter['cached_port']
)) %}
{%- do https_backend_host_list.append('http://%s:%s' % (host, s
lave_parameter['ssl_cached_port']
)) %}
{%- endfor %}
# SSL-disabled backends
{{ http_backend_host_list|join(', ') }} {
bind {{
local_ipv4
}}
bind {{
slave_parameter['local_ipv4']
}}
# Compress the output
gzip
{%- if ssl_proxy_verify and 'ssl_proxy_ca_crt' in slave_parameter %}
...
...
@@ -35,7 +35,7 @@
# SSL-enabled backends
{{ https_backend_host_list|join(', ') }} {
bind {{
local_ipv4
}}
bind {{
slave_parameter['local_ipv4']
}}
# Compress the output
gzip
{%- if ssl_proxy_verify and 'ssl_proxy_ca_crt' in slave_parameter %}
...
...
software/caddy-frontend/templates/default-virtualhost.conf.in
View file @
012eba7b
...
...
@@ -17,13 +17,13 @@
{%- set http_host_list = [] %}
{%- set https_host_list = [] %}
{%- for host in host_list %}
{%- do http_host_list.append('http://%s:%s' % (host,
http_port
)) %}
{%- do https_host_list.append('https://%s:%s' % (host,
https_port
)) %}
{%- do http_host_list.append('http://%s:%s' % (host,
slave_parameter['http_port']
)) %}
{%- do https_host_list.append('https://%s:%s' % (host,
slave_parameter['https_port']
)) %}
{%- endfor %} {#- for host in host_list #}
# SSL enabled hosts
{{ https_host_list|join(', ') }} {
bind {{
local_ipv4
}}
bind {{
slave_parameter['local_ipv4']
}}
# Compress the output
gzip
{%- if ssl_proxy_verify and 'ssl_proxy_ca_crt' in slave_parameter %}
...
...
@@ -144,7 +144,7 @@
# SSL-disabled hosts
{{ http_host_list|join(', ') }} {
bind {{
local_ipv4
}}
bind {{
slave_parameter['local_ipv4']
}}
# Compress the output
gzip
{%- if ssl_proxy_verify and 'ssl_proxy_ca_crt' in slave_parameter %}
...
...
software/caddy-frontend/templates/nginx-eventsource-slave.conf.in
View file @
012eba7b
...
...
@@ -21,7 +21,7 @@
# TODO-Caddy server {
# TODO-Caddy listen {{
local_ipv4 }}:{{ nginx_http_port
}};
# TODO-Caddy listen {{
slave_parameter['local_ipv4'] }}:{{ slave_parameter['nginx_http_port']
}};
# TODO-Caddy
# TODO-Caddy server_name {{ slave_parameter.get('custom_domain') }};
# TODO-Caddy
...
...
@@ -60,7 +60,7 @@
# TODO-Caddy
# TODO-Caddy server {
# TODO-Caddy listen {{
local_ipv4 }}:{{ nginx_https_port
}} ssl;
# TODO-Caddy listen {{
slave_parameter['local_ipv4'] }}:{{ slave_parameter['nginx_https_port']
}} ssl;
# TODO-Caddy
# TODO-Caddy server_name {{ slave_parameter.get('custom_domain') }};
# TODO-Caddy
...
...
software/caddy-frontend/templates/nginx-notebook-slave.conf.in
View file @
012eba7b
...
...
@@ -5,8 +5,8 @@
{%- set https_upstream = https_url.split("/")[2] %}
# SSL-enabled
https://{{ slave_parameter.get('custom_domain') }}:{{
nginx_https_port
}} {
bind {{
local_ipv4
}}
https://{{ slave_parameter.get('custom_domain') }}:{{
slave_parameter['nginx_https_port']
}} {
bind {{
slave_parameter['local_ipv4']
}}
# Compress the output
gzip
log / {{ slave_parameter.get('access_log') }} "{remote} {>REMOTE_USER} [{when}] \"{method} {uri} {proto}\" {status} {size} \"{>Referer}\" \"{>User-Agent}\" {latency_ms}"
...
...
@@ -37,8 +37,8 @@ https://{{ slave_parameter.get('custom_domain') }}:{{ nginx_https_port }} {
}
# SSL-disabled
http://{{ slave_parameter.get('custom_domain') }}:{{
nginx_http_port
}} {
bind {{
local_ipv4
}}
http://{{ slave_parameter.get('custom_domain') }}:{{
slave_parameter['nginx_http_port']
}} {
bind {{
slave_parameter['local_ipv4']
}}
# Compress the output
gzip
log / {{ slave_parameter.get('access_log') }} "{remote} {>REMOTE_USER} [{when}] \"{method} {uri} {proto}\" {status} {size} \"{>Referer}\" \"{>User-Agent}\" {latency_ms}"
...
...
software/caddy-frontend/templates/template-log-access.conf.in
View file @
012eba7b
{% for slave, directory in slave_log_directory.iteritems() %}
https://[{{
global_ipv6 }}]:{{ https_port }}/{{ slave }}, https://{{ local_ipv4 }}:{{ https_port
}}/{{ slave }} {
bind {{
local_ipv4
}}
root {{
directory
}}/
https://[{{
parameter_dict['global_ipv6'] }}]:{{ parameter_dict['https_port'] }}/{{ slave }}, https://{{ parameter_dict['local_ipv4'] }}:{{ parameter_dict['https_port']
}}/{{ slave }} {
bind {{
parameter_dict['local_ipv4']
}}
root {{
directory
}}/
browse
tls {{
login_certificate }} {{ login_key
}}
tls {{
parameter_dict['login_certificate'] }} {{ parameter_dict['login_key']
}}
basicauth "{{ slave }}" {{ slave_password[slave] }} {
"Log Access {{ slave }}"
/
}
log / {{
access_log
}} "{remote} {>REMOTE_USER} [{when}] \"{method} {uri} {proto}\" {status} {size} \"{>Referer}\" \"{>User-Agent}\" {latency_ms}"
errors {{
error_log
}} {
* {{
not_found_file
}}
log / {{
parameter_dict['access_log']
}} "{remote} {>REMOTE_USER} [{when}] \"{method} {uri} {proto}\" {status} {size} \"{>Referer}\" \"{>User-Agent}\" {latency_ms}"
errors {{
parameter_dict['error_log']
}} {
* {{
parameter_dict['not_found_file']
}}
}
}
{% endfor %}
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