Commit c90fc288 authored by Łukasz Nowak's avatar Łukasz Nowak

Merge remote-tracking branch 'origin/html5as'

Thomas Lechauve work on simple HTML5 "Application Server" deployment.
parents 8e49e678 f2177e29
[buildout]
extends =
../pcre/buildout.cfg
../zlib/buildout.cfg
../openssl/buildout.cfg
parts = nginx
[nginx]
recipe = hexagonit.recipe.cmmi
url = http://nginx.org/download/nginx-1.0.14.tar.gz
configure-options=
--with-ipv6
--with-http_ssl_module
--with-ld-opt="-L ${openssl:location}/lib -L ${pcre:location}/lib -Wl,-rpath=${pcre:location}/lib -Wl,-rpath=${zlib:location}/lib"
--with-cc-opt="-I ${pcre:location}/include -I ${openssl:location}/include"
......@@ -2,7 +2,19 @@
parts = tar
[tar-drop.gets.patch]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/${:filename}
md5sum = 9352820566aa3534a04bd269c9f89f48
download-only = true
filename = drop.gets.patch
[tar]
virtual-depends = ${tar-drop.gets.patch:md5sum}
patch-options = -p1
patches =
${tar-drop.gets.patch:location}/${tar-drop.gets.patch:filename}
recipe = hexagonit.recipe.cmmi
url = http://ftp.gnu.org/gnu/tar/tar-1.26.tar.gz
md5sum = 00d1e769c6af702c542cca54b728920d
......
diff -ur tar-1.26.orig/gnu/stdio.in.h tar-1.26/gnu/stdio.in.h
--- tar-1.26.orig/gnu/stdio.in.h 2011-03-12 10:14:33.000000000 +0100
+++ tar-1.26/gnu/stdio.in.h 2012-08-24 15:35:22.299190847 +0200
@@ -164,7 +164,10 @@
so any use of gets warrants an unconditional warning. Assume it is
always declared, since it is required by C89. */
#undef gets
+#if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+#endif
+
#if @GNULIB_FOPEN@
# if @REPLACE_FOPEN@
##############################################################################
#
# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import os
from slapos.recipe.librecipe import GenericBaseRecipe
class Recipe(GenericBaseRecipe):
def install(self):
mapping = self.options.copy()
for key in ('output', 'template', 'recipe', 'mode'):
if key in mapping:
del mapping[key]
with open(self.options['output'], 'w') as output, \
open(self.options['template'], 'r') as template:
output.write(template.read() % mapping)
if 'mode' in self.options:
os.chmod(self.options['output'], int(self.options['mode'], 8))
return [self.options['output'], ]
# Html5 Application Server #
## Presentation ##
* Fast hosting software for static website (html5)
* Use Nginx server
## Parameter ##
download_url (string) :required
Details :
* Only tarball (tar) is supported
* Compressed format is gunzip (optional)
* Tarball must contain an index.html at its root
## How it works ##
Each time you (re)start your instance or update parameters, html5as will remove previous website then download tarball and extract it in docroot directory.
[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 =
nginx_conf
downloader
launcher
mime_types
publish-connection-information
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
# partition tree
# /
# |- etc/
# | |- nginx.conf
# | |- run/
# | |- html5as (binary)
# |- var/
# | |- run/
# | | |- nginx.pid
# | |- log/
# | | |- nginx.log
# | | |- nginx.access.log
# |- srv/
# | |- html5as/ (doc root)
# | | |- index.html
# | |- backup/
[rootdirectory]
recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc
var = $${buildout:directory}/var
srv = $${buildout:directory}/srv
tmp = $${buildout:directory}/tmp
[basedirectory]
recipe = slapos.cookbook:mkdirectory
services = $${rootdirectory:etc}/run
log = $${rootdirectory:var}/log
run = $${rootdirectory:var}/run
backup = $${rootdirectory:srv}/backup
data = $${rootdirectory:srv}/html5as
[tempdirectory]
recipe = slapos.cookbook:mkdirectory
client_body_temp_path = $${rootdirectory:tmp}/client_body_temp_path
proxy_temp_path = $${rootdirectory:tmp}/proxy_temp_path
fastcgi_temp_path = $${rootdirectory:tmp}/fastcgi_temp_path
uwsgi_temp_path = $${rootdirectory:tmp}/uwsgi_temp_path
scgi_temp_path = $${rootdirectory:tmp}/scgi_temp_path
[html5as]
# Options
nb_workers = 2
# Network
ip = $${slap-network-information:global-ipv6}
port = 8080
# Paths
# Log
path_pid = $${basedirectory:run}/nginx.pid
path_log = $${basedirectory:log}/nginx.log
path_access_log = $${basedirectory:log}/nginx.access.log
path_error_log = $${basedirectory:log}/nginx.error.log
path_tmp = $${buildout:directory}/tmp
# Docroot
docroot = $${basedirectory:data}
default_index = $${basedirectory:data}/index.html
# Config files
path_nginx_conf = $${rootdirectory:etc}/nginx.conf
path_mime_types = $${rootdirectory:etc}/mime_types
# Executables
bin_nginx = ${nginx:location}/sbin/nginx
bin_launcher = $${basedirectory:services}/launcher
bin_downloader = $${basedirectory:services}/downloader
# Utils
path_shell = ${dash:location}/bin/dash
path_curl = ${curl:location}/bin/curl
path_tar = ${tar:location}/bin/tar
[nginx_conf]
recipe = slapos.recipe.template:jinja2
template = ${template_nginx_conf:location}/${template_nginx_conf:filename}
rendered = $${html5as:path_nginx_conf}
context =
section param_html5as html5as
section param_tempdir tempdirectory
[mime_types]
recipe = slapos.recipe.template:jinja2
template = ${template_mime_types:location}/${template_mime_types:filename}
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
[launcher]
recipe = slapos.recipe.template:jinja2
template = ${template_launcher:location}/${template_launcher:filename}
rendered = $${html5as:bin_launcher}
mode = 700
context =
section param_html5as html5as
[publish-connection-information]
recipe = slapos.cookbook:publish
server_url = http://[$${html5as:ip}]:$${html5as:port}
[buildout]
versions = versions
extensions = buildout-versions
extends =
../../stack/slapos.cfg
../../component/nginx/buildout.cfg
../../component/curl/buildout.cfg
../../component/dash/buildout.cfg
../../component/tar/buildout.cfg
allow-hosts =
*.nexedi.org
*.python.org
*.sourceforge.net
www.slapos.org
launchpad.net
github.com
alastairs-place.net
www.alittletooquiet.net
parts =
dash
tar
curl
nginx
eggs
template
template_nginx_conf
template_downloader
template_launcher
template_mime_types
instance_html5as
[eggs]
recipe = z3c.recipe.scripts
eggs = slapos.cookbook
[template]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
output = ${buildout:directory}/template.cfg
md5sum = 918e0d6513e4d1c92051431d83261dab
mode = 0644
[instance_html5as]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance_html5as.cfg
output = ${buildout:directory}/template_html5as.cfg
md5sum = 579eceb768e8d25fb53338fc4fac6944
mode = 0644
[template_nginx_conf]
recipe = slapos.recipe.download
url = ${:_profile_base_location_}/templates/nginx_conf.in
md5sum = 0ae1fb1c777c332d76f680c681a4f48a
filename = nginx_conf.in
mode = 0644
location = ${buildout:parts-directory}/${:_buildout_section_name_}
[template_launcher]
recipe = slapos.recipe.download
url = ${:_profile_base_location_}/templates/launcher.in
md5sum = acf5bb55ceac2e826259d28ed5c1de3a
filename = launcher.in
mode = 0644
location = ${buildout:parts-directory}/${:_buildout_section_name_}
[template_downloader]
recipe = slapos.recipe.download
url = ${:_profile_base_location_}/templates/downloader.in
md5sum = 7b374a03f4086fcae47491d449da1f09
filename = downloader.in
mode = 0644
location = ${buildout:parts-directory}/${:_buildout_section_name_}
[template_mime_types]
recipe = slapos.recipe.download
url = ${:_profile_base_location_}/templates/mime_types.in
md5sum = 4ef94a7b458d885cd79ba0b930a5727e
filename = mime_types.in
mode = 0644
location = ${buildout:parts-directory}/${:_buildout_section_name_}
[versions]
zc.buildout = 1.6.0-dev-SlapOS-006
Jinja2 = 2.6
Pygments = 1.5
Werkzeug = 0.8.3
buildout-versions = 1.7
docutils = 0.9.1
hexagonit.recipe.cmmi = 1.6
ipython = 0.13
meld3 = 0.6.8
slapos.cookbook = 0.61
slapos.recipe.template = 2.4.2
slapos.recipe.download = 1.0.dev-r4053
z3c.recipe.scripts = 1.0.1
# Required by:
# slapos.core==0.28.2
Flask = 0.9
# Required by:
# slapos.cookbook==0.61
PyXML = 0.8.4
# Required by:
# netaddr==0.7.7
Sphinx = 1.1.3
# Required by:
# slapos.cookbook==0.61
inotifyx = 0.2.0
# Required by:
# slapos.cookbook==0.61
# slapos.core==0.28.2
# xml-marshaller==0.9.7
lxml = 2.3.5
# Required by:
# slapos.cookbook==0.61
netaddr = 0.7.7
# Required by:
# slapos.core==0.28.2
netifaces = 0.8
# Required by:
# slapos.cookbook==0.61
# slapos.core==0.28.2
# zc.buildout==1.6.0-dev-SlapOS-006
# zc.recipe.egg==1.3.2
setuptools = 0.6c12dev-r88846
# Required by:
# slapos.cookbook==0.61
slapos.core = 0.28.2
# Required by:
# slapos.core==0.28.2
supervisor = 3.0a12
# Required by:
# slapos.cookbook==0.61
xml-marshaller = 0.9.7
# Required by:
# slapos.cookbook==0.61
zc.recipe.egg = 1.3.2
# Required by:
# slapos.core==0.28.2
zope.interface = 4.0.1
# Required by:
# hexagonit.recipe.cmmi==1.6
hexagonit.recipe.download = 1.5.1
[networkcache]
# signature certificates of the following uploaders.
# Łukasz Nowak
signature-certificate-list =
-----BEGIN CERTIFICATE-----
MIIB9jCCAV+gAwIBAgIJANLesB1hoQIEMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV
BAMMCENPTVAtMTMyMCAXDTEyMDgyODE0MjEyOFoYDzIxMTIwODA0MTQyMTI4WjAT
MREwDwYDVQQDDAhDT01QLTEzMjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA
9ED8i6211znu1Z0milwuNZCLlmQlFP590neGjvSRla7wzIBwWreNAX2Hl05sd1og
PFZBSeWsStFHQRqjNYOx1WoS4olRGIAwiwLh3Hgmkc8oOe7/q3W22xOZTUXOIiq1
FV96jUHe9RmZ910VqLPCMK44aCTmabSCWwk4OfRzI3kCAwEAAaNQME4wHQYDVR0O
BBYEFBgvpmTAS/O9vfvSLnwKy/eJC/NAMB8GA1UdIwQYMBaAFBgvpmTAS/O9vfvS
LnwKy/eJC/NAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAM3qIP3sY
DtqzUJJ7WEbD0dcniHGEycOk/3EKB663jULar+KOuTIFmMGOy5MVWcDsCqjODWXK
9LnVeCSkC4Ct8kvkT/WdRFF/nqprbZ6bUrhx2yAKTH6CMhIjDJ8F7fAkH48fLD7M
HPuwnRO7OewFpzT/gfQgFKpmVBNUYq7YddE=
-----END CERTIFICATE-----
#! {{ 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'] }} -s {{ download_url }} | {{ param_html5as['path_tar'] }} -z -x -C {{ param_html5as['docroot'] }}
#! {{ param_html5as['path_shell'] }}
# BEWARE: This file is operated by slapgrid
# BEWARE: It will be overwritten automatically
# Run nginx
exec {{ param_html5as['bin_nginx'] }} -c {{ param_html5as['path_nginx_conf'] }}
types {
text/html html htm shtml;
text/css css;
text/xml xml rss;
image/gif gif;
image/jpeg jpeg jpg;
application/x-javascript js;
application/atom+xml atom;
text/mathml mml;
text/plain txt;
text/vnd.sun.j2me.app-descriptor jad;
text/vnd.wap.wml wml;
text/x-component htc;
image/png png;
image/tiff tif tiff;
image/vnd.wap.wbmp wbmp;
image/x-icon ico;
image/x-jng jng;
image/x-ms-bmp bmp;
image/svg+xml svg svgz;
application/java-archive jar war ear;
application/mac-binhex40 hqx;
application/msword doc;
application/pdf pdf;
application/postscript ps eps ai;
application/rtf rtf;
application/vnd.ms-excel xls;
application/vnd.ms-powerpoint ppt;
application/vnd.wap.wmlc wmlc;
application/vnd.google-earth.kml+xml kml;
application/vnd.google-earth.kmz kmz;
application/x-7z-compressed 7z;
application/x-cocoa cco;
application/x-java-archive-diff jardiff;
application/x-java-jnlp-file jnlp;
application/x-makeself run;
application/x-perl pl pm;
application/x-pilot prc pdb;
application/x-rar-compressed rar;
application/x-redhat-package-manager rpm;
application/x-sea sea;
application/x-shockwave-flash swf;
application/x-stuffit sit;
application/x-tcl tcl tk;
application/x-x509-ca-cert der pem crt;
application/x-xpinstall xpi;
application/xhtml+xml xhtml;
application/zip zip;
application/octet-stream bin exe dll;
application/octet-stream deb;
application/octet-stream dmg;
application/octet-stream eot;
application/octet-stream iso img;
application/octet-stream msi msp msm;
application/ogg ogx;
audio/midi mid midi kar;
audio/mpeg mpga mpega mp2 mp3 m4a;
audio/ogg oga ogg spx;
audio/x-realaudio ra;
audio/webm weba;
video/3gpp 3gpp 3gp;
video/mp4 mp4;
video/mpeg mpeg mpg mpe;
video/ogg ogv;
video/quicktime mov;
video/webm webm;
video/x-flv flv;
video/x-mng mng;
video/x-ms-asf asx asf;
video/x-ms-wmv wmv;
video/x-msvideo avi;
}
worker_processes {{ param_html5as['nb_workers'] }};
pid {{ param_html5as['path_pid'] }};
error_log {{ param_html5as['path_error_log'] }};
daemon off;
events {
worker_connections 1024;
accept_mutex off;
}
http {
include {{ param_html5as['path_mime_types'] }};
default_type application/octet-stream;
access_log {{ param_html5as['path_access_log'] }} combined;
index index.html;
server {
listen [{{ param_html5as['ip'] }}]:{{ param_html5as['port'] }};
server_name _;
keepalive_timeout 5;
client_body_temp_path {{ param_tempdir['client_body_temp_path'] }};
proxy_temp_path {{ param_tempdir['proxy_temp_path'] }};
fastcgi_temp_path {{ param_tempdir['fastcgi_temp_path'] }};
uwsgi_temp_path {{ param_tempdir['uwsgi_temp_path'] }};
scgi_temp_path {{ param_tempdir['scgi_temp_path'] }};
# path for static files
root {{ param_html5as['docroot'] }};
}
}
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