Commit ae621a1d authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

html5as: Have a simple html5as helloworld

parent 9f52a5f7
Pipeline #13123 failed with stage
[buildout]
parts =
switch-softwaretype
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
[switch-softwaretype]
recipe = slapos.cookbook:softwaretype
default = ${instance_html5as:output}
[buildout]
parts =
switch-softwaretype
eggs-directory = {{ buildout['eggs-directory'] }}
develop-eggs-directory = {{ buildout['develop-eggs-directory'] }}
offline = true
[profile-common]
nginx_location = {{ nginx_location }}
dash_location = {{ dash_location }}
template_nginx_conf = {{ template_nginx_conf_target }}
template_mime_types = {{ template_mime_types_target }}
template_launcher = {{ template_launcher_target }}
[instance-html5as]
recipe = slapos.recipe.template:jinja2
template = {{ template_instance_html5as_target }}
rendered = ${buildout:directory}/${:filename}
filename = instance-html5as.cfg
context =
section buildout buildout
section parameter_list profile-common
[switch-softwaretype]
recipe = slapos.cookbook:softwaretype
default = ${instance-html5as:rendered}
#############################
#
# Deploy html5as instance
#
#############################
[buildout] [buildout]
parts = parts =
nginx_conf nginx_conf
downloader downloader
launcher
mime_types mime_types
launcher
publish-connection-information publish-connection-information
eggs-directory = ${buildout:eggs-directory} # Define egg directories to be the one from Software Release
develop-eggs-directory = ${buildout:develop-eggs-directory} # (/opt/slapgrid/...)
# Always the same.
eggs-directory = {{ buildout['eggs-directory'] }}
develop-eggs-directory = {{ buildout['develop-eggs-directory'] }}
offline = true offline = true
# partition tree # partition tree
...@@ -27,90 +35,97 @@ offline = true ...@@ -27,90 +35,97 @@ offline = true
# | | |- index.html # | | |- index.html
# | |- backup/ # | |- backup/
[rootdirectory] # Create all needed directories, depending on your needs
[directory]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc home = ${buildout:directory}
var = $${buildout:directory}/var etc = ${:home}/etc
srv = $${buildout:directory}/srv var = ${:home}/var
tmp = $${buildout:directory}/tmp srv = ${:home}/srv
[basedirectory] [basedirectory]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
services = $${rootdirectory:etc}/run # Executables put here will be started but not monitored (for startup scripts)
log = $${rootdirectory:var}/log script = ${directory:etc}/run
run = $${rootdirectory:var}/run # Executables put here will be started and monitored (for daemons)
backup = $${rootdirectory:srv}/backup service = ${directory:etc}/service
data = $${rootdirectory:srv}/html5as log = ${directory:var}/log
run = ${directory:var}/run
backup = ${directory:srv}/backup
data = ${directory:srv}/html5as
[tempdirectory] [tempdirectory]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
client_body_temp_path = $${rootdirectory:tmp}/client_body_temp_path tmp = ${directory:home}/tmp
proxy_temp_path = $${rootdirectory:tmp}/proxy_temp_path client_body_temp_path = ${:tmp}/client_body_temp_path
fastcgi_temp_path = $${rootdirectory:tmp}/fastcgi_temp_path proxy_temp_path = ${:tmp}/proxy_temp_path
uwsgi_temp_path = $${rootdirectory:tmp}/uwsgi_temp_path fastcgi_temp_path = ${:tmp}/fastcgi_temp_path
scgi_temp_path = $${rootdirectory:tmp}/scgi_temp_path uwsgi_temp_path = ${:tmp}/uwsgi_temp_path
scgi_temp_path = ${:tmp}/scgi_temp_path
# List of options for html5as configuration
# It will run a simple nginx serving the content of srv/html5as
[html5as] [html5as]
# Options # Options
nb_workers = 2 nb_workers = 2
# Network # Network
ip = $${slap-network-information:global-ipv6} ip = ${slap-network-information:global-ipv6}
port = 8081 port = 8081
access_url = http://[${:ip}]:${:port}
# Paths # Paths
# Log # Log
path_pid = $${basedirectory:run}/nginx.pid path_pid = ${basedirectory:run}/nginx.pid
path_log = $${basedirectory:log}/nginx.log path_log = ${basedirectory:log}/nginx.log
path_access_log = $${basedirectory:log}/nginx.access.log path_access_log = ${basedirectory:log}/nginx.access.log
path_error_log = $${basedirectory:log}/nginx.error.log path_error_log = ${basedirectory:log}/nginx.error.log
path_tmp = $${buildout:directory}/tmp path_tmp = ${tempdirectory:tmp}
# Docroot # Docroot
docroot = $${basedirectory:data} docroot = ${basedirectory:data}
default_index = $${basedirectory:data}/index.html default_index = ${basedirectory:data}/index.html
# Config files # Config files
path_nginx_conf = $${rootdirectory:etc}/nginx.conf path_nginx_conf = ${directory:etc}/nginx.conf
path_mime_types = $${rootdirectory:etc}/mime_types path_mime_types = ${directory:etc}/mime_types
# Binaries
path_shell = {{ parameter_list['dash_location'] }}/bin/dash
# Executables # Executables
bin_nginx = ${nginx:location}/sbin/nginx bin_launcher = ${basedirectory:script}/launcher
bin_launcher = $${basedirectory:services}/launcher
bin_downloader = $${basedirectory:services}/downloader
# Utils # Utils
path_shell = ${dash:location}/bin/dash path_nginx = {{ parameter_list['nginx_location'] }}/sbin/nginx
path_curl = ${curl:location}/bin/curl
path_tar = ${tar:location}/bin/tar
# Render nginx conf
[nginx_conf] [nginx_conf]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
template = ${template_nginx_conf:location}/${template_nginx_conf:filename} template = {{ parameter_list['template_nginx_conf'] }}
rendered = $${html5as:path_nginx_conf} rendered = ${html5as:path_nginx_conf}
context = context =
section param_html5as html5as section param_html5as html5as
section param_tempdir tempdirectory section param_tempdir tempdirectory
# Render necessary mime types file for nginx
[mime_types] [mime_types]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
template = ${template_mime_types:location}/${template_mime_types:filename} template = {{ parameter_list['template_mime_types'] }}
rendered = $${html5as:path_mime_types} rendered = ${html5as:path_mime_types}
[downloader]
recipe = slapos.recipe.template:jinja2
template = ${template_downloader:location}/${template_downloader:filename}
rendered = $${html5as:bin_downloader}
mode = 700
context =
section param_html5as html5as
key download_url slap-parameter:download_url
# Render the script launching nginx
[launcher] [launcher]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
template = ${template_launcher:location}/${template_launcher:filename} template = {{ parameter_list['template_launcher'] }}
rendered = $${html5as:bin_launcher} rendered = ${html5as:bin_launcher}
mode = 700 mode = 700
context = context =
section param_html5as html5as section param_html5as html5as
# Simple command to put content in the docroot
[downloader]
recipe = plone.recipe.command
command = rm -r ${html5as:docroot}/*; echo "Hello World!" > ${html5as:docroot}/index.html
# Publish nginx address
[publish-connection-information] [publish-connection-information]
recipe = slapos.cookbook:publish recipe = slapos.cookbook:publish
server_url = http://[$${html5as:ip}]:$${html5as:port} server_url = ${html5as:access_url}
[buildout] [buildout]
extends = extends =
# "slapos" stack describes basic things needed for 99.9% of SlapOS Software
# Releases
../../stack/slapos.cfg ../../stack/slapos.cfg
# Extend here component profiles, like openssl, apache, mariadb, curl...
# Or/and extend a stack (lamp, tomcat) that does most of the work for you
# In this example we extend needed components for html5as.
../../component/nginx/buildout.cfg ../../component/nginx/buildout.cfg
../../component/curl/buildout.cfg
../../component/dash/buildout.cfg ../../component/dash/buildout.cfg
../../component/tar/buildout.cfg
parts = parts =
dash # Call installation of slapos.cookbook egg defined in stack/slapos.cfg (needed
tar # in 99,9% of Slapos Software Releases)
curl
nginx
slapos-cookbook slapos-cookbook
template # Call creation of instance.cfg file that will be called for deployment of
template_nginx_conf # instance
template_downloader template-cfg
template_launcher
template_mime_types
instance_html5as
# Download instance.cfg.in (buildout profile used to deployment of instance),
[template] # replace all {{ foo_bar }} parameters by real values
recipe = slapos.recipe.template # The recipe, template and mode are fetched from jijna-template
url = ${:_profile_base_location_}/instance.cfg [template-cfg]
output = ${buildout:directory}/template.cfg recipe = slapos.recipe.template:jinja2
md5sum = 918e0d6513e4d1c92051431d83261dab rendered = ${buildout:directory}/template.cfg
template = ${:_profile_base_location_}/${:filename}
filename = instance.cfg.in
md5sum = 5a6ebc126bcad3cdff1b51fb51f82a35
mode = 0644 mode = 0644
context =
section buildout buildout
key nginx_location nginx:location
key dash_location dash:location
key template_nginx_conf_target template_nginx_conf:target
key template_mime_types_target template_mime_types:target
key template_launcher_target template_launcher:target
key template_instance_html5as_target instance_html5as:target
# Download instance_html5as.cfg.in
[instance_html5as] [instance_html5as]
recipe = slapos.recipe.template recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/instance_html5as.cfg url = ${:_profile_base_location_}/${:_update_hash_filename_}
output = ${buildout:directory}/template_html5as.cfg _update_hash_filename_ = instance_html5as.cfg.in
md5sum = 41cb6178f760238ca276854873ef9364 md5sum = 4a8c98cc5ca141f78f14fb9cec203cb8
mode = 0644 mode = 0644
[template_nginx_conf] [template_nginx_conf]
recipe = slapos.recipe.build:download recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/templates/nginx_conf.in url = ${:_profile_base_location_}/${:_update_hash_filename_}
_update_hash_filename_ = templates/nginx_conf.in
md5sum = 61dc4c82bf48563228ce4dea6c5c6319 md5sum = 61dc4c82bf48563228ce4dea6c5c6319
filename = nginx_conf.in
mode = 0644 mode = 0644
location = ${buildout:parts-directory}/${:_buildout_section_name_}
[template_launcher] [template_launcher]
recipe = slapos.recipe.build:download recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/templates/launcher.in url = ${:_profile_base_location_}/${:_update_hash_filename_}
md5sum = acf5bb55ceac2e826259d28ed5c1de3a _update_hash_filename_ = templates/launcher.in
filename = launcher.in md5sum = 8d4d3152f5125f73d0c3f3ea1c3699dd
mode = 0644
location = ${buildout:parts-directory}/${:_buildout_section_name_}
[template_downloader]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/templates/downloader.in
md5sum = 9779e2db6c73d282f802b3407b390ede
filename = downloader.in
mode = 0644 mode = 0644
location = ${buildout:parts-directory}/${:_buildout_section_name_}
[template_mime_types] [template_mime_types]
recipe = slapos.recipe.build:download recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/templates/mime_types.in url = ${:_profile_base_location_}/${:_update_hash_filename_}
_update_hash_filename_ = templates/mime_types.in
md5sum = 4ef94a7b458d885cd79ba0b930a5727e md5sum = 4ef94a7b458d885cd79ba0b930a5727e
filename = mime_types.in
mode = 0644 mode = 0644
location = ${buildout:parts-directory}/${:_buildout_section_name_}
# Pin versions of eggs used that are not already pinned by stack/slapos.cfg
[versions] [versions]
async = 0.6.1 slapos.recipe.template = 4.4
gitdb = 0.5.4
pycrypto = 2.6
rdiff-backup = 1.0.5+SlapOSPatched001
smmap = 0.8.2
plone.recipe.command = 1.1
#! {{ param_html5as['path_shell'] }}
# BEWARE: This file is operated by slapgrid
# BEWARE: It will be overwritten automatically
# Remove exsistant website
rm -r {{ param_html5as['docroot'] }}/*
# Download and extract website tarball into docroot directory
exec {{ param_html5as['path_curl'] }} -ks {{ download_url }} | {{ param_html5as['path_tar'] }} -z -x -C {{ param_html5as['docroot'] }}
...@@ -3,4 +3,4 @@ ...@@ -3,4 +3,4 @@
# BEWARE: It will be overwritten automatically # BEWARE: It will be overwritten automatically
# Run nginx # Run nginx
exec {{ param_html5as['bin_nginx'] }} -c {{ param_html5as['path_nginx_conf'] }} exec {{ param_html5as['path_nginx'] }} -c {{ param_html5as['path_nginx_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