Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
moodle_rebase10.1.2
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
Dmitry Blinov
moodle_rebase10.1.2
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):
key
=
ca_conf
.
pop
(
'key'
)
certificate
=
ca_conf
.
pop
(
'certificate'
)
# Install node + js script
node_parameter_dict
=
self
.
installFrontendNode
(
ip_list
=
[
'%s'
%
self
.
getGlobalIPv6Address
(),
self
.
getLocalIPv4Address
()],
ip
=
self
.
getGlobalIPv6Address
(),
port
=
frontend_port_number
,
plain_http
=
redirect_plain_http
,
name
=
frontend_domain_name
,
...
...
@@ -241,62 +241,28 @@ class Recipe(BaseSlapRecipe):
certificate_authority_path
=
config
[
'ca_dir'
]
)
def
_getApacheConfigurationDict
(
self
,
name
,
ip_list
,
port
):
apache_conf
=
dict
()
apache_conf
[
'server_name'
]
=
name
apache_conf
[
'pid_file'
]
=
os
.
path
.
join
(
self
.
run_directory
,
name
+
'.pid'
)
apache_conf
[
'lock_file'
]
=
os
.
path
.
join
(
self
.
run_directory
,
name
+
'.lock'
)
apache_conf
[
'ip_list'
]
=
ip_list
apache_conf
[
'port'
]
=
port
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
_getProxyTableContent
(
self
,
rewrite_rule_list
):
proxy_table_content
=
'{'
for
rewrite_rule
in
rewrite_rule_list
:
rewrite_part
=
self
.
substituteTemplate
(
self
.
getTemplateFilename
(
'proxytable-host.json.in'
),
rewrite_rule
)
proxy_table_content
=
"""%s
%s"""
%
(
proxy_table_content
,
rewrite_part
)
proxy_table_content
=
'%s}'
%
proxy_table_content
return
proxy_table_content
def
installFrontendNode
(
self
,
ip_list
,
port
,
key
,
certificate
,
plain_http
,
name
,
rewrite_rule_list
,
access_control_string
=
None
):
apachemap_name
=
"apachemap.txt"
def
installFrontendNode
(
self
,
ip
,
port
,
key
,
certificate
,
plain_http
,
name
,
rewrite_rule_list
):
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
))
apache_conf
=
self
.
_getApacheConfigurationDict
(
name
,
ip_list
,
port
)
apache_conf
[
'ssl_snippet'
]
=
self
.
substituteTemplate
(
self
.
getTemplateFilename
(
'apache.ssl-snippet.conf.in'
),
dict
(
login_certificate
=
certificate
,
login_key
=
key
))
apache_conf
[
"listen"
]
=
"
\
n
"
.
join
([
"Listen %s:%s"
%
(
ip
,
port
)
for
ip
in
ip_list
])
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
)
]))
self
.
path_list
.
append
(
map_file
)
wrapper
=
zc
.
buildout
.
easy_install
.
scripts
([(
name
,
'slapos.recipe.librecipe.execute'
,
'execute'
)],
self
.
ws
,
sys
.
executable
,
self
.
wrapper_directory
,
arguments
=
[
ip
,
port
,
key
,
certificate
,
plain_http
]
)[
0
]
self
.
path_list
.
extend
(
wrapper
)
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