Commit e712c04f authored by Marco Mariani's avatar Marco Mariani

made lapp stack independent from maarch; comments

parent 3d0141f7
......@@ -34,14 +34,16 @@ import os
import lxml
# TODO: remove the hack below, used to reach psycopg2
# XXX: When run inside webrunner, Postgres refuses connection.
# TODO: make the recipe work inside webrunner
# XXX What follows is a crud hack to import psycopg2.
# It basically relies on the fact that lxml (required by slapos.core) is installed
# alongside with psycopg2.
# This should be rewritten (how?) and DOES NOT WORK WHEN DEVELOPING slapos.core.
def temporary_hack():
# XXX TODO provide psycopg to sys.path by other means
import sys
develop_eggs = '/'.join(lxml.__file__.split('/')[:lxml.__file__.split('/').index('develop-eggs')+1])
for egg_folder in os.listdir(develop_eggs):
......
......@@ -12,27 +12,57 @@ parts =
template-apache-php
#----------------
#--
#-- Main application part
#-- XXX provide a better URL
[application]
url = http://downloads.sourceforge.net/project/maarch/Maarch%20Entreprise/MaarchEntreprise-1.3.zip?r=http%3A%2F%2Fwww.maarch.org%2Ftelecharger&ts=1347961624&use_mirror=ignum
md5sum = 5c2c859dee9d0dde3ba959474fd5fc86
#----------------
#--
#-- We don't need this static configuration file.
#-- An empty file is provided because it is required by the lapp stack.
#--
[application-template]
# XXX we don't need this
recipe = slapos.recipe.download
url = ${:_profile_base_location_}/config.php.in
#md5sum =
md5sum = d41d8cd98f00b204e9800998ecf8427e
download-only = True
filename = template.in
mode = 0644
location = ${buildout:parts-directory}/${:_buildout_section_name_}
[application-configuration]
# XXX we don't need this
location = config.php
#----------------
#--
#-- Define parts that will be executed later, in the instance.
#--
[custom-application-deployment]
path = ${custom-application-deployment-template:output}
part-list = maarch-configuration
[custom-application-deployment-template]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-custom.cfg.in
output = ${buildout:directory}/instance-custom.cfg
md5sum = f132fcb57297ad9b10c07f97023b5ff4
mode = 0644
#----------------
#--
#-- Install PHP channels and modules (only if they are not already installed).
#--
[pear-modules]
recipe = cp.recipe.cmd
pear = ${apache-php-postgres:location}/bin/pear
......@@ -41,3 +71,6 @@ install_cmd =
${:pear} info maarch/CLITools-0.3.1 >/dev/null || ${:pear} install maarch/CLITools-0.3.1
${:pear} info MIME_Type >/dev/null || ${:pear} install MIME_Type
#----------------
[buildout]
extends = ${custom-application-deployment:path}
parts =
certificate-authority
......@@ -14,14 +15,17 @@ parts =
frontend-promise
content-promise
publish-connection-informations
maarch-instance
${custom-application-deployment:part-list}
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
# Creation of all needed directories
#----------------
#--
#-- Creation of all needed directories.
[rootdirectory]
recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc/
......@@ -60,7 +64,10 @@ newcerts = $${directory:ca-dir}/newcerts/
crl = $${directory:ca-dir}/crl/
# Deploy stunnel
#----------------
#--
#-- Deploy stunnel.
[stunnel]
recipe = slapos.cookbook:stunnel
client = true
......@@ -78,7 +85,10 @@ wrapper = $${rootdirectory:bin}/raw_stunnel
post-rotate-script = $${rootdirectory:bin}/stunnel_post_rotate
# Certificate stuffs
#----------------
#--
#-- Certificate stuff.
[certificate-authority]
recipe = slapos.cookbook:certificate_authority
openssl-binary = ${openssl:location}/bin/openssl
......@@ -99,7 +109,10 @@ key-file = $${stunnel:key-file}
cert-file = $${stunnel:cert-file}
# Request Postgres instance and parse its URL
#----------------
#--
#-- Request Postgres instance and parse its URL.
[request-postgres]
<= slap-connection
recipe = slapos.cookbook:request
......@@ -115,7 +128,11 @@ recipe = slapos.cookbook:urlparse
url = $${request-postgres:connection-url}
# Deploy Apache + PHP application
#----------------
#--
#-- Deploy Apache + PHP application.
#-- Despite the names of mysql-* parameters, they are not really specific to mysql.
[apache-php]
recipe = slapos.cookbook:apachephp
source = ${application:location}
......@@ -144,7 +161,10 @@ mysql-host = $${stunnel:local-host}
mysql-port = $${stunnel:local-port}
# Deploy logrotate, cron, configure it
#----------------
#--
#-- Deploy logrotate, cron, configure it.
[logrotate]
recipe = slapos.cookbook:logrotate
# Binaries
......@@ -202,7 +222,10 @@ frequency = 0 0 * * *
command = $${logrotate:wrapper}
# Request frontend
#----------------
#--
#-- Request frontend.
[request-frontend]
<= slap-connection
recipe = slapos.cookbook:requestoptional
......@@ -216,7 +239,10 @@ return = site_url
config-custom_domain = $${slap-parameter:domain}
# Deploy slapmonitor
#----------------
#--
#-- Deploy slapmonitor.
[slapmonitor]
recipe = slapos.cookbook:slapmonitor
pid-file = $${basedirectory:run}/apache.pid
......@@ -239,14 +265,20 @@ slapreport-path = ${buildout:bin-directory}/slapreport
path = $${basedirectory:services}/slapreport
# Publish all instance parameters (url of instance)
#----------------
#--
#-- Publish all instance parameters (url of instance).
[publish-connection-informations]
recipe = slapos.cookbook:publish
backend_url = $${apache-php:url}
url = $${request-frontend:connection-site_url}
# Deploy promises scripts
#----------------
#--
#-- Deploy promises scripts.
[promise]
recipe = slapos.cookbook:check_port_listening
path = $${basedirectory:promises}/apache
......@@ -267,6 +299,9 @@ url = $${request-frontend:connection-site_url}
dash_path = ${dash:location}/bin/dash
curl_path = ${curl:location}/bin/curl
[slap-parameter]
# Default value if no domain is specified
domain =
......@@ -276,15 +311,3 @@ logbox-port =
logbox-user =
logbox-passwd =
[maarch-instance]
recipe = slapos.cookbook:maarch.configuration
htdocs = $${apache-php:htdocs}
db_host = $${postgres-urlparse:host}
db_port = $${postgres-urlparse:port}
db_dbname = $${postgres-urlparse:path}
db_username = $${postgres-urlparse:username}
db_password = $${postgres-urlparse:password}
language = en
php_ini_dir = $${directory:php-ini-dir}
root_docservers = $${buildout:directory}/srv/docservers
......@@ -7,7 +7,6 @@ parts =
template-apache-php
template-postgres
extends =
../../component/apache/buildout.cfg
../../component/apache-php/buildout.cfg
......@@ -21,12 +20,6 @@ extends =
../slapos.cfg
[application]
recipe = hexagonit.recipe.download
strip-top-level-dir = true
[eggs]
recipe = zc.recipe.egg
eggs =
......@@ -36,31 +29,42 @@ eggs =
cns.recipe.symlink
#----------------
#-- Application-specific part (maarch, etc.)
[application]
recipe = hexagonit.recipe.download
strip-top-level-dir = true
#----------------
#-- Instance-level buildout profiles.
[template]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
output = ${buildout:directory}/template.cfg
#md5sum =
md5sum = fad4fe349039b9bac5f95322af1b8f5a
mode = 0644
[template-apache-php]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/apache/instance-apache-php.cfg.in
output = ${buildout:directory}/template-apache-php.cfg
#md5sum =
md5sum = 6519eb4bb8a7e7b554fe482cc4c01c5b
mode = 0644
[template-postgres]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/postgres/instance-postgres.cfg.in
output = ${buildout:directory}/template-postgres.cfg
#md5sum =
md5sum = ef659916da2ed5e5d886e07fac3c8ef4
mode = 0644
# Dummy parts in case no application configuration file is needed
#----------------
#-- Dummy parts in case no application configuration file is needed
[application-template]
filename =
location =
......@@ -68,6 +72,10 @@ location =
[application-configuration]
location =
#----------------
#-- Postgres driver for Python recipes.
[psycopg2-env]
PATH = ${postgresql:location}/bin:%(PATH)s
......@@ -85,3 +93,18 @@ rpath =
${postgresql:location}/lib
#----------------
#--
#-- Optional part allowing applications using this stack to run a custom
#-- instance.cfg at the end of Apache/PHP instance deployment.
#-- To use it in your application, just override those two parameters, like:
[custom-application-deployment]
# path = /path/to/instance-custom.cfg
# part-list = part1 part2
# See software/maarch/software.cfg for an example.
path =
part-list =
#----------------
......@@ -13,8 +13,11 @@ develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
#----------------
#--
#-- Fetches parameters defined in SlapOS Master for this instance
[instance-parameters]
# Fetches parameters defined in SlapOS Master for this instance
recipe = slapos.cookbook:slapconfiguration
computer = $${slap-connection:computer-id}
partition = $${slap-connection:partition-id}
......@@ -23,21 +26,9 @@ key = $${slap-connection:key-file}
cert = $${slap-connection:cert-file}
[cron]
recipe = slapos.cookbook:cron
dcrond-binary = ${dcron:location}/sbin/crond
cron-entries = $${directory:cron-entries}
crontabs = $${directory:crontabs}
cronstamps = $${directory:cronstamps}
catcher = $${cron-simplelogger:wrapper}
binary = $${basedirectory:services}/crond
[cron-simplelogger]
recipe = slapos.cookbook:simplelogger
wrapper = $${rootdirectory:bin}/cron_simplelogger
log = $${basedirectory:log}/crond.log
#----------------
#--
#-- Creation of all needed directories.
[rootdirectory]
recipe = slapos.cookbook:mkdirectory
......@@ -60,14 +51,30 @@ crontabs = $${rootdirectory:etc}/crontabs/
cronstamps = $${rootdirectory:etc}/cronstamps/
[symlinks]
recipe = cns.recipe.symlink
symlink_target = $${rootdirectory:bin}
symlink_base = ${postgresql:location}/bin
#----------------
#--
#-- Cron
[cron]
recipe = slapos.cookbook:cron
dcrond-binary = ${dcron:location}/sbin/crond
cron-entries = $${directory:cron-entries}
crontabs = $${directory:crontabs}
cronstamps = $${directory:cronstamps}
catcher = $${cron-simplelogger:wrapper}
binary = $${basedirectory:services}/crond
[cron-simplelogger]
recipe = slapos.cookbook:simplelogger
wrapper = $${rootdirectory:bin}/cron_simplelogger
log = $${basedirectory:log}/crond.log
#----------------
#--
#-- Creates a Postgres cluster, configuration files, and a database.
[postgres-instance]
# create cluster, configuration files and a database
recipe = slapos.cookbook:postgres
# Options
......@@ -83,7 +90,20 @@ bin = $${rootdirectory:bin}
dependency-symlinks = $${symlinks:recipe}
# Deploy promises scripts
#----------------
#--
#-- Creates symlinks from the instance to the software release.
[symlinks]
recipe = cns.recipe.symlink
symlink_target = $${rootdirectory:bin}
symlink_base = ${postgresql:location}/bin
#----------------
#--
#-- Deploy promise scripts.
[postgres-promise]
recipe = slapos.cookbook:check_port_listening
path = $${basedirectory:promises}/postgres
......@@ -91,6 +111,10 @@ hostname = $${slap-network-information:global-ipv6}
port = $${postgres-instance:port}
#----------------
#--
#-- Publish instance URL.
[urls]
recipe = slapos.cookbook:publishurl
url = $${postgres-instance:url}
......
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