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
Kasra Jamshidi
slapos
Commits
06402ffa
Commit
06402ffa
authored
Dec 08, 2011
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working kvm frontend for vifib proxying
parent
1c13a438
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
25 deletions
+30
-25
slapos/recipe/kvm_frontend/__init__.py
slapos/recipe/kvm_frontend/__init__.py
+11
-9
slapos/recipe/kvm_frontend/template/kvm-proxy.js
slapos/recipe/kvm_frontend/template/kvm-proxy.js
+7
-11
slapos/recipe/kvm_frontend/template/proxytable-vifib-snippet.json.in
...pe/kvm_frontend/template/proxytable-vifib-snippet.json.in
+4
-3
software/kvm-frontend/instance.cfg
software/kvm-frontend/instance.cfg
+3
-1
software/kvm-frontend/software.cfg
software/kvm-frontend/software.cfg
+5
-1
No files found.
slapos/recipe/kvm_frontend/__init__.py
View file @
06402ffa
...
@@ -247,13 +247,14 @@ class Recipe(BaseSlapRecipe):
...
@@ -247,13 +247,14 @@ class Recipe(BaseSlapRecipe):
rewrite_part
=
self
.
substituteTemplate
(
rewrite_part
=
self
.
substituteTemplate
(
self
.
getTemplateFilename
(
'proxytable-host.json.in'
),
rewrite_rule
)
self
.
getTemplateFilename
(
'proxytable-host.json.in'
),
rewrite_rule
)
proxy_table_content
=
"""%s%s,"""
%
(
proxy_table_content
,
rewrite_part
)
proxy_table_content
=
"""%s%s,"""
%
(
proxy_table_content
,
rewrite_part
)
proxy_table_content
=
"""%s%s"""
%
(
proxy_table_content
,
proxy_table_content
=
'%s%s'
%
(
proxy_table_content
,
self
.
getTemplateFilename
(
'proxytable-vifib-snippet.json.in'
))
open
(
self
.
getTemplateFilename
(
'proxytable-vifib-snippet.json.in'
)).
read
(
))
proxy_table_content
=
'%s}'
%
proxy_table_content
proxy_table_content
=
'%s}
\
n
'
%
proxy_table_content
return
proxy_table_content
return
proxy_table_content
def
installFrontendNode
(
self
,
ip
,
port
,
key
,
certificate
,
plain_http
,
def
installFrontendNode
(
self
,
ip
,
port
,
key
,
certificate
,
plain_http
,
name
,
rewrite_rule_list
):
name
,
rewrite_rule_list
):
# XXX-Cedric : is name necessary?
# Create Map
# Create Map
map_name
=
"proxy_table.json"
map_name
=
"proxy_table.json"
map_content
=
self
.
_getProxyTableContent
(
rewrite_rule_list
)
map_content
=
self
.
_getProxyTableContent
(
rewrite_rule_list
)
...
@@ -261,20 +262,21 @@ class Recipe(BaseSlapRecipe):
...
@@ -261,20 +262,21 @@ class Recipe(BaseSlapRecipe):
self
.
path_list
.
append
(
map_file
)
self
.
path_list
.
append
(
map_file
)
# Install script
# Install script
kvm_proxy_script_in
=
pkg_resources
.
resource_f
ilename
(
kvm_proxy_script_in
=
open
(
self
.
getTemplateF
ilename
(
__name__
,
os
.
path
.
join
(
'template'
,
'kvm-proxy.js'
)
)
'kvm-proxy.js'
),
'r'
).
read
(
)
kvm_proxy_script
=
self
.
createRunningWrapper
(
"kvm-proxy.js"
,
kvm_proxy_script
=
self
.
createRunningWrapper
(
"kvm-proxy.js"
,
kvm_proxy_script_in
)
kvm_proxy_script_in
)
self
.
path_list
.
append
(
kvm_proxy_script
)
self
.
path_list
.
append
(
kvm_proxy_script
)
# Create wrapper
# Create wrapper
wrapper
=
zc
.
buildout
.
easy_install
.
scripts
([(
wrapper
=
zc
.
buildout
.
easy_install
.
scripts
([(
name
,
'slapos.recipe.librecipe.execute'
,
'executee_wait'
)],
self
.
ws
,
"kvm_frontend"
,
'slapos.recipe.librecipe.execute'
,
'executee_wait'
)],
self
.
ws
,
sys
.
executable
,
self
.
wrapper_directory
,
arguments
=
[
sys
.
executable
,
self
.
wrapper_directory
,
arguments
=
[
self
.
options
[
'node_binary'
].
strip
(),
kvm_proxy_script
,
[
self
.
options
[
'node_binary'
].
strip
(),
kvm_proxy_script
,
ip
,
port
,
key
,
certificate
,
plain_http
,
ip
,
str
(
port
),
key
,
certificate
,
map_file
,
str
(
plain_http
)],
[
key
,
certificate
],
{
'NODE_PATH'
:
self
.
options
[
'node_path'
]}]
{
'NODE_PATH'
:
self
.
options
[
'node_path'
]}]
)[
0
]
)[
0
]
self
.
path_list
.
ext
end
(
wrapper
)
self
.
path_list
.
app
end
(
wrapper
)
return
dict
(
site_url
=
"https://%s:%s/"
%
(
name
,
port
))
return
dict
(
site_url
=
"https://%s:%s/"
%
(
name
,
port
))
slapos/recipe/kvm_frontend/template/kvm-proxy.js
View file @
06402ffa
...
@@ -3,16 +3,14 @@ var fs = require('fs'),
...
@@ -3,16 +3,14 @@ var fs = require('fs'),
colors
=
require
(
'
colors
'
),
colors
=
require
(
'
colors
'
),
http
=
require
(
'
http
'
),
http
=
require
(
'
http
'
),
httpProxy
=
require
(
'
http-proxy
'
),
httpProxy
=
require
(
'
http-proxy
'
),
process
=
require
(
'
process
'
)
proxyByUrl
=
require
(
'
proxy-by-url
'
);
proxyByUrl
=
require
(
'
proxy-by-url
'
);
var
proxyTable
=
'
proxy-table.json
'
,
var
listenInterface
=
process
.
argv
[
2
],
//listenInterface = '2a01:e34:ec03:8610:60c:ceff:fed1:b9fc',
port
=
process
.
argv
[
3
],
listenInterface
=
process
.
argv
[
1
],
sslKeyFile
=
process
.
argv
[
4
],
port
=
process
.
argv
[
2
],
sslCertFile
=
process
.
argv
[
5
],
sslKeyFile
=
process
.
argv
[
3
],
proxyTable
=
process
.
argv
[
6
],
sslCertFile
=
process
.
argv
[
4
],
redirect
=
process
.
argv
[
7
]
||
false
,
redirect
=
process
.
argv
[
5
]
||
false
,
isRawIPv6
;
isRawIPv6
;
isRawIPv6
=
function
checkipv6
(
str
)
{
isRawIPv6
=
function
checkipv6
(
str
)
{
...
@@ -39,10 +37,8 @@ var middlewareVifib = function(req, res, next) {
...
@@ -39,10 +37,8 @@ var middlewareVifib = function(req, res, next) {
// Completely hardcoded rewrite
// Completely hardcoded rewrite
var
vifibPrefix
=
'
/hosting
'
;
var
vifibPrefix
=
'
/hosting
'
;
if
(
req
.
url
.
indexOf
(
vifibPrefix
)
==
0
)
{
if
(
req
.
url
.
indexOf
(
vifibPrefix
)
==
0
)
{
var
hostname
=
'
localhost
'
,
port
=
'
8000
'
;
// Rewrite URL to match virtual host
// Rewrite URL to match virtual host
req
.
url
=
vifibPrefix
+
'
/VirtualHostBase/https/
'
+
hostname
+
'
:
'
+
por
t
+
req
.
url
=
vifibPrefix
+
'
/VirtualHostBase/https/
'
+
req
.
headers
.
hos
t
+
'
/erp5/web_site_module/VirtualHostRoot
'
+
req
.
url
;
'
/erp5/web_site_module/VirtualHostRoot
'
+
req
.
url
;
console
.
log
(
'
Vifib rewrite. New URL is :
'
+
req
.
url
);
console
.
log
(
'
Vifib rewrite. New URL is :
'
+
req
.
url
);
}
}
...
...
slapos/recipe/kvm_frontend/template/proxytable-vifib-snippet.json.in
View file @
06402ffa
"/
domain
": {
"/
hosting
": {
"port":
4443
,
"port":
15000
,
"host":
"vifib
",
"host":
"2a01:e35:2e27:460:e2cb:4eff:fed9:ddd6
",
"https": true
"https": true
}
}
software/kvm-frontend/instance.cfg
View file @
06402ffa
...
@@ -9,7 +9,9 @@ develop-eggs-directory = ${buildout:develop-eggs-directory}
...
@@ -9,7 +9,9 @@ develop-eggs-directory = ${buildout:develop-eggs-directory}
node_path = ${buildout:parts-directory}:${npm-modules:location}/node_modules
node_path = ${buildout:parts-directory}:${npm-modules:location}/node_modules
recipe = ${instance-recipe:egg}:${instance-recipe:module}
recipe = ${instance-recipe:egg}:${instance-recipe:module}
node_binary = ${nodejs:location}/bin/node
node_binary = ${nodejs:location}/bin/node
npm_binary = ${npm:location}/bin/npm
#
npm_binary = ${npm:location}/bin/npm
openssl_binary = ${openssl:location}/bin/openssl
openssl_binary = ${openssl:location}/bin/openssl
dcrond_binary = ${dcron:location}/sbin/crond
dcrond_binary = ${dcron:location}/sbin/crond
logrotate_binary = ${logrotate:location}/usr/sbin/logrotate
rdiff_backup_binary = ${buildout:bin-directory}/rdiff-backup
software/kvm-frontend/software.cfg
View file @
06402ffa
...
@@ -2,15 +2,19 @@
...
@@ -2,15 +2,19 @@
extends =
extends =
../../component/dcron/buildout.cfg
../../component/dcron/buildout.cfg
../../component/logrotate/buildout.cfg
../../component/logrotate/buildout.cfg
../../component/rdiff-backup/buildout.cfg
../../stack/nodejs.cfg
../../stack/nodejs.cfg
parts =
parts =
template
template
nodejs
nodejs
npm
npm
http-proxy
proxy-by-url
dcron
dcron
logrotate
logrotate
rdiff-backup
# Buildoutish
# Buildoutish
eggs
eggs
...
@@ -47,7 +51,7 @@ recipe = slapos.recipe.build:download-unpacked
...
@@ -47,7 +51,7 @@ recipe = slapos.recipe.build:download-unpacked
url = https://nodeload.github.com/desaintmartin/node-http-proxy/zipball/master
url = https://nodeload.github.com/desaintmartin/node-http-proxy/zipball/master
md5sum = 464afcf7a9742f88966b1c5d9164362a
md5sum = 464afcf7a9742f88966b1c5d9164362a
[
node-prox
y-url]
[
proxy-b
y-url]
# https://github.com/dominictarr/proxy-by-url
# https://github.com/dominictarr/proxy-by-url
recipe = slapos.recipe.build:download-unpacked
recipe = slapos.recipe.build:download-unpacked
#XXX-Cedric : use upstream when merged
#XXX-Cedric : use upstream when merged
...
...
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