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
Gwenaël Samain
slapos
Commits
b74a0ce8
Commit
b74a0ce8
authored
Dec 06, 2011
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Draft for frontend recipe
parent
6cc76177
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
57 deletions
+28
-57
slapos/recipe/kvm_frontend/__init__.py
slapos/recipe/kvm_frontend/__init__.py
+23
-57
slapos/recipe/kvm_frontend/template/proxytable-host.json.in
slapos/recipe/kvm_frontend/template/proxytable-host.json.in
+5
-0
No files found.
slapos/recipe/kvm_frontend/__init__.py
View file @
b74a0ce8
...
@@ -89,9 +89,9 @@ class Recipe(BaseSlapRecipe):
...
@@ -89,9 +89,9 @@ class Recipe(BaseSlapRecipe):
key
=
ca_conf
.
pop
(
'key'
)
key
=
ca_conf
.
pop
(
'key'
)
certificate
=
ca_conf
.
pop
(
'certificate'
)
certificate
=
ca_conf
.
pop
(
'certificate'
)
# Install node + js script
node_parameter_dict
=
self
.
installFrontendNode
(
node_parameter_dict
=
self
.
installFrontendNode
(
ip_list
=
[
'%s'
%
self
.
getGlobalIPv6Address
(),
ip
=
self
.
getGlobalIPv6Address
(),
self
.
getLocalIPv4Address
()],
port
=
frontend_port_number
,
port
=
frontend_port_number
,
plain_http
=
redirect_plain_http
,
plain_http
=
redirect_plain_http
,
name
=
frontend_domain_name
,
name
=
frontend_domain_name
,
...
@@ -241,62 +241,28 @@ class Recipe(BaseSlapRecipe):
...
@@ -241,62 +241,28 @@ class Recipe(BaseSlapRecipe):
certificate_authority_path
=
config
[
'ca_dir'
]
certificate_authority_path
=
config
[
'ca_dir'
]
)
)
def
_getApacheConfigurationDict
(
self
,
name
,
ip_list
,
port
):
def
_getProxyTableContent
(
self
,
rewrite_rule_list
):
apache_conf
=
dict
()
proxy_table_content
=
'{'
apache_conf
[
'server_name'
]
=
name
for
rewrite_rule
in
rewrite_rule_list
:
apache_conf
[
'pid_file'
]
=
os
.
path
.
join
(
self
.
run_directory
,
rewrite_part
=
self
.
substituteTemplate
(
name
+
'.pid'
)
self
.
getTemplateFilename
(
'proxytable-host.json.in'
),
rewrite_rule
)
apache_conf
[
'lock_file'
]
=
os
.
path
.
join
(
self
.
run_directory
,
proxy_table_content
=
"""%s
name
+
'.lock'
)
%s"""
%
(
proxy_table_content
,
rewrite_part
)
apache_conf
[
'ip_list'
]
=
ip_list
proxy_table_content
=
'%s}'
%
proxy_table_content
apache_conf
[
'port'
]
=
port
return
proxy_table_content
apache_conf
[
'server_admin'
]
=
'admin@'
apache_conf
[
'error_log'
]
=
os
.
path
.
join
(
self
.
log_directory
,
name
+
'-error.log'
)
apache_conf
[
'access_log'
]
=
os
.
path
.
join
(
self
.
log_directory
,
name
+
'-access.log'
)
self
.
registerLogRotation
(
name
,
[
apache_conf
[
'error_log'
],
apache_conf
[
'access_log'
]],
self
.
killpidfromfile
+
' '
+
apache_conf
[
'pid_file'
]
+
' SIGUSR1'
)
return
apache_conf
def
installFrontendNode
(
self
,
ip_list
,
port
,
key
,
certificate
,
plain_http
,
def
installFrontendNode
(
self
,
ip
,
port
,
key
,
certificate
,
plain_http
,
name
,
rewrite_rule_list
,
access_control_string
=
None
):
name
,
rewrite_rule_list
):
apachemap_name
=
"apachemap.txt"
map_name
=
"proxy_table.json"
map_content
=
self
.
_getProxyTableContent
(
rewrite_rule_list
)
map_file
=
self
.
createConfigurationFile
(
map_name
,
map_content
)
self
.
createConfigurationFile
(
apachemap_name
,
"
\
n
"
.
join
(
rewrite_rule_list
))
self
.
path_list
.
append
(
map_file
)
apache_conf
=
self
.
_getApacheConfigurationDict
(
name
,
ip_list
,
port
)
wrapper
=
zc
.
buildout
.
easy_install
.
scripts
([(
apache_conf
[
'ssl_snippet'
]
=
self
.
substituteTemplate
(
name
,
'slapos.recipe.librecipe.execute'
,
'execute'
)],
self
.
ws
,
self
.
getTemplateFilename
(
'apache.ssl-snippet.conf.in'
),
sys
.
executable
,
self
.
wrapper_directory
,
arguments
=
[
dict
(
login_certificate
=
certificate
,
login_key
=
key
))
ip
,
port
,
key
,
certificate
,
plain_http
]
)[
0
]
apache_conf
[
"listen"
]
=
"
\
n
"
.
join
([
"Listen %s:%s"
%
(
ip
,
port
)
for
ip
in
ip_list
])
self
.
path_list
.
extend
(
wrapper
)
path
=
self
.
substituteTemplate
(
self
.
getTemplateFilename
(
'apache.conf.path-protected.in'
),
dict
(
path
=
'/'
,
access_control_string
=
'none'
))
apache_conf
.
update
(
**
dict
(
path_enable
=
path
,
apachemap_path
=
os
.
path
.
join
(
self
.
etc_directory
,
apachemap_name
),
apache_domain
=
name
,
port
=
port
,
))
apache_conf_string
=
self
.
substituteTemplate
(
self
.
getTemplateFilename
(
'apache.conf.in'
),
apache_conf
)
apache_config_file
=
self
.
createConfigurationFile
(
name
+
'.conf'
,
apache_conf_string
)
self
.
path_list
.
append
(
apache_config_file
)
self
.
path_list
.
extend
(
zc
.
buildout
.
easy_install
.
scripts
([(
name
,
'slapos.recipe.erp5.apache'
,
'runApache'
)],
self
.
ws
,
sys
.
executable
,
self
.
wrapper_directory
,
arguments
=
[
dict
(
required_path_list
=
[
key
,
certificate
],
binary
=
self
.
options
[
'httpd_binary'
],
config
=
apache_config_file
)
]))
return
dict
(
site_url
=
"https://%s:%s/"
%
(
name
,
port
))
return
dict
(
site_url
=
"https://%s:%s/"
%
(
name
,
port
))
slapos/recipe/kvm_frontend/template/proxytable-host.json.in
0 → 100644
View file @
b74a0ce8
"/%(reference)s": {
"port": %(port)s,
"host": "%(host)s",
"https": %(https)s
}
\ No newline at end of file
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