Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Cédric Le Ninivin
slapos
Commits
45140cde
Commit
45140cde
authored
Oct 12, 2012
by
Viktor Horvath
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apache is running! but Mioga not yet.
parent
4d15f8ba
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
94 additions
and
19 deletions
+94
-19
slapos/recipe/mioga/instantiate.py
slapos/recipe/mioga/instantiate.py
+79
-0
software/mioga/instance-apacheperl.cfg
software/mioga/instance-apacheperl.cfg
+15
-19
No files found.
slapos/recipe/mioga/instantiate.py
View file @
45140cde
...
...
@@ -29,6 +29,7 @@ import os
import
pprint
import
re
import
shutil
import
signal
import
stat
import
subprocess
...
...
@@ -46,6 +47,12 @@ class Recipe(GenericBaseRecipe):
os
.
remove
(
filepath
)
def
install
(
self
):
self
.
instantiate
(
True
)
def
update
(
self
):
self
.
instantiate
(
False
)
def
instantiate
(
self
,
isNewInstall
):
print
"This is the Mioga recipe"
print
"Looking for compile folder:"
print
self
.
options
[
'mioga_compile_dir'
]
...
...
@@ -106,8 +113,80 @@ class Recipe(GenericBaseRecipe):
env=environ, shell=True)
cmd.communicate()
# Apache configuration!
# Take the files that Mioga has prepared, and wrap some standard configuration around it.
# TODO: can'
t
we
squeeze
this
somehow
into
the
generic
apacheperl
recipe
?
apache_config_mioga
=
'''
LoadModule alias_module modules/mod_alias.so
LoadModule apreq_module modules/mod_apreq2.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule dav_module modules/mod_dav.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule headers_module modules/mod_headers.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule perl_module modules/mod_perl.so
# Basic server configuration
# TODO: how to listen to standard port 80 when we are not root?
PidFile REPL_PID
Listen [REPL_IPV6HOST]:REPL_IPV6PORT
# Listen [REPL_IPV6]:443 # what about mod_ssl and all that stuff?
# ServerAdmin someone@email
# Log configuration
ErrorLog REPL_ERRORLOG
LogLevel debug
CustomLog REPL_ACCESSLOG common
DocumentRoot REPL_DOCROOT
'''
apache_config_mioga
=
(
apache_config_mioga
.
replace
(
'REPL_PID'
,
self
.
options
[
'pid_file'
])
.
replace
(
'REPL_IPV6HOST'
,
self
.
options
[
'public_ipv6'
])
.
replace
(
'REPL_IPV6PORT'
,
self
.
options
[
'public_ipv6_port'
])
.
replace
(
'REPL_ERRORLOG'
,
self
.
options
[
'error_log'
])
.
replace
(
'REPL_ACCESSLOG'
,
self
.
options
[
'access_log'
])
.
replace
(
'REPL_DOCROOT'
,
self
.
options
[
'htdocs'
])
)
mioga_prepared_apache_config_dir
=
os
.
path
.
join
(
mioga_base
,
'conf'
,
'apache'
)
for
filepath
in
os
.
listdir
(
mioga_prepared_apache_config_dir
):
apache_config_mioga
+=
(
"# Read in from "
+
filepath
+
"
\
n
"
+
open
(
os
.
path
.
join
(
mioga_prepared_apache_config_dir
,
filepath
)).
read
()
+
"
\
n
"
)
# Internal DAV only accepts its own IPv6 address
# TODO: check with what sender address we really arrive at the DAV locations.
apache_config_mioga
=
re
.
sub
(
'Allow from localhost'
,
'# Allow from localhost'
,
apache_config_mioga
)
path_list
=
[]
open
(
self
.
options
[
'httpd_conf'
],
'w'
).
write
(
apache_config_mioga
)
# TODO: if that all works fine, put it into a proper template
# httpd_conf = self.createFile(self.options['httpd_conf'],
# self.substituteTemplate(self.getTemplateFilename('apache.in'),
# apache_config)
# )
path_list
.
append
(
os
.
path
.
abspath
(
self
.
options
[
'httpd_conf'
]))
wrapper
=
self
.
createPythonScript
(
self
.
options
[
'wrapper'
],
'slapos.recipe.librecipe.execute.execute'
,
[
self
.
options
[
'httpd_binary'
],
'-f'
,
self
.
options
[
'httpd_conf'
],
'-DFOREGROUND'
]
)
path_list
.
append
(
wrapper
)
if
os
.
path
.
exists
(
self
.
options
[
'pid_file'
]):
# Reload apache configuration
with
open
(
self
.
options
[
'pid_file'
])
as
pid_file
:
pid
=
int
(
pid_file
.
read
().
strip
(),
10
)
try
:
os
.
kill
(
pid
,
signal
.
SIGUSR1
)
# Graceful restart
except
OSError
:
pass
os
.
chdir
(
former_directory
)
print
"Mioga instantiate.py::install finished!"
return
path_list
# Copied verbatim from mioga-hooks.py - how to reuse code?
...
...
software/mioga/instance-apacheperl.cfg
View file @
45140cde
[buildout]
parts =
postgres-urlparse
apacheperl-promise
publish-connection-information
# apacheperl-promise
mioga-instance
publish-connection-information
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
...
...
@@ -22,22 +22,6 @@ services = $${rootdirectory:etc}/run
promises = $${rootdirectory:etc}/promise
htdocs = $${rootdirectory:srv}/htdocs
[apacheperl-instance]
recipe = slapos.cookbook:apacheperl
ip = $${slap-network-information:global-ipv6}
port = 8080
httpd-binary = ${apache-2.2:location}/bin/httpd
# XXX TODO: Wait for the iso to be uploaded (execute_wait)
path = $${basedirectory:services}/apacheperl
htdocs = $${basedirectory:htdocs}
httpd-conf = $${rootdirectory:etc}/httpd.conf
pid-file = $${basedirectory:services}/apache.pid
lock-file = $${basedirectory:services}/apache.lock
wrapper = $${basedirectory:services}/httpd_wrapper
# source = ${buildout:parts-directory}/${:_buildout_section_name_}
error-log = $${rootdirectory:log}/error.log
access-log = $${rootdirectory:log}/access.log
[apacheperl-promise]
recipe = slapos.cookbook:check_port_listening
path = $${basedirectory:promises}/httpd_promise
...
...
@@ -46,7 +30,7 @@ port = $${apacheperl-instance:port}
[publish-connection-information]
recipe = slapos.cookbook:publish
apacheperl_url = http://[$${
apacheperl-instance:ip}]:$${apacheperl-instance:
port}
apacheperl_url = http://[$${
slap-network-information:global-ipv6}]:$${mioga-instance:public_ipv6_
port}
# Request Postgres instance and parse its URL
[request-postgres]
...
...
@@ -84,3 +68,15 @@ db_port = $${postgres-urlparse:port}
db_dbname = $${postgres-urlparse:path}
db_username = $${postgres-urlparse:username}
db_password = $${postgres-urlparse:password}
public_ipv6 = $${slap-network-information:global-ipv6}
public_ipv6_port = 8080
private_ipv4 = $${slap-network-information:local-ipv4}
httpd_binary = ${apache-2.2:location}/bin/httpd
path = $${basedirectory:services}/apacheperl
htdocs = $${basedirectory:htdocs}
httpd_conf = $${rootdirectory:etc}/httpd.conf
pid_file = $${basedirectory:services}/apache.pid
lock_file = $${basedirectory:services}/apache.lock
wrapper = $${basedirectory:services}/httpd_wrapper
error_log = $${rootdirectory:log}/error.log
access_log = $${rootdirectory:log}/access.log
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment