torquebox-backstage 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +18 -0
- data/Gemfile.lock +69 -0
- data/README.md +164 -0
- data/Rakefile +32 -0
- data/TODO +9 -0
- data/TORQUEBOX_VERSION +1 -0
- data/VERSION +1 -0
- data/backstage.rb +84 -0
- data/bin/backstage +78 -0
- data/config.ru +3 -0
- data/config/torquebox.yml +14 -0
- data/lib/apps.rb +18 -0
- data/lib/apps/models/app.rb +33 -0
- data/lib/apps/routes.rb +18 -0
- data/lib/authentication.rb +64 -0
- data/lib/destinations.rb +21 -0
- data/lib/destinations/models/destination.rb +80 -0
- data/lib/destinations/models/message.rb +67 -0
- data/lib/destinations/models/queue.rb +33 -0
- data/lib/destinations/models/topic.rb +59 -0
- data/lib/destinations/routes.rb +44 -0
- data/lib/has_mbean.rb +59 -0
- data/lib/helpers.rb +142 -0
- data/lib/jobs.rb +19 -0
- data/lib/jobs/models/job.rb +35 -0
- data/lib/jobs/routes.rb +18 -0
- data/lib/message_processors.rb +18 -0
- data/lib/message_processors/models/message_processor.rb +40 -0
- data/lib/message_processors/routes.rb +18 -0
- data/lib/pools.rb +18 -0
- data/lib/pools/models/pool.rb +51 -0
- data/lib/pools/routes.rb +41 -0
- data/lib/resource.rb +53 -0
- data/lib/resource_helpers.rb +63 -0
- data/lib/runtimes.rb +19 -0
- data/lib/runtimes/models/job.rb +35 -0
- data/lib/runtimes/routes.rb +18 -0
- data/lib/services.rb +18 -0
- data/lib/services/models/service.rb +35 -0
- data/lib/services/routes.rb +17 -0
- data/lib/torquebox_managed.rb +36 -0
- data/lib/util.rb +33 -0
- data/spec/api_spec.rb +136 -0
- data/spec/auth_spec.rb +70 -0
- data/spec/spec_helper.rb +39 -0
- data/views/apps/index.haml +15 -0
- data/views/apps/show.haml +12 -0
- data/views/css/_mixins.sass +51 -0
- data/views/css/html5reset.sass +82 -0
- data/views/css/style.sass +152 -0
- data/views/destinations/index.haml +37 -0
- data/views/destinations/show.haml +18 -0
- data/views/jobs/index.haml +23 -0
- data/views/jobs/show.haml +13 -0
- data/views/layout.haml +31 -0
- data/views/message_processors/index.haml +28 -0
- data/views/message_processors/show.haml +12 -0
- data/views/messages/index.haml +20 -0
- data/views/messages/properties.haml +3 -0
- data/views/messages/show.haml +19 -0
- data/views/pools/index.haml +32 -0
- data/views/pools/show.haml +44 -0
- data/views/services/index.haml +21 -0
- data/views/services/show.haml +13 -0
- metadata +289 -0
data/Gemfile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
source :rubygems
|
2
|
+
|
3
|
+
gem "sinatra", "1.1.2"
|
4
|
+
gem "rack-flash"
|
5
|
+
gem 'haml', '~>3.0'
|
6
|
+
gem "jmx", '0.7'
|
7
|
+
gem 'json'
|
8
|
+
gem 'torquebox', '1.0.0.CR1'
|
9
|
+
gem 'tobias-sinatra-url-for'
|
10
|
+
gem 'rack-accept'
|
11
|
+
|
12
|
+
group :development do
|
13
|
+
gem 'thor'
|
14
|
+
gem 'jeweler'
|
15
|
+
gem 'watchr'
|
16
|
+
gem 'rspec'
|
17
|
+
gem 'rack-test'
|
18
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
diff-lcs (1.1.2)
|
5
|
+
git (1.2.5)
|
6
|
+
haml (3.0.25)
|
7
|
+
jeweler (1.5.2)
|
8
|
+
bundler (~> 1.0.0)
|
9
|
+
git (>= 1.2.5)
|
10
|
+
rake
|
11
|
+
jmx (0.7)
|
12
|
+
json (1.5.1-java)
|
13
|
+
rack (1.2.1)
|
14
|
+
rack-accept (0.4.3)
|
15
|
+
rack (>= 0.4)
|
16
|
+
rack-flash (0.1.1)
|
17
|
+
rack
|
18
|
+
rack-test (0.5.7)
|
19
|
+
rack (>= 1.0)
|
20
|
+
rake (0.8.7)
|
21
|
+
rspec (2.5.0)
|
22
|
+
rspec-core (~> 2.5.0)
|
23
|
+
rspec-expectations (~> 2.5.0)
|
24
|
+
rspec-mocks (~> 2.5.0)
|
25
|
+
rspec-core (2.5.1)
|
26
|
+
rspec-expectations (2.5.0)
|
27
|
+
diff-lcs (~> 1.1.2)
|
28
|
+
rspec-mocks (2.5.0)
|
29
|
+
sinatra (1.1.2)
|
30
|
+
rack (~> 1.1)
|
31
|
+
tilt (~> 1.2)
|
32
|
+
thor (0.14.6)
|
33
|
+
tilt (1.2.2)
|
34
|
+
tobias-sinatra-url-for (0.2.1)
|
35
|
+
sinatra (>= 0.9.1.1)
|
36
|
+
torquebox (1.0.0.CR1)
|
37
|
+
torquebox-base (= 1.0.0.CR1)
|
38
|
+
torquebox-messaging (= 1.0.0.CR1)
|
39
|
+
torquebox-naming (= 1.0.0.CR1)
|
40
|
+
torquebox-rake-support (= 1.0.0.CR1)
|
41
|
+
torquebox-vfs (= 1.0.0.CR1)
|
42
|
+
torquebox-web (= 1.0.0.CR1)
|
43
|
+
torquebox-base (1.0.0.CR1-java)
|
44
|
+
torquebox-messaging (1.0.0.CR1-java)
|
45
|
+
torquebox-base (= 1.0.0.CR1)
|
46
|
+
torquebox-naming (= 1.0.0.CR1)
|
47
|
+
torquebox-naming (1.0.0.CR1-java)
|
48
|
+
torquebox-rake-support (1.0.0.CR1)
|
49
|
+
torquebox-vfs (1.0.0.CR1-java)
|
50
|
+
torquebox-web (1.0.0.CR1-java)
|
51
|
+
watchr (0.7)
|
52
|
+
|
53
|
+
PLATFORMS
|
54
|
+
java
|
55
|
+
|
56
|
+
DEPENDENCIES
|
57
|
+
haml (~> 3.0)
|
58
|
+
jeweler
|
59
|
+
jmx (= 0.7)
|
60
|
+
json
|
61
|
+
rack-accept
|
62
|
+
rack-flash
|
63
|
+
rack-test
|
64
|
+
rspec
|
65
|
+
sinatra (= 1.1.2)
|
66
|
+
thor
|
67
|
+
tobias-sinatra-url-for
|
68
|
+
torquebox (= 1.0.0.CR1)
|
69
|
+
watchr
|
data/README.md
ADDED
@@ -0,0 +1,164 @@
|
|
1
|
+
# TorqueBox BackStage #
|
2
|
+
|
3
|
+
BackStage is a Sinatra application that when deployed into a TorqueBox
|
4
|
+
server gives you visibility into the apps, queues, topics, message
|
5
|
+
processors, jobs, and services, allowing you to browse settings and stats,
|
6
|
+
and exposes some actions to allow you to change the operational state of
|
7
|
+
the components:
|
8
|
+
|
9
|
+
* pause/resume queues and topics
|
10
|
+
* stop/start message processors, services, and jobs
|
11
|
+
* execute debug ruby code inside a runtime pool
|
12
|
+
* view stats on all of the above
|
13
|
+
|
14
|
+
In addition, BackStage allows you to browse messages on a queue, and hides
|
15
|
+
some of the underlying complexity of how topics are implemented in HornetQ.
|
16
|
+
|
17
|
+
It basically acts as an friendly overlay for JMX, so is very easy to
|
18
|
+
extend if there is more data you want to see. The data/actions that are
|
19
|
+
available from BackStage are also available from `/jmx-console` (with
|
20
|
+
the exception of queue message browsing), but are more accessible in
|
21
|
+
BackStage.
|
22
|
+
|
23
|
+
## Authentication ##
|
24
|
+
|
25
|
+
By default, access to BackStage is wide open. You can secure it by setting
|
26
|
+
`REQUIRE_AUTHENTICATION: true` in the environment section of `torquebox.yml`:
|
27
|
+
|
28
|
+
environment:
|
29
|
+
REQUIRE_AUTHENTICATION: true
|
30
|
+
|
31
|
+
This will enable basic JAAS authentication through TorqueBox. Use the
|
32
|
+
rake task to add usernames and password:
|
33
|
+
|
34
|
+
$ rake torquebox:auth:adduser CREDENTIALS=username:password
|
35
|
+
|
36
|
+
## Installation ##
|
37
|
+
|
38
|
+
BackStage can either be installed and deployed as a gem, or deployed from the
|
39
|
+
application source.
|
40
|
+
|
41
|
+
### As A Gem ###
|
42
|
+
|
43
|
+
|
44
|
+
First, install the gem:
|
45
|
+
|
46
|
+
jruby -S gem install torquebox-backstage
|
47
|
+
|
48
|
+
*Note:* the torquebox-backstage gem cannot be made available on rubygems.org
|
49
|
+
until an official release of the torquebox gems is made. Until then, you will
|
50
|
+
need to check out the source and run `jruby -S rake install` to install the gem.
|
51
|
+
|
52
|
+
Then, deploy backstage using the `backstage` command. You can deploy with security
|
53
|
+
disabled:
|
54
|
+
|
55
|
+
jruby -S backstage deploy
|
56
|
+
|
57
|
+
Or enable security by providing a username/password pair:
|
58
|
+
|
59
|
+
jruby -S backstage deploy --secure=username:password
|
60
|
+
|
61
|
+
### From Source ###
|
62
|
+
|
63
|
+
Clone the [git repo](https://github.com/torquebox/backstage),
|
64
|
+
then run bundler to install the needed gems (listed in the
|
65
|
+
[Gemfile](https://github.com/torquebox/backstage/blob/master/Gemfile)):
|
66
|
+
|
67
|
+
jruby -S gem install bundler # if you haven't done so already
|
68
|
+
jruby -S bundle install
|
69
|
+
|
70
|
+
Once that's done, you can either deploy a deployment descriptor pointing at
|
71
|
+
the checked out repo:
|
72
|
+
|
73
|
+
jruby -S rake torquebox:deploy
|
74
|
+
|
75
|
+
or archive and deploy it as a .knob (zipfile):
|
76
|
+
|
77
|
+
jruby -S rake torquebox:deploy:archive
|
78
|
+
|
79
|
+
By default, BackStage is deployed to the `/backstage` context (see the `context:`
|
80
|
+
setting in `torquebox.yml`).
|
81
|
+
|
82
|
+
## API ##
|
83
|
+
|
84
|
+
BackStage also provides a RESTful API that allows you to access almost any of the
|
85
|
+
data or actions of the web UI (browsing messages via the API is not yet available).
|
86
|
+
The API provides a top level entry point at `/api` that returns a list of collection
|
87
|
+
urls. The data is returned as JSON, and you must either pass `format=json` as a
|
88
|
+
query parameter, or set the `Accept:` header to `application/json`. `/api` always
|
89
|
+
returns JSON, no matter what `Accept:` header or format param you use, and all of
|
90
|
+
the urls returned in the JSON include the `format=json` parameter.
|
91
|
+
|
92
|
+
### Example ###
|
93
|
+
|
94
|
+
First, we retrieve the API entry point:
|
95
|
+
|
96
|
+
curl http://localhost:8080/backstage/api
|
97
|
+
|
98
|
+
Returns:
|
99
|
+
|
100
|
+
{
|
101
|
+
"collections":{
|
102
|
+
"apps":"http://localhost:8080/backstage/apps?format=json",
|
103
|
+
"queues":"http://localhost:8080/backstage/queues?format=json",
|
104
|
+
"topics":"http://localhost:8080/backstage/topics?format=json",
|
105
|
+
"message_processors":"http://localhost:8080/backstage/message_processors?format=json",
|
106
|
+
"jobs":"http://localhost:8080/backstage/jobs?format=json",
|
107
|
+
"services":"http://localhost:8080/backstage/services?format=json"
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
Then, we'll use the url for services to retrieve the service index:
|
112
|
+
|
113
|
+
curl http://localhost:8080/backstage/services?format=json
|
114
|
+
|
115
|
+
Returns:
|
116
|
+
|
117
|
+
[
|
118
|
+
{
|
119
|
+
"resource":"http://localhost:8080/backstage/service/dG9ycXVlYm94LnNlcnZpY2VzOmFwcD1raXRjaGVuLXNpbmsudHJxLG5hbWU9QVNlcnZpY2U=?format=json",
|
120
|
+
"name":"AService",
|
121
|
+
"app":"http://localhost:8080/backstage/app/dG9ycXVlYm94LmFwcHM6YXBwPWtpdGNoZW4tc2luay50cnE=?format=json",
|
122
|
+
"app_name":"kitchen-sink",
|
123
|
+
"status":"Started",
|
124
|
+
"actions":{
|
125
|
+
"stop":"http://localhost:8080/backstage/service/dG9ycXVlYm94LnNlcnZpY2VzOmFwcD1raXRjaGVuLXNpbmsudHJxLG5hbWU9QVNlcnZpY2U=/stop?format=json"
|
126
|
+
}
|
127
|
+
}
|
128
|
+
]
|
129
|
+
|
130
|
+
Each index entry contains the full contents of the entry, along with URL
|
131
|
+
to access the resource itself. URLs to associated resources are included as
|
132
|
+
well (the app in this case).
|
133
|
+
|
134
|
+
If a resource has actions that can be performed on it, they will appear in
|
135
|
+
the results under `actions`. Action urls must be called via POST, and
|
136
|
+
return the JSON encoded resource:
|
137
|
+
|
138
|
+
curl -X POST http://localhost:8080/backstage/service/dG9ycXVlYm94LnNlcnZpY2VzOmFwcD1raXRjaGVuLXNpbmsudHJxLG5hbWU9QVNlcnZpY2U=/stop?format=json
|
139
|
+
|
140
|
+
Returns:
|
141
|
+
|
142
|
+
{
|
143
|
+
"resource":"http://localhost:8080/backstage/service/dG9ycXVlYm94LnNlcnZpY2VzOmFwcD1raXRjaGVuLXNpbmsudHJxLG5hbWU9QVNlcnZpY2U=?format=json",
|
144
|
+
"name":"AService",
|
145
|
+
"app":"http://localhost:8080/backstage/app/dG9ycXVlYm94LmFwcHM6YXBwPWtpdGNoZW4tc2luay50cnE=?format=json",
|
146
|
+
"app_name":"kitchen-sink",
|
147
|
+
"status":"Stopped",
|
148
|
+
"actions":{
|
149
|
+
"start'":"http://localhost:8080/backstage/service/dG9ycXVlYm94LnNlcnZpY2VzOmFwcD1raXRjaGVuLXNpbmsudHJxLG5hbWU9QVNlcnZpY2U=/start'?format=json"
|
150
|
+
}
|
151
|
+
}
|
152
|
+
|
153
|
+
## Contributing ##
|
154
|
+
|
155
|
+
Bug reports, feature requests, and patches are always welcome! See
|
156
|
+
http://torquebox.org/community/ on how to get in touch with the TorqueBox
|
157
|
+
crew.
|
158
|
+
|
159
|
+
## License ##
|
160
|
+
|
161
|
+
Copyright 2011 Red Hat, Inc.
|
162
|
+
|
163
|
+
Licensed under the Apache Software License version 2. See
|
164
|
+
http://www.apache.org/licenses/LICENSE-2.0 for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'rake'
|
11
|
+
require 'torquebox-rake-support'
|
12
|
+
|
13
|
+
require 'jeweler'
|
14
|
+
Jeweler::Tasks.new do |gem|
|
15
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
16
|
+
gem.name = "torquebox-backstage"
|
17
|
+
gem.homepage = "http://github.com/torquebox/backstage"
|
18
|
+
gem.license = "MIT"
|
19
|
+
gem.summary = %Q{BackStage - Queue/Topic/Job viewer for TorqueBox}
|
20
|
+
gem.description = %Q{BackStage - Queue/Topic/Job viewer for TorqueBox}
|
21
|
+
gem.email = "tcrawley@redhat.com"
|
22
|
+
gem.authors = ["Tobias Crawley"]
|
23
|
+
gem.files = FileList["[A-Z]*", 'backstage.rb', 'config.ru', 'bin/*.rb', "{config,lib,spec,views}/**/*"]
|
24
|
+
gem.executables = %w{backstage}
|
25
|
+
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
26
|
+
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
27
|
+
gem.add_runtime_dependency 'thor', '> 0.14'
|
28
|
+
gem.add_runtime_dependency 'bundler', '> 1.0.12'
|
29
|
+
end
|
30
|
+
Jeweler::RubygemsDotOrgTasks.new
|
31
|
+
|
32
|
+
|
data/TODO
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
TODO
|
2
|
+
|
3
|
+
* allow queue browsing from the API
|
4
|
+
* link queues/topics to their apps
|
5
|
+
* see how backstage behaves in a cluster
|
6
|
+
* allow resending DLQ and ExpiryQueue messages
|
7
|
+
* store failure backtraces for jobs/tasks in TorqueBox, and display here
|
8
|
+
* improve test coverage
|
9
|
+
* add stats collection, with memory usage and other bits? ruby runtime stats?
|
data/TORQUEBOX_VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0.RC1-SNAPSHOT
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/backstage.rb
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2011 Red Hat, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require 'bundler/setup'
|
18
|
+
require 'sinatra/base'
|
19
|
+
require 'rack-flash'
|
20
|
+
require 'rack/accept'
|
21
|
+
require 'haml'
|
22
|
+
require 'sass'
|
23
|
+
require 'jmx'
|
24
|
+
|
25
|
+
$:.unshift File.join( File.dirname( __FILE__ ), 'lib' )
|
26
|
+
|
27
|
+
require 'torquebox'
|
28
|
+
require 'resource_helpers'
|
29
|
+
require 'resource'
|
30
|
+
require 'helpers'
|
31
|
+
require 'has_mbean'
|
32
|
+
require 'torquebox_managed'
|
33
|
+
require 'pools'
|
34
|
+
require 'apps'
|
35
|
+
require 'destinations'
|
36
|
+
require 'message_processors'
|
37
|
+
require 'jobs'
|
38
|
+
require 'services'
|
39
|
+
|
40
|
+
|
41
|
+
puts "ENV['REQUIRE_AUTHENTICATION'] is not set, *disabling* authentication" unless ENV['REQUIRE_AUTHENTICATION']
|
42
|
+
|
43
|
+
module Backstage
|
44
|
+
BACKSTAGE_VERSION = File.readlines( File.join( File.dirname( __FILE__ ), 'VERSION' ) ).first.strip
|
45
|
+
TORQUEBOX_VERSION = File.readlines( File.join( File.dirname( __FILE__ ), 'TORQUEBOX_VERSION' ) ).first.strip
|
46
|
+
|
47
|
+
class Application < Sinatra::Base
|
48
|
+
enable :logging, :sessions
|
49
|
+
use Rack::Accept
|
50
|
+
use Rack::Flash
|
51
|
+
|
52
|
+
include Backstage::Authentication
|
53
|
+
|
54
|
+
set :views, Proc.new { File.join( File.dirname( __FILE__ ), "views" ) }
|
55
|
+
|
56
|
+
before do
|
57
|
+
require_authentication if ENV['REQUIRE_AUTHENTICATION']
|
58
|
+
end
|
59
|
+
|
60
|
+
get '/api' do
|
61
|
+
content_type :json
|
62
|
+
|
63
|
+
{
|
64
|
+
:collections => [:pools, :apps, :queues, :topics, :message_processors, :jobs, :services].inject({}) do |collections, collection|
|
65
|
+
collections[collection] = json_url_for( collection_path( collection ) )
|
66
|
+
collections
|
67
|
+
end
|
68
|
+
}.to_json
|
69
|
+
end
|
70
|
+
|
71
|
+
get '/' do
|
72
|
+
redirect_to collection_path( :apps )
|
73
|
+
end
|
74
|
+
|
75
|
+
get '/css/style.css' do
|
76
|
+
sass :'css/style'
|
77
|
+
end
|
78
|
+
|
79
|
+
get '/css/html5reset.css' do
|
80
|
+
sass :'css/html5reset'
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
end
|
data/bin/backstage
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
#!/usr/bin/env jruby
|
2
|
+
#-*-ruby-*-
|
3
|
+
#
|
4
|
+
# Copyright 2011 Red Hat, Inc.
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
require 'thor'
|
19
|
+
require 'torquebox-rake-support'
|
20
|
+
|
21
|
+
class BackstageCommand < Thor
|
22
|
+
|
23
|
+
DEPLOYMENT_NAME = 'backstage-knob.yml'
|
24
|
+
|
25
|
+
desc "deploy [--secure=username:password[,username:password]*]", "Deploys backstage to $TORQUEBOX_HOME/apps"
|
26
|
+
method_option :secure, :type => :hash, :default => nil
|
27
|
+
def deploy
|
28
|
+
check
|
29
|
+
descriptor = TorqueBox::DeployUtils.basic_deployment_descriptor( :root => root_dir,
|
30
|
+
:env => 'production' )
|
31
|
+
if options[:secure]
|
32
|
+
descriptor['environment'] = { 'REQUIRE_AUTHENTICATION' => true }
|
33
|
+
credentials = []
|
34
|
+
options[:secure].each do |user, pass|
|
35
|
+
credentials << [user, pass]
|
36
|
+
end
|
37
|
+
prop_file = TorqueBox::DeployUtils.write_credentials( credentials )
|
38
|
+
puts ">> Wrote user/password entries to #{prop_file}"
|
39
|
+
else
|
40
|
+
puts ">> WARNING: deploying BackStage with no security - use the --secure=username:password option to secure it"
|
41
|
+
end
|
42
|
+
|
43
|
+
name, dir = TorqueBox::DeployUtils.deploy_yaml( descriptor, DEPLOYMENT_NAME )
|
44
|
+
|
45
|
+
puts ">> Deployed #{name} to #{dir}"
|
46
|
+
end
|
47
|
+
|
48
|
+
desc "undeploy", "Removes backstage from $TORQUEBOX_HOME/apps"
|
49
|
+
def undeploy
|
50
|
+
check
|
51
|
+
name, dir = TorqueBox::DeployUtils.undeploy( DEPLOYMENT_NAME )
|
52
|
+
|
53
|
+
puts ">> Undeployed #{name} from #{dir}"
|
54
|
+
end
|
55
|
+
|
56
|
+
desc "info", "Prints info about BackStage's status"
|
57
|
+
def info
|
58
|
+
check
|
59
|
+
path = File.join( ENV['TORQUEBOX_HOME'], 'apps', DEPLOYMENT_NAME )
|
60
|
+
if File.exists?( path )
|
61
|
+
puts ">> BackStage deployed to #{path}"
|
62
|
+
else
|
63
|
+
puts ">> BackStage is not deployed"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
protected
|
68
|
+
def check
|
69
|
+
raise Exception.new("$TORQUEBOX_HOME must be set") unless ENV['TORQUEBOX_HOME']
|
70
|
+
end
|
71
|
+
|
72
|
+
def root_dir
|
73
|
+
File.expand_path( File.join( File.dirname( __FILE__ ), '..' ) )
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
BackstageCommand.start
|