Add sunstone appenv/apptools plugins and routes. (and images).

This commit is contained in:
Hector Sanjuan committed 2012-09-13 15:23:55 +02:00
1 parent 42331dec55
commit 4e695568f6
7 files changed
+1262

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

File diff suppressed because it is too large. Load diff
@@ -0,0 +1,95 @@
//--------------------------------------------------------------------------//
// Copyright 2010-2012, C12G Labs S.L. //
// //
// Licensed under the C12G Commercial Open-source License (the //
// "License"); you may not use this file except in compliance //
// with the License. You may obtain a copy of the License as part //
// of the software distribution. //
// //
// Unless agreed to in writing, software distributed under the //
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES //
// OR CONDITIONS OF ANY KIND, either express or implied. See the //
// License for the specific language governing permissions and //
// limitations under the License. //
//--------------------------------------------------------------------------//
var apptools_dashboard_tmpl = '\
<table class="dashboard_table" id="apptools_dashboard">\
<tr>\
<td style="width:50%">\
<table style="width:100%">\
<tr>\
<td>\
<div class="panel">\
<h3>' + tr("AppTools") + '</h3>\
<div class="panel_info">\
\
<p class="dashboard_p"><img src="images/apptools_icon.png" height="80px" style="float:right;margin:15px 15px;" alt="apptools logo"/>AppTools is a group of tools for users and administrators of OpenNebula clouds to simplify and optimize application management. These tools enable the building, distribution and execution of multi-tier applications.</p>\
\
<ul>\
<li>AppEnv performs the automatic installation and configuration of the software stack that constitute an application environment</li>\
<li>AppFlow enables the automatic execution of multi-tiered applications composed of interconnected applications</li>\
<li>AppPlace builds a centralized catalog of virtual appliances to easily share and distribute applications across OpenNebula instances</li>\
</ul>\
\
<p class="dashboard_p">AppTools fills the gap between the application and the virtual infrastructure layer. While OpenNebula manages the execution of the virtual infrastructure, being fully application agnostic, AppTools manages the application being executed within the virtual infrastructure. AppTools leverages the OpenNebula contextualization framework and external APIs.</p>\
\
</div>\
</div>\
</td>\
</tr>\
</table>\
</td>\
<td style="width:50%">\
<table id="table_right" style="width:100%">\
<tr>\
<td>\
<div class="panel">\
<h3>' + tr("AppEnv - A tool to manage environments") + '</h3>\
<div class="panel_info">\
\
<p class="dashboard_p"><img src="images/appenv_icon.png" height="64px" style="float:right;margin:15px 63px 15px 15px;" alt="appenv logo"/>Installing services can sometimes be tedious. Getting the VM ins good shape, installing the packages needed, deploying the application and configuring it. On case of disaster or scaling the service you will need to perform again these tasks. To automate all this burden we now have Configuration Management software like <a target="_blank" href="http://www.opscode.com/chef/">Chef</a>, <a target="_blank" href="http://puppetlabs.com/puppet/what-is-puppet/">Puppet</a> or <a target="_blank" href="http://cfengine.com/">CFEngine</a>.</p>\
\
<p class="dashboard_p">With this software we can script the installation and configuration of applications and services. You can also describe the services and their configuration that will be installed on a node so we can automate its installation. We will also be sure that each installation will be equal to other using the same configuration.</p>\
\
<p class="dashboard_p">The tool oneenv will make use of <a target="_blank" href="http://wiki.opscode.com/display/chef/Chef+Solo">Chef-solo</a>. It lets you register chef configurations and instantiate them using predefined templates and images.</p>\
\
</div>\
</div>\
</td>\
</tr>\
<tr>\
<td>\
<div class="panel">\
<h3>' + tr("AppFlow - Service deployment") + '</h3>\
<div class="panel_info">\
<p class="dashboard_p"><img src="images/appflow_icon.png" height="64px" style="float:right;margin:15px 63px 15px 15px;" alt="appflow logo"/>App flow desc</p>\
<p class="dashboard_p">bla</p>\
<p class="dashboard_p">blabla</p>\
</div>\
</div>\
</td>\
</tr>\
<tr>\
<td>\
<div class="panel">\
<h3>' + tr("AppMarket - Image repository") + '</h3>\
<div class="panel_info">\
<p class="dashboard_p"><img src="images/appmarket_icon.png" height="64px" style="float:right;margin:15px 15px;" alt="appflow logo"/>App flow desc</p>\
<p class="dashboard_p">bla</p>\
<p class="dashboard_p">blabla</p>\
</div>\
</div>\
</td>\
</tr>\
</table>\
</td>\
</tr></table>';
var apptools_tab = {
title: '<i class="icon-briefcase"></i>AppTools',
content: apptools_dashboard_tmpl,
}
Sunstone.addMainTab('apptools_tab',apptools_tab);
+149
View File
@@ -0,0 +1,149 @@
# -------------------------------------------------------------------------- #
# Copyright 2010-2012, C12G Labs S.L. #
# #
# Licensed under the C12G Commercial Open-source License (the #
# "License"); you may not use this file except in compliance #
# with the License. You may obtain a copy of the License as part #
# of the software distribution. #
# #
# Unless agreed to in writing, software distributed under the #
# License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES #
# OR CONDITIONS OF ANY KIND, either express or implied. See the #
# License for the specific language governing permissions and #
# limitations under the License. #
#--------------------------------------------------------------------------- #
require 'apptools/env/onechef.rb'
# Name for the resource.
#Used to generate correct <RESOURCE_POOL><RESOURCE>... tags
RESOURCE = 'APPENV'
helpers do
def client
settings.cloud_auth.client(session[:user])
end
def appenv_to_json(resource)
{ "#{RESOURCE}" => resource.to_hash['DOCUMENT']}.to_json
end
def appenv_pool
pool = OpenNebula::ChefDocPool.new(client())
rc = pool.info
return [500, rc.to_json] if OpenNebula.is_error?(rc)
# Pool comes in <DOCUMENT_POOL><DOCUMENT>...
# Need to set the resource type correctly to $RESOURCE
appenv_pool = { "#{RESOURCE}_POOL" => {}}
pool.each do | elem |
hash = elem.to_hash['DOCUMENT']
appenv_pool["#{RESOURCE}_POOL"]["#{RESOURCE}"] ||= []
appenv_pool["#{RESOURCE}_POOL"]["#{RESOURCE}"] << hash
end
[200, appenv_pool.to_json]
end
def appenv_create(template)
node = OpenNebula::ChefConf.new
node.name = template['name']
node.description = template['description'] if template['description']
node.cookbooks = template['cookbooks'] if template['cookbacks']
node.templates = template['templates'] if template['templates']
#variables currently unused
node.variables = template['variables'] if template['variables']
node.node = template['node'] if template['node']
client = settings.cloud_auth.client(session[:user])
doc = node.save(client)[0]
if OpenNebula.is_error?(doc)
return [500, doc.to_json]
end
doc.info
[201, appenv_to_json(doc)]
end
def appenv_retrieve(id)
resource = OpenNebula::ChefDoc.new_with_id(id, client())
rc = resource.info
return [404, rc.to_json] if OpenNebula.is_error?(rc)
[200, appenv_to_json(resource)]
end
def appenv_update(resource, template)
node = resource.node
node.node = template['node'] if template['node']
node.templates = template['templates']
node.cookbooks = template['cookbooks']
resource.update(node.to_json)
end
def appenv_action(id, action_hash)
resource = OpenNebula::ChefDoc.new_with_id(id,client())
rc = resource.info
if OpenNebula.is_error?(rc)
return [404, rc.to_json]
end
params = action_hash['params']
rc = case action_hash['perform']
when "chown" then resource.chown(params['owner_id'].to_i,
params['group_id'].to_i)
when "chmod" then resource.chmod_octet(params['octet'])
when "update" then appenv_update(resource, params[RESOURCE])
when "instantiate" then resource.instantiate(params['template_id'],
params['vars'])
else
error_msg = "#{action_hash['perform']} action not " <<
" available for this resource"
return [500, OpenNebula::Error.new(error_msg).to_json]
end
return [500, rc.to_json] if OpenNebula.is_error?(rc)
[204, appenv_to_json(resource)]
end
def appenv_delete(id)
resource = OpenNebula::ChefDoc.new_with_id(id, client())
rc = resource.delete
return [500, rc.to_json] if OpenNebula.is_error?(rc)
204
end
end
################################################################
# PLUGIN ROUTES
################################################################
get '/appenv' do
appenv_pool()
end
post '/appenv' do
template = parse_json(request.body.read, RESOURCE)
appenv_create(template)
end
get '/appenv/:id' do
appenv_retrieve(params[:id].to_i)
end
post '/appenv/:id/action' do
action_hash = parse_json(request.body.read, 'action')
if OpenNebula.is_error?(action_hash)
return [500, action_hash.to_json]
end
appenv_action(params[:id].to_i, action_hash)
end
delete '/appenv/:id' do
appenv_delete(params[:id].to_i)
end