Commit 05a90458 authored by eteri's avatar eteri

caddy: improve configuration

parent e25c9fe2
$${caddy-configuration:ip}:$${caddy-configuration:port} [$${caddy-configuration:ip}]:$${caddy-configuration:port}
\ No newline at end of file
log $${caddy-configuration:access_log}
root $${directory:public-html}
\ No newline at end of file
...@@ -15,6 +15,7 @@ etc = $${buildout:directory}/etc ...@@ -15,6 +15,7 @@ etc = $${buildout:directory}/etc
bin = $${buildout:directory}/bin bin = $${buildout:directory}/bin
srv = $${buildout:directory}/srv srv = $${buildout:directory}/srv
var = $${buildout:directory}/var var = $${buildout:directory}/var
public-html = $${buildout:directory}/public-html
run = $${:var}/run run = $${:var}/run
log = $${:var}/log log = $${:var}/log
#www = $${:srv}/www #www = $${:srv}/www
...@@ -26,7 +27,7 @@ log = $${:var}/log ...@@ -26,7 +27,7 @@ log = $${:var}/log
[caddy-service] [caddy-service]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${template-caddy-service:output} url = ${template-caddy-service:output}
output = $${directory:services}/caddy output = $${directory:srv}/caddy
mode = 0700 mode = 0700
virtual-depends = virtual-depends =
$${caddy-configuration:ip} $${caddy-configuration:ip}
......
...@@ -5,44 +5,47 @@ ...@@ -5,44 +5,47 @@
############################# #############################
[buildout] [buildout]
parts = parts =
directory switch-softwaretype
# publish-connection-parameter # publish-connection-parameter
# Define egg directories to be the one from Software Release # Define egg directories to be the one from Software Release
# (/opt/slapgrid/...) # (/opt/slapgrid/...)
# Always the same. # Always the same.
eggs-directory = {{ buildout['eggs-directory'] }} eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = {{ buildout['develop-eggs-directory'] }} develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true offline = true
[switch-softwaretype]
recipe = slapos.cookbook:softwaretype
default = $${:caddy}
caddy = $${dynamic-template-caddy:rendered}
[dynamic-template-caddy]
recipe = slapos.recipe.template:jinja2
template = ${template-caddy:output}
rendered = $${buildout:parts-directory}/${:_buildout_section_name_}/${:filename}
filename = instance-caddy.cfg
[slap-connection]
computer-id = {slap_connection:computer_id}
partition-id = $${slap_connection:partition_id}
server-url = $${slap_connection:server_url}
software-release-url = $${slap_connection:software_release_url}
key-file = $${slap_connection:key_file}
cert-file = $${slap_connection:cert_file}
[instance-parameter] [instance-parameter]
# Fetch arbitrary parameters defined by the user in SlapOS Master for his instance. # Fetch arbitrary parameters defined by the user in SlapOS Master for his instance.
# We use the slapconfiguration recipe with a few parameters (partition id, # We use the slapconfiguration recipe with a few parameters (partition id,
# computer id, certificate, etc). # computer id, certificate, etc).
# It will then authenticate to SlapOS Master and fetch the instance parameters. # It will then authenticate to SlapOS Master and fetch the instance parameters.
# The parameters are accessible from ${instance-parameter:configuration.name-of-parameter} # The parameters are accessible from {instance-parameter:configuration.name-of-parameter}
# Always the same. Just copy/paste. # Always the same. Just copy/paste.
# See docstring of slapos.cookbook:slapconfiguration for more information. # See docstring of slapos.cookbook:slapconfiguration for more information.
recipe = slapos.cookbook:slapconfiguration recipe = slapos.cookbook:slapconfiguration
computer = ${slap_connection:computer_id} computer = $${slap_connection:computer_id}
partition = ${slap_connection:partition_id} partition = $${slap_connection:partition_id}
url = ${slap_connection:server_url} url = $${slap_connection:server_url}
key = ${slap_connection:key_file} key = $${slap_connection:key_file}
cert = ${slap_connection:cert_file} cert = $${slap_connection:cert_file}
# Create all needed directories, depending on your needs
[directory]
recipe = slapos.cookbook:mkdirectory
home = ${buildout:directory}
etc = ${:home}/etc
var = ${:home}/var
# Executables put here will be started but not monitored (for startup scripts)
script = ${:etc}/run/
# Executables put here will be started and monitored (for daemons)
service = ${:etc}/service
# Executables put here will be launched after buildout has completed to see
# if instance is running
promise = ${:etc}/promise/
# Path of the log directory used by our service (see [helloweb])
log = ${:var}/log
\ No newline at end of file
...@@ -13,15 +13,12 @@ parts = ...@@ -13,15 +13,12 @@ parts =
caddy caddy
[instance-profile] [instance-profile]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template
template = ${:_profile_base_location_}/instance.cfg.in url = ${:_profile_base_location_}/instance.cfg.in
rendered = ${buildout:directory}/instance.cfg md5sum = ae83c35995ce14432ded78ca30cab61b
# MD5 checksum can be skipped for development (easier to develop), but must be filled for production output =${buildout:directory}/instance.cfg
md5sum = ec3f3d81153f7b198ccf30c5a5bf532a filename = instance.cfg
mode = 0644 mode = 0644
extensions = jinja2.ext.do
context =
section buildout buildout
[gopath] [gopath]
directory = ${buildout:directory}/go.work directory = ${buildout:directory}/go.work
...@@ -35,19 +32,20 @@ md5sum = 61da5aea191595962ab020b4197b5390 ...@@ -35,19 +32,20 @@ md5sum = 61da5aea191595962ab020b4197b5390
output = ${buildout:directory}/template-caddy-service.sh.in output = ${buildout:directory}/template-caddy-service.sh.in
mode = 0644 mode = 0644
[template-Caddyfile]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/Caddyfile.in
md5sum = c3ad1c9ea830dab84fa18bd58b5dc2ed
output = ${buildout:directory}/Caddyfile.in
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 = 06ae4dccd5c8557ddb51be8adbb1d6c0 md5sum = 3c9c4ef2963a57e5a68188f00a5938b9
output = ${buildout:directory}/instance-caddy.cfg.in output = ${buildout:directory}/instance-caddy.cfg.in
mode = 0644 mode = 0644
[template-Caddyfile]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/Caddyfile.in
md5sum = 0bc8e72f2748e22446f850f157321a8c
output = ${buildout:directory}/Caddyfile.in
mode = 0644
[caddy] [caddy]
recipe = slapos.recipe.cmmi recipe = slapos.recipe.cmmi
......
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