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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ivan Tyagov
slapos
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
class
Recipe
(
GenericBaseRecipe
):
def
install
(
self
):
path_list
=
[]
ip
=
self
.
options
[
'ip'
]
port
=
self
.
options
[
'port'
]
backend
=
self
.
options
[
'backend'
]
apache_conf
=
dict
()
try
:
backend_list
=
self
.
options
[
'backend-list'
]
except
KeyError
:
backend_list
=
[(
self
.
options
[
'port'
],
self
.
options
[
'backend'
])]
scheme
=
self
.
options
[
'scheme'
]
if
scheme
==
'http'
:
required_path_list
=
[]
apache_conf
[
'ssl_snippet'
]
=
''
ssl_enable
=
ssl_snippet
=
''
elif
scheme
==
'https'
:
key
=
self
.
options
[
'key-file'
]
certificate
=
self
.
options
[
'cert-file'
]
required_path_list
=
[
key
,
certificate
]
apache_conf
[
'key'
]
=
key
apache_conf
[
'certificate'
]
=
certificate
apache_conf
[
'ssl_session_cache'
]
=
self
.
options
[
'ssl-session-cache'
]
apache_conf
[
'ssl_snippet'
]
=
pkg_resources
.
resource_string
(
__name__
,
'template/snippet.ssl.in'
)
%
apache_conf
ssl_snippet
=
self
.
substituteTemplate
(
self
.
getTemplateFilename
(
'snippet.ssl.in'
),
{
'key'
:
key
,
'certificate'
:
certificate
,
'ssl_session_cache'
:
self
.
options
[
'ssl-session-cache'
]
,
})
if
'ssl-authentication'
in
self
.
options
and
self
.
optionIsTrue
(
'ssl-authentication'
):
apache_conf
[
'ssl_snippet'
]
+=
pkg_resources
.
resource_string
(
__name__
,
'
template/snippet.ssl.ca.in'
)
%
dict
(
ca_certificate
=
self
.
options
[
'ssl-authentication-certificate
'
],
ca_crl
=
self
.
options
[
'ssl-authentication-crl'
]
)
ssl_snippet
+=
self
.
substituteTemplate
(
self
.
getTemplateFilename
(
'snippet.ssl.ca.in'
),
{
'
ca_certificate'
:
self
.
options
[
'ssl-authentication-certificate'
],
'ca_crl'
:
self
.
options
[
'ssl-authentication-crl
'
],
})
ssl_enable
=
'SSLEngine on'
else
:
raise
ValueError
,
"Unsupported scheme %s"
%
scheme
raise
ValueError
(
'Unsupported scheme %s'
%
scheme
)
access_control_string
=
self
.
options
[
'access-control-string'
]
apache_conf
[
'pid_file'
]
=
self
.
options
[
'pid-file'
]
apache_conf
[
'lock_file'
]
=
self
.
options
[
'lock-file'
]
apache_conf
[
'ip'
]
=
ip
apache_conf
[
'port'
]
=
port
apache_conf
[
'server_admin'
]
=
'admin@'
apache_conf
[
'error_log'
]
=
self
.
options
[
'error-log'
]
apache_conf
[
'access_log'
]
=
self
.
options
[
'access-log'
]
apache_conf
[
'server_name'
]
=
'%s'
%
apache_conf
[
'ip'
]
apache_conf
[
'path'
]
=
'/'
apache_conf
[
'access_control_string'
]
=
access_control_string
apache_conf
[
'rewrite_rule'
]
=
"RewriteRule (.*) %s%s$1 [L,P]"
%
(
backend
,
self
.
options
.
get
(
'backend-path'
,
'/'
))
apache_conf_string
=
pkg_resources
.
resource_string
(
__name__
,
'template/apache.zope.conf.in'
)
%
apache_conf
apache_config_file
=
self
.
createFile
(
self
.
options
[
'configuration-file'
],
apache_conf_string
)
path_list
.
append
(
apache_config_file
)
wrapper
=
self
.
createPythonScript
(
self
.
options
[
'wrapper'
],
__name__
+
'.apache.runApache'
,
[
dict
(
required_path_list
=
required_path_list
,
binary
=
self
.
options
[
'apache-binary'
],
config
=
apache_config_file
)
])
path_list
.
append
(
wrapper
)
return
path_list
ip
=
self
.
options
[
'ip'
]
backend_path
=
self
.
options
.
get
(
'backend-path'
,
'/'
)
vhost_template_name
=
self
.
getTemplateFilename
(
'vhost.in'
)
apache_config_file
=
self
.
createFile
(
self
.
options
[
'configuration-file'
],
self
.
substituteTemplate
(
self
.
getTemplateFilename
(
'apache.zope.conf.in'
),
{
'path'
:
'/'
,
'server_admin'
:
'admin@'
,
'pid_file'
:
self
.
options
[
'pid-file'
],
'lock_file'
:
self
.
options
[
'lock-file'
],
'error_log'
:
self
.
options
[
'error-log'
],
'access_log'
:
self
.
options
[
'access-log'
],
'access_control_string'
:
self
.
options
[
'access-control-string'
],
'ssl_snippet'
:
ssl_snippet
,
'vhosts'
:
''
.
join
(
self
.
substituteTemplate
(
vhost_template_name
,
{
'ip'
:
ip
,
'port'
:
port
,
'backend'
:
backend
,
'backend-path'
:
backend_path
,
'ssl_enable'
:
ssl_enable
,
})
for
(
port
,
backend
)
in
backend_list
),
},
)
)
return
[
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
# Basic server configuration
PidFile "%(pid_file)s"
Listen %(ip)s:%(port)s
ServerAdmin %(server_admin)s
TypesConfig conf/mime.types
AddType application/x-compress .Z
...
...
@@ -63,4 +62,4 @@ CustomLog "%(access_log)s" combined
# Magic of Zope related rewrite
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
SSLCertificateKeyFile %(key)s
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