Commit 471bcbee authored by Eteri's avatar Eteri Committed by Gabriel Monnerat

Caddy 0.1

The first proof of concept  of Caddy in Slapos. 

For now, everything is inside software/caddy but in the next merge request we will move to stack. 

@rafael @romain 


/reviewed-on !243
parents 4d4bdd8a 8121bc33
[buildout]
extends =
../../component/golang/buildout.cfg
parts +=
caddy-repository
[git-repository]
recipe = slapos.recipe.build:gitclone
git-executable = ${git:location}/bin/git
[go-git-repository]
<= git-repository
repository = https://${:go.importpath}.git
location = ${gopath:src}/${:go.importpath}
[caddy-repository]
<= go-git-repository
go.importpath = github.com/mholt/caddy
revision = c4dfbb9956095c92d0586a52723748c070c7b459
\ No newline at end of file
[$${caddy-configuration:ipv6}]:$${caddy-configuration:port}
log $${caddy-configuration:access_log}
root $${directory:public_html}
\ No newline at end of file
<h1>Welcome</h1>
\ No newline at end of file
[buildout]
parts =
caddy-service
caddy-configuration
public-html
publish-connection-information
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
[directory]
recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc
bin = $${buildout:directory}/bin
srv = $${buildout:directory}/srv
var = $${buildout:directory}/var
service = $${:etc}/service
public_html = $${buildout:directory}/public_html
run = $${:var}/run
log = $${:var}/log
#www = $${:srv}/www
#ssl = $${:etc}/ssl
#################################
# caddy service
#################################
[caddy-service]
recipe = slapos.cookbook:wrapper
command-line = ${caddy:output} -conf $${caddy-configuration:output}
wrapper-path = $${directory:service}/caddy
output = $${:wrapper-path}
[caddy-configuration]
recipe = slapos.recipe.template
url = ${template-caddyfile:output}
output = $${directory:etc}/Caddyfile
mode = 0600
access_log = $${directory:log}/caddy-access.log
error_log = $${directory:log}/caddy-error.log
ipv6 = $${slap-network-information:global-ipv6}
local_ip = $${slap-network-information:local-ipv4}
port = 9443
[public-html]
recipe = slapos.recipe.template
url = ${template-public-html:output}
output = $${directory:public_html}/index.html
mode = 0600
[publish-connection-information]
recipe = slapos.cookbook:publish
url = http://[$${caddy-configuration:ipv6}]:$${caddy-configuration:port}
\ No newline at end of file
#############################
#
# Deploy caddy instance
#
#############################
[buildout]
parts =
switch-softwaretype
# publish-connection-parameter
# Define egg directories to be the one from Software Release
# (/opt/slapgrid/...)
# Always the same.
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
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]
# Fetch arbitrary parameters defined by the user in SlapOS Master for his instance.
# We use the slapconfiguration recipe with a few parameters (partition id,
# computer id, certificate, etc).
# It will then authenticate to SlapOS Master and fetch the instance parameters.
# The parameters are accessible from {instance-parameter:configuration.name-of-parameter}
# Always the same. Just copy/paste.
# See docstring of slapos.cookbook:slapconfiguration for more information.
recipe = slapos.cookbook:slapconfiguration
computer = $${slap_connection:computer_id}
partition = $${slap_connection:partition_id}
url = $${slap_connection:server_url}
key = $${slap_connection:key_file}
cert = $${slap_connection:cert_file}
[buildout]
extends =
../../component/caddy/buildout.cfg
../../stack/slapos.cfg
parts =
golang19
slapos-cookbook
instance-profile
template-caddy
caddy
[instance-profile]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg.in
md5sum = ae83c35995ce14432ded78ca30cab61b
output =${buildout:directory}/instance.cfg
filename = instance.cfg
mode = 0644
[gopath]
directory = ${buildout:directory}/go.work
src = ${:directory}/src
bin = ${:directory}/bin
[template-caddyfile]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/Caddyfile.in
md5sum = 616f9c7cb788e1f1d7cee2093a7dc6ef
output = ${buildout:directory}/Caddyfile.in
mode = 0644
[template-caddy]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-caddy.cfg.in
md5sum = 045022e5698badca5dbdd6b95518f8e1
output = ${buildout:directory}/instance-caddy.cfg.in
mode = 0644
[template-public-html]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/index.html
md5sum = b5794ac8b10ed90173ad566e6e324b35
output = ${buildout:directory}/index.html
mode = 0644
[caddy]
recipe = slapos.recipe.cmmi
path = ${caddy-repository:location}
go = ${golang19:location}/bin/go
configure-command = cd ${:path}/caddy && ${:go} get -v
make-targets =
make-binary = cd ${:path}/caddy && ${:go} install -v
environment =
PATH=${pkgconfig:location}/bin:${golang19:location}/bin:${buildout:bin-directory}:%(PATH)s
GOPATH=${gopath:directory}
output = ${gopath:bin}/caddy
\ 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