feature #1660: appmarket: Add reverse proxy support

This commit is contained in:
Daniel Molina committed 2012-11-16 17:59:03 +01:00
1 parent b6e1bf8ae4
commit f26e0870cd
10 files changed
+52 -40

No files matched your search

+12
View File
@@ -21,6 +21,18 @@
db_host: localhost
db_port: 27017
# Define this parameter if the AppMarket is running under a reverse proxy
# Example: Apache
# <VirtualHost *:80>
# ...
# ProxyPass /market/ http://localhost:6242/
# ProxyPassReverse /market/ http://localhost:6242/
# </VirtualHost>
#
# :proxy_path: '/market/'
#
:proxy_path: '/'
# Admin credentials. This will be the user that will be used in the
# bootstrap process the first time the server is started
user:
+5 -3
View File
@@ -63,6 +63,8 @@ configure do
set :bind, CONF[:host]
set :port, CONF[:port]
set :root_path, (CONF[:proxy_path]||'/')
set :config, CONF
end
@@ -84,7 +86,7 @@ end
before do
if request.env['PATH_INFO'] == '/'
redirect '/appliance'
redirect to(settings.root_path + 'appliance')
end
if request.path != '/login' && request.path != '/logout'
@@ -98,7 +100,7 @@ before do
if request.env["HTTP_ACCEPT"] && request.env["HTTP_ACCEPT"].split(',').grep(/text\/html/).empty?
error 401, "User not authorized"
else
redirect '/appliance'
redirect to(settings.root_path + 'appliance')
end
end
end
@@ -115,7 +117,7 @@ end
post '/logout' do
session.clear
redirect '/appliance'
redirect to(settings.root_path + 'appliance')
end
#
+1 -1
View File
@@ -87,7 +87,7 @@
"sDom": "t<'row'<'span6'i><'span6'p>>",
"bProcessing": false,
"sPaginationType": "bootstrap",
"sAjaxSource": "/appliance",
"sAjaxSource": "appliance",
"sAjaxDataProp": "appliances",
"bAutoWidth": false,
"iDisplayLength": 50,
+3 -3
View File
@@ -16,7 +16,7 @@
.navbar.navbar-static
.navbar-inner
.container
%a.brand{'href' => "/"} Appliances
%a.brand{'href' => "#{settings.root_path}appliance"} Appliances
= haml :nav_login
.container-fluid
@@ -24,7 +24,7 @@
.span8
.brand= @app['name']
.span4
%a.pull-right{'href' => "/"}
%a.pull-right{'href' => "#{settings.root_path}appliance"}
%i.icon-search.icon-arrow-left
Click to go back
.row-fluid
@@ -157,7 +157,7 @@
url: "#",
type: "DELETE",
success: function(){
window.location.href = "/";
window.location.reload();
},
error: function(){
return true;
+7 -9
View File
@@ -29,15 +29,13 @@
%p
%a{'data-toggle' => 'modal', 'href' => '#post_your_appliance_banner'} Learn more
.span4
:plain
<h1><i class="icon-retweet icon-white"></i> Integrated in OpenNebula</h1>
<ul class="thumbnails">
<li>
<a href="http://www.opennebula.org/documentation:documentation:marketplace" target="blank" class="thumbnail span10">
<img src="/img/marketsunstone.png" alt="">
</a>
</li>
</ul>
%h1
%i.icon-retweet.icon-white
Integrated in OpenNebula
%ul.thumbnails
%li
%a.thumbnail.span10{'target'=>'blank', 'href'=>'http://www.opennebula.org/documentation:documentation:marketplace'}
%img{'src'=>"#{settings.root_path}img/marketsunstone.png", 'alt'=>''}
.modal.hide.fade#appliance_banner
.modal-header
+2 -2
View File
@@ -14,6 +14,6 @@
//--------------------------------------------------------------------------//
%a.span4{'href' => "http://www.opennebula.org/"}
%img{'src' => "/img/opennebula_gray.png"}
%img{'src' => "#{settings.root_path}img/opennebula_gray.png"}
%a.pull-right{'href' => "http://www.c12g.com/"}
%img{'src' => "/img/c12g.png"}
%img{'src' => "#{settings.root_path}img/c12g.png"}
+8 -8
View File
@@ -17,14 +17,14 @@
%html{:lang => "en"}
%head
%meta{:charset => "utf-8"}
%script{:type => "text/javascript", :src => "/js/jquery-1.7.2.min.js"}
%script{:type => "text/javascript", :src => "/js/jquery.dataTables.min.js"}
%script{:type => "text/javascript", :src => "/js/bootstrap.min.js"}
%script{:type => "text/javascript", :src => "/js/market.js"}
%link{:rel=>'stylesheet', :href=>'/css/bootstrap.min.css', :type => "text/css"}
%link{:rel=>'stylesheet', :href=>'/css/market.css', :type => "text/css"}
%link{:rel=>'stylesheet', :href=>'/css/font-awesome.css', :type => "text/css"}
%link{:rel => "icon", :type => "image/png", :href => "/favicon.ico"}
%script{:type => "text/javascript", :src => "#{settings.root_path}js/jquery-1.7.2.min.js"}
%script{:type => "text/javascript", :src => "#{settings.root_path}js/jquery.dataTables.min.js"}
%script{:type => "text/javascript", :src => "#{settings.root_path}js/bootstrap.min.js"}
%script{:type => "text/javascript", :src => "#{settings.root_path}js/market.js"}
%link{:rel=>'stylesheet', :href=>"#{settings.root_path}css/bootstrap.min.css", :type => "text/css"}
%link{:rel=>'stylesheet', :href=>"#{settings.root_path}css/market.css", :type => "text/css"}
%link{:rel=>'stylesheet', :href=>"#{settings.root_path}css/font-awesome.css", :type => "text/css"}
%link{:rel => "icon", :type => "#{settings.root_path}image/png", :href => "/favicon.ico"}
%body
.container
+8 -8
View File
@@ -53,7 +53,7 @@
%a{'data-toggle' => 'modal', 'href' => '#create_app'} Create new Appliance
- if @session.admin?
%li
%a{'href' => '/user'} Manage Users
%a{'href' => 'user'} Manage Users
%li.divider
%li
%input.btn.btn-danger.pull-right#logout_btn{'type' => 'button', "value" => "Sign out"}
@@ -105,11 +105,11 @@
$(document).ready(function() {
$("#create_app_form").submit(function (){
$.ajax({
url: "/appliance",
url: "appliance",
type: "POST",
data: JSON.stringify($("#create_app_form").serializeObject()),
success: function(){
window.location.href = "/";
window.location.reload();
},
error: function(response){
alert(response.responseText);
@@ -137,7 +137,7 @@
}
$.ajax({
url: "/user",
url: "user",
type: "POST",
data: JSON.stringify($("form").serializeObject()),
success: function(){
@@ -160,14 +160,14 @@
var remember = $("#user_remember_me").is(":checked");
$.ajax({
url: "/login",
url: "login",
type: "POST",
data: {remember: remember},
beforeSend : function(req) {
req.setRequestHeader( "Authorization", "Basic " + btoa(username + ":" + password))
},
success: function(){
window.location.href = "/";
window.location.reload();
},
error: function(response){
alert("The username or password you entered is incorrect");
@@ -181,10 +181,10 @@
$("#logout_btn").click(function (){
$.ajax({
url: "/logout",
url: "logout",
type: "POST",
success: function(){
window.location.href = "/";
window.location.reload();
},
error: function(){
return true;
+3 -3
View File
@@ -16,7 +16,7 @@
.navbar.navbar-static
.navbar-inner
.container
%a.brand{'href' => "/"} Appliances
%a.brand{'href' => "#{settings.root_path}appliance"} Appliances
= haml :nav_login
%table{'class' => "table table-striped", 'id' => "users"}
@@ -38,7 +38,7 @@
"sDom": "t<'row'<'span6'i><'span6'p>>",
"bProcessing": false,
"sPaginationType": "bootstrap",
"sAjaxSource": "/user",
"sAjaxSource": "user",
"sAjaxDataProp": "users",
"bAutoWidth": false,
"iDisplayLength": 50,
@@ -51,7 +51,7 @@
{ "mDataProp": "status" },
{ "mDataProp": "_id.$oid",
"fnRender": function ( o ) {
more_info = '<a id="more_info" class="btn btn-inverse btn-mini pull-right" href="/user/' + o.aData["_id"]["$oid"]+ '">'+
more_info = '<a id="more_info" class="btn btn-inverse btn-mini pull-right" href="user/' + o.aData["_id"]["$oid"]+ '">'+
'<i class="icon-info-sign icon-white"></i>'+
' More Info</a>'
return more_info
+3 -3
View File
@@ -16,12 +16,12 @@
.navbar.navbar-static
.navbar-inner
.container
%a.brand{'href' => "/user"} Users
%a.brand{'href' => "#{settings.root_path}user"} Users
= haml :nav_login
.container-fluid
.row-fluid
%a.pull-right{'href' => "/user"}
%a.pull-right{'href' => "#{settings.root_path}user"}
%i.icon-search.icon-arrow-left
Click to go back
.row-fluid
@@ -108,7 +108,7 @@
url: "#",
type: "DELETE",
success: function(){
window.location.href = "/user";
history.go(-1)
},
error: function(response){
alert(response.responseText);