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
Aurel
slapos
Commits
2ab35b9a
Commit
2ab35b9a
authored
Aug 02, 2011
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Listen on IPv6 and IPv4 address.
parent
648f0f49
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
8 deletions
+16
-8
slapos/recipe/apache/__init__.py
slapos/recipe/apache/__init__.py
+13
-7
slapos/recipe/apache/template/apache.conf.in
slapos/recipe/apache/template/apache.conf.in
+3
-1
No files found.
slapos/recipe/apache/__init__.py
View file @
2ab35b9a
...
@@ -62,15 +62,19 @@ class Recipe(BaseSlapRecipe):
...
@@ -62,15 +62,19 @@ class Recipe(BaseSlapRecipe):
key
,
certificate
=
self
.
requestCertificate
(
frontend_domain_name
)
key
,
certificate
=
self
.
requestCertificate
(
frontend_domain_name
)
apache_parameter_dict
=
self
.
installFrontendApache
(
apache_parameter_dict
=
self
.
installFrontendApache
(
ip
=
self
.
getGlobalIPv6Address
(),
ip_list
=
[
"[%s]"
%
self
.
getGlobalIPv6Address
(),
port
=
8080
,
name
=
frontend_domain_name
,
self
.
getLocalIPv4Address
()],
port
=
4443
,
name
=
frontend_domain_name
,
key
=
key
,
certificate
=
certificate
)
key
=
key
,
certificate
=
certificate
)
slave_dict
=
apache_parameter_dict
.
pop
(
"slave_dict"
)
slave_dict
=
apache_parameter_dict
.
pop
(
"slave_dict"
)
for
reference
,
url
in
slave_dict
.
iteritems
():
for
reference
,
url
in
slave_dict
.
iteritems
():
self
.
setConnectionDict
(
dict
(
site_url
=
url
),
reference
)
self
.
setConnectionDict
(
dict
(
site_url
=
url
),
reference
)
self
.
setConnectionDict
(
dict
(
site_url
=
apache_parameter_dict
[
"site_url"
]))
self
.
setConnectionDict
(
dict
(
site_url
=
apache_parameter_dict
[
"site_url"
],
domain_ipv6_address
=
self
.
getGlobalIPv6Address
(),
domain_ipv4_address
=
self
.
getLocalIPv4Address
()))
return
self
.
path_list
return
self
.
path_list
def
installLogrotate
(
self
):
def
installLogrotate
(
self
):
...
@@ -190,14 +194,14 @@ class Recipe(BaseSlapRecipe):
...
@@ -190,14 +194,14 @@ class Recipe(BaseSlapRecipe):
certificate_authority_path
=
config
[
'ca_dir'
]
certificate_authority_path
=
config
[
'ca_dir'
]
)
)
def
_getApacheConfigurationDict
(
self
,
name
,
ip
,
port
):
def
_getApacheConfigurationDict
(
self
,
name
,
ip
_list
,
port
):
apache_conf
=
dict
()
apache_conf
=
dict
()
apache_conf
[
'server_name'
]
=
name
apache_conf
[
'server_name'
]
=
name
apache_conf
[
'pid_file'
]
=
os
.
path
.
join
(
self
.
run_directory
,
apache_conf
[
'pid_file'
]
=
os
.
path
.
join
(
self
.
run_directory
,
name
+
'.pid'
)
name
+
'.pid'
)
apache_conf
[
'lock_file'
]
=
os
.
path
.
join
(
self
.
run_directory
,
apache_conf
[
'lock_file'
]
=
os
.
path
.
join
(
self
.
run_directory
,
name
+
'.lock'
)
name
+
'.lock'
)
apache_conf
[
'ip
'
]
=
ip
apache_conf
[
'ip
_list'
]
=
ip_list
apache_conf
[
'port'
]
=
port
apache_conf
[
'port'
]
=
port
apache_conf
[
'server_admin'
]
=
'admin@'
apache_conf
[
'server_admin'
]
=
'admin@'
apache_conf
[
'error_log'
]
=
os
.
path
.
join
(
self
.
log_directory
,
apache_conf
[
'error_log'
]
=
os
.
path
.
join
(
self
.
log_directory
,
...
@@ -209,7 +213,7 @@ class Recipe(BaseSlapRecipe):
...
@@ -209,7 +213,7 @@ class Recipe(BaseSlapRecipe):
apache_conf
[
'pid_file'
]
+
' SIGUSR1'
)
apache_conf
[
'pid_file'
]
+
' SIGUSR1'
)
return
apache_conf
return
apache_conf
def
installFrontendApache
(
self
,
ip
,
port
,
key
,
certificate
,
def
installFrontendApache
(
self
,
ip
_list
,
port
,
key
,
certificate
,
name
,
access_control_string
=
None
):
name
,
access_control_string
=
None
):
apachemap_name
=
"apachemap.txt"
apachemap_name
=
"apachemap.txt"
slave_instance_list
=
self
.
parameter_dict
.
get
(
"slave_instance_list"
,
[])
slave_instance_list
=
self
.
parameter_dict
.
get
(
"slave_instance_list"
,
[])
...
@@ -224,11 +228,13 @@ class Recipe(BaseSlapRecipe):
...
@@ -224,11 +228,13 @@ class Recipe(BaseSlapRecipe):
slave_dict
[
slave_instance
.
get
(
"slave_reference"
)]
=
\
slave_dict
[
slave_instance
.
get
(
"slave_reference"
)]
=
\
"https://%s:%s/%s"
%
(
name
,
port
,
id
)
"https://%s:%s/%s"
%
(
name
,
port
,
id
)
self
.
createConfigurationFile
(
apachemap_name
,
"
\
n
"
.
join
(
rewrite_rule_list
))
self
.
createConfigurationFile
(
apachemap_name
,
"
\
n
"
.
join
(
rewrite_rule_list
))
apache_conf
=
self
.
_getApacheConfigurationDict
(
name
,
ip
,
port
)
apache_conf
=
self
.
_getApacheConfigurationDict
(
name
,
ip
_list
,
port
)
apache_conf
[
'ssl_snippet'
]
=
self
.
substituteTemplate
(
apache_conf
[
'ssl_snippet'
]
=
self
.
substituteTemplate
(
self
.
getTemplateFilename
(
'apache.ssl-snippet.conf.in'
),
self
.
getTemplateFilename
(
'apache.ssl-snippet.conf.in'
),
dict
(
login_certificate
=
certificate
,
login_key
=
key
))
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
(
path
=
self
.
substituteTemplate
(
self
.
getTemplateFilename
(
'apache.conf.path-protected.in'
),
self
.
getTemplateFilename
(
'apache.conf.path-protected.in'
),
dict
(
path
=
'/'
,
access_control_string
=
'none'
))
dict
(
path
=
'/'
,
access_control_string
=
'none'
))
...
...
slapos/recipe/apache/template/apache.conf.in
View file @
2ab35b9a
...
@@ -5,7 +5,9 @@
...
@@ -5,7 +5,9 @@
PidFile "%(pid_file)s"
PidFile "%(pid_file)s"
LockFile "%(lock_file)s"
LockFile "%(lock_file)s"
ServerName %(server_name)s
ServerName %(server_name)s
Listen [%(ip)s]:%(port)s
%(listen)s
ServerAdmin %(server_admin)s
ServerAdmin %(server_admin)s
DefaultType text/plain
DefaultType text/plain
TypesConfig conf/mime.types
TypesConfig conf/mime.types
...
...
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