Commit 92898889 authored by Sebastien Robin's avatar Sebastien Robin

instanciate an apache with erp5testnode (remote access to log)

parent 296b4474
...@@ -33,7 +33,7 @@ from slapos.recipe.librecipe import GenericBaseRecipe ...@@ -33,7 +33,7 @@ from slapos.recipe.librecipe import GenericBaseRecipe
class Recipe(GenericBaseRecipe): class Recipe(GenericBaseRecipe):
def install(self): def install(self):
path_list = [] self.path_list = []
options = self.options.copy() options = self.options.copy()
del options['recipe'] del options['recipe']
CONFIG = {k.replace('-', '_'): v for k, v in options.iteritems()} CONFIG = {k.replace('-', '_'): v for k, v in options.iteritems()}
...@@ -63,8 +63,8 @@ class Recipe(GenericBaseRecipe): ...@@ -63,8 +63,8 @@ class Recipe(GenericBaseRecipe):
CONFIG CONFIG
), ),
) )
path_list.append(configuration_file) self.path_list.append(configuration_file)
path_list.append( self.path_list.append(
self.createPythonScript( self.createPythonScript(
self.options['wrapper'], self.options['wrapper'],
'slapos.recipe.librecipe.execute.executee', 'slapos.recipe.librecipe.execute.executee',
...@@ -78,4 +78,26 @@ class Recipe(GenericBaseRecipe): ...@@ -78,4 +78,26 @@ class Recipe(GenericBaseRecipe):
], ],
) )
) )
return path_list self.installApache()
return self.path_list
def installApache(self):
apache_config = dict(
pid_file=self.options['httpd-pid-file'],
lock_file=self.options['httpd-lock-file'],
ip=self.options['ipv6-address'],
port='9080',
error_log=os.path.join(self.options['httpd-log-directory'],
'httpd-error.log'),
access_log=os.path.join(self.options['httpd-log-directory'],
'httpd-access.log'),
)
config_file = self.createFile(self.options['httpd-conf-file'],
self.substituteTemplate(self.getTemplateFilename('httpd.conf.in'),
apache_config)
)
self.path_list.append(config_file)
wrapper = self.createPythonScript(self.options['httpd-wrapper'],
'slapos.recipe.librecipe.execute.execute',
[self.options['apache-binary'], '-f', config_file, '-DFOREGROUND'])
self.path_list.append(wrapper)
\ No newline at end of file
# Apache static configuration
# Automatically generated
# Basic server configuration
PidFile "%(pid_file)s"
Listen %(ip)s:%(port)s
ServerAdmin someone@email
DefaultType text/plain
TypesConfig conf/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
# Log configuration
ErrorLog "%(error_log)s"
LogLevel warn
LogFormat "%%h %%{REMOTE_USER}i %%l %%u %%t \"%%r\" %%>s %%b \"%%{Referer}i\" \"%%{User-Agent}i\"" combined
LogFormat "%%h %%{REMOTE_USER}i %%l %%u %%t \"%%r\" %%>s %%b" common
CustomLog "%(access_log)s" common
# Directory protection
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
# List of modules
LoadModule unixd_module modules/mod_unixd.so
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule headers_module modules/mod_headers.so
LoadModule dir_module modules/mod_dir.so
LoadModule alias_module modules/mod_alias.so
...@@ -46,11 +46,22 @@ slapgrid-software-binary = ${buildout:bin-directory}/slapgrid-sr ...@@ -46,11 +46,22 @@ slapgrid-software-binary = ${buildout:bin-directory}/slapgrid-sr
slapproxy-binary = ${buildout:bin-directory}/slapproxy slapproxy-binary = ${buildout:bin-directory}/slapproxy
testnode = ${buildout:bin-directory}/testnode testnode = ${buildout:bin-directory}/testnode
zip-binary = ${zip:location}/bin/zip zip-binary = ${zip:location}/bin/zip
httpd-pid-file = $${basedirectory:run}/httpd.pid
httpd-lock-file = $${basedirectory:run}/httpd.lock
httpd-conf-file = $${rootdirectory:etc}/httpd.conf
httpd-wrapper = $${basedirectory:services}/httpd
httpd-log-directory = $${basedirectory:log}
configuration-file = $${rootdirectory:etc}/erp5testnode.cfg configuration-file = $${rootdirectory:etc}/erp5testnode.cfg
log-file = $${basedirectory:log}/erp5testnode.log log-file = $${basedirectory:log}/erp5testnode.log
wrapper = $${basedirectory:services}/erp5testnode wrapper = $${basedirectory:services}/erp5testnode
# Binaries
apache-binary = ${apache:location}/bin/httpd
apache-modules-dir = ${apache:location}/modules/
apache-mime-file = ${apache:location}/conf/mime.types
apache-htpasswd = ${apache:location}/bin/htpasswd
[shell] [shell]
recipe = slapos.cookbook:shell recipe = slapos.cookbook:shell
wrapper = $${rootdirectory:bin}/sh wrapper = $${rootdirectory:bin}/sh
......
...@@ -12,6 +12,7 @@ extends = ...@@ -12,6 +12,7 @@ extends =
../../component/busybox/buildout.cfg ../../component/busybox/buildout.cfg
../../component/shellinabox/buildout.cfg ../../component/shellinabox/buildout.cfg
../../component/pwgen/buildout.cfg ../../component/pwgen/buildout.cfg
../../component/apache/buildout.cfg
# Local development # Local development
develop = develop =
...@@ -26,6 +27,7 @@ parts = ...@@ -26,6 +27,7 @@ parts =
eggs eggs
zip zip
git git
apache
# Local development # Local development
[slapos.cookbook-repository] [slapos.cookbook-repository]
...@@ -77,7 +79,7 @@ recipe = slapos.recipe.template ...@@ -77,7 +79,7 @@ recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-default.cfg url = ${:_profile_base_location_}/instance-default.cfg
output = ${buildout:directory}/template-default.cfg output = ${buildout:directory}/template-default.cfg
mode = 0644 mode = 0644
md5sum = f85d503b8f2ba26811dde4df9321ba22 md5sum = 15e9333279626b5e8364344320573043
[networkcache] [networkcache]
# signature certificates of the following uploaders. # signature certificates of the following uploaders.
......
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