Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos-caddy
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
Guillaume Hervier
slapos-caddy
Commits
22703390
Commit
22703390
authored
Sep 27, 2012
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apache supports more than one listening port. Support it in recipe too.
parent
7984b871
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
51 deletions
+62
-51
slapos/recipe/apache_zope_backend/__init__.py
slapos/recipe/apache_zope_backend/__init__.py
+56
-46
slapos/recipe/apache_zope_backend/template/apache.zope.conf.in
...s/recipe/apache_zope_backend/template/apache.zope.conf.in
+1
-2
slapos/recipe/apache_zope_backend/template/snippet.ssl.in
slapos/recipe/apache_zope_backend/template/snippet.ssl.in
+0
-3
slapos/recipe/apache_zope_backend/template/vhost.in
slapos/recipe/apache_zope_backend/template/vhost.in
+5
-0
No files found.
slapos/recipe/apache_zope_backend/__init__.py
View file @
22703390
...
@@ -29,61 +29,71 @@ import pkg_resources
...
@@ -29,61 +29,71 @@ import pkg_resources
class
Recipe
(
GenericBaseRecipe
):
class
Recipe
(
GenericBaseRecipe
):
def
install
(
self
):
def
install
(
self
):
path_list
=
[]
try
:
ip
=
self
.
options
[
'ip'
]
backend_list
=
self
.
options
[
'backend-list'
]
port
=
self
.
options
[
'port'
]
except
KeyError
:
backend
=
self
.
options
[
'backend'
]
backend_list
=
[(
self
.
options
[
'port'
],
self
.
options
[
'backend'
])]
apache_conf
=
dict
()
scheme
=
self
.
options
[
'scheme'
]
scheme
=
self
.
options
[
'scheme'
]
if
scheme
==
'http'
:
if
scheme
==
'http'
:
required_path_list
=
[]
required_path_list
=
[]
apache_conf
[
'ssl_snippet'
]
=
''
ssl_enable
=
ssl_snippet
=
''
elif
scheme
==
'https'
:
elif
scheme
==
'https'
:
key
=
self
.
options
[
'key-file'
]
key
=
self
.
options
[
'key-file'
]
certificate
=
self
.
options
[
'cert-file'
]
certificate
=
self
.
options
[
'cert-file'
]
required_path_list
=
[
key
,
certificate
]
required_path_list
=
[
key
,
certificate
]
apache_conf
[
'key'
]
=
key
ssl_snippet
=
self
.
substituteTemplate
(
self
.
getTemplateFilename
(
'snippet.ssl.in'
),
{
apache_conf
[
'certificate'
]
=
certificate
'key'
:
key
,
apache_conf
[
'ssl_session_cache'
]
=
self
.
options
[
'ssl-session-cache'
]
'certificate'
:
certificate
,
apache_conf
[
'ssl_snippet'
]
=
pkg_resources
.
resource_string
(
__name__
,
'ssl_session_cache'
:
self
.
options
[
'ssl-session-cache'
]
,
'template/snippet.ssl.in'
)
%
apache_conf
})
if
'ssl-authentication'
in
self
.
options
and
self
.
optionIsTrue
(
if
'ssl-authentication'
in
self
.
options
and
self
.
optionIsTrue
(
'ssl-authentication'
):
'ssl-authentication'
):
apache_conf
[
'ssl_snippet'
]
+=
pkg_resources
.
resource_string
(
__name__
,
ssl_snippet
+=
self
.
substituteTemplate
(
self
.
getTemplateFilename
(
'snippet.ssl.ca.in'
),
{
'
template/snippet.ssl.ca.in'
)
%
dict
(
'
ca_certificate'
:
self
.
options
[
'ssl-authentication-certificate'
],
ca_certificate
=
self
.
options
[
'ssl-authentication-certificate
'
],
'ca_crl'
:
self
.
options
[
'ssl-authentication-crl
'
],
ca_crl
=
self
.
options
[
'ssl-authentication-crl'
]
})
)
ssl_enable
=
'SSLEngine on'
else
:
else
:
raise
ValueError
,
"Unsupported scheme %s"
%
scheme
raise
ValueError
(
'Unsupported scheme %s'
%
scheme
)
access_control_string
=
self
.
options
[
'access-control-string'
]
ip
=
self
.
options
[
'ip'
]
apache_conf
[
'pid_file'
]
=
self
.
options
[
'pid-file'
]
backend_path
=
self
.
options
.
get
(
'backend-path'
,
'/'
)
apache_conf
[
'lock_file'
]
=
self
.
options
[
'lock-file'
]
vhost_template_name
=
self
.
getTemplateFilename
(
'vhost.in'
)
apache_conf
[
'ip'
]
=
ip
apache_config_file
=
self
.
createFile
(
apache_conf
[
'port'
]
=
port
self
.
options
[
'configuration-file'
],
apache_conf
[
'server_admin'
]
=
'admin@'
self
.
substituteTemplate
(
apache_conf
[
'error_log'
]
=
self
.
options
[
'error-log'
]
self
.
getTemplateFilename
(
'apache.zope.conf.in'
),
apache_conf
[
'access_log'
]
=
self
.
options
[
'access-log'
]
{
apache_conf
[
'server_name'
]
=
'%s'
%
apache_conf
[
'ip'
]
'path'
:
'/'
,
apache_conf
[
'path'
]
=
'/'
'server_admin'
:
'admin@'
,
apache_conf
[
'access_control_string'
]
=
access_control_string
'pid_file'
:
self
.
options
[
'pid-file'
],
apache_conf
[
'rewrite_rule'
]
=
"RewriteRule (.*) %s%s$1 [L,P]"
%
(
backend
,
'lock_file'
:
self
.
options
[
'lock-file'
],
self
.
options
.
get
(
'backend-path'
,
'/'
))
'error_log'
:
self
.
options
[
'error-log'
],
apache_conf_string
=
pkg_resources
.
resource_string
(
__name__
,
'access_log'
:
self
.
options
[
'access-log'
],
'template/apache.zope.conf.in'
)
%
apache_conf
'access_control_string'
:
self
.
options
[
'access-control-string'
],
apache_config_file
=
self
.
createFile
(
self
.
options
[
'configuration-file'
],
'ssl_snippet'
:
ssl_snippet
,
apache_conf_string
)
'vhosts'
:
''
.
join
(
self
.
substituteTemplate
(
vhost_template_name
,
{
path_list
.
append
(
apache_config_file
)
'ip'
:
ip
,
wrapper
=
self
.
createPythonScript
(
self
.
options
[
'wrapper'
],
__name__
+
'port'
:
port
,
'.apache.runApache'
,
[
'backend'
:
backend
,
dict
(
'backend-path'
:
backend_path
,
required_path_list
=
required_path_list
,
'ssl_enable'
:
ssl_enable
,
binary
=
self
.
options
[
'apache-binary'
],
})
for
(
port
,
backend
)
in
backend_list
),
config
=
apache_config_file
},
)
)
])
)
path_list
.
append
(
wrapper
)
return
[
return
path_list
apache_config_file
,
self
.
createPythonScript
(
self
.
options
[
'wrapper'
],
__name__
+
'.apache.runApache'
,
[
{
'required_path_list'
:
required_path_list
,
'binary'
:
self
.
options
[
'apache-binary'
],
'config'
:
apache_config_file
,
},
],
),
]
slapos/recipe/apache_zope_backend/template/apache.zope.conf.in
View file @
22703390
...
@@ -22,7 +22,6 @@ LoadModule headers_module modules/mod_headers.so
...
@@ -22,7 +22,6 @@ LoadModule headers_module modules/mod_headers.so
# Basic server configuration
# Basic server configuration
PidFile "%(pid_file)s"
PidFile "%(pid_file)s"
Listen %(ip)s:%(port)s
ServerAdmin %(server_admin)s
ServerAdmin %(server_admin)s
TypesConfig conf/mime.types
TypesConfig conf/mime.types
AddType application/x-compress .Z
AddType application/x-compress .Z
...
@@ -63,4 +62,4 @@ CustomLog "%(access_log)s" combined
...
@@ -63,4 +62,4 @@ CustomLog "%(access_log)s" combined
# Magic of Zope related rewrite
# Magic of Zope related rewrite
RewriteEngine On
RewriteEngine On
%(
rewrite_rule
)s
%(
vhosts
)s
slapos/recipe/apache_zope_backend/template/snippet.ssl.in
View file @
22703390
# SSL Configuration
SSLEngine on
SSLCertificateFile %(certificate)s
SSLCertificateFile %(certificate)s
SSLCertificateKeyFile %(key)s
SSLCertificateKeyFile %(key)s
SSLRandomSeed startup builtin
SSLRandomSeed startup builtin
...
...
slapos/recipe/apache_zope_backend/template/vhost.in
0 → 100644
View file @
22703390
Listen %(ip)s:%(port)s
<VirtualHost *:%(port)s>
%(ssl_enable)s
RewriteRule (.*) %(backend)s%(backend-path)s$1 [L,P]
</VirtualHost>
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