trinidad_sandbox_extension 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +9 -0
- data/README +39 -9
- data/lib/trinidad_sandbox_extension.rb +1 -1
- data/lib/trinidad_sandbox_extension/app/sandbox.rb +28 -0
- data/lib/trinidad_sandbox_extension/app/views/layout.html.haml +1 -1
- data/trinidad-libs/trinidad-sandbox-extension.jar +0 -0
- data/trinidad_sandbox_extension.gemspec +4 -3
- metadata +39 -47
data/History.txt
ADDED
data/README
CHANGED
@@ -3,16 +3,46 @@ Trinidad sandbox extension
|
|
3
3
|
|
4
4
|
# DESCRIPTION
|
5
5
|
|
6
|
-
|
6
|
+
Trinidad's management console and REST api.
|
7
7
|
|
8
|
-
This extension
|
9
|
-
list of the applications loaded on Trinidad.
|
8
|
+
This extension adds a management console to a Trinidad's instance moreover a rest api to access the applications running on top of it.
|
10
9
|
|
11
|
-
# TODO
|
12
10
|
|
13
|
-
|
11
|
+
# INSTALL
|
12
|
+
|
13
|
+
jruby -S gem install trinidad_sandbox_extension
|
14
|
+
|
15
|
+
# CONFIGURATION
|
16
|
+
|
17
|
+
The extension has to be added within the section "extensions" into the Trinidad's configuration file:
|
18
|
+
|
19
|
+
---
|
20
|
+
extensions:
|
21
|
+
sandbox:
|
22
|
+
|
23
|
+
This extension is also a Sinatra web application running on top of Trinidad, so any application configuration parameter is also valid here.
|
24
|
+
For instance, we can modify the context path where is running the console:
|
25
|
+
|
26
|
+
---
|
27
|
+
extensions:
|
28
|
+
sandbox:
|
29
|
+
context_path: management # by default the context path is sandbox
|
30
|
+
|
31
|
+
It also supports basic authentication, we'll have to specify the username and password within our section:
|
32
|
+
|
33
|
+
---
|
34
|
+
extensions:
|
35
|
+
sandbox:
|
36
|
+
username: manager
|
37
|
+
password: XXXXXXX
|
38
|
+
|
39
|
+
# FEATURES
|
40
|
+
|
41
|
+
The console as well as the REST api allow to list all the applications managed by that Trinidad's instance and start/stop them.
|
42
|
+
By security reasons the sandbox application is not listed nor can be stopped.
|
43
|
+
|
44
|
+
|
45
|
+
# TODO
|
14
46
|
|
15
|
-
|
16
|
-
|
17
|
-
* REST api
|
18
|
-
* Capistrano recipes to do hot deploys
|
47
|
+
This can be the starting point to a real management console, we could modify application parameters, show statistics...
|
48
|
+
Any improvement or redesign in the UI is welcome.
|
@@ -80,3 +80,31 @@ post '/apps/:name/start' do
|
|
80
80
|
wants.xml { status 204 }
|
81
81
|
end
|
82
82
|
end
|
83
|
+
|
84
|
+
post '/apps/:name/redeploy' do
|
85
|
+
context = Trinidad::Sandbox::ApplicationContext.find(params[:name])
|
86
|
+
|
87
|
+
context_not_found(params[:name]) unless context
|
88
|
+
|
89
|
+
web_app_dir = params[:web_app_dir]
|
90
|
+
if web_app_dir.nil?
|
91
|
+
flash[:warning] = "No web_app_dir param provided. Can not redeploy."
|
92
|
+
$servlet_context.log "No web_app_dir param provided. Can not redeploy."
|
93
|
+
respond_to do |wants|
|
94
|
+
wants.html { redirect sandbox_context.path }
|
95
|
+
wants.xml { status 404 }
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
context.stop
|
100
|
+
$servlet_context.log "#{context.name} stopped"
|
101
|
+
context.setDocBase(web_app_dir)
|
102
|
+
$servlet_context.log "#{context.name} web_app_dir set to #{web_app_dir}"
|
103
|
+
context.start
|
104
|
+
$servlet_context.log "#{context.name} started successfully"
|
105
|
+
|
106
|
+
respond_to do |wants|
|
107
|
+
wants.html { redirect sandbox_context.path }
|
108
|
+
wants.xml { status 204 }
|
109
|
+
end
|
110
|
+
end
|
Binary file
|
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
|
|
13
13
|
## If your rubyforge_project name is different, then edit it and comment out
|
14
14
|
## the sub! line in the Rakefile
|
15
15
|
s.name = 'trinidad_sandbox_extension'
|
16
|
-
s.version = '0.
|
17
|
-
s.date = '2010-
|
16
|
+
s.version = '0.2.0'
|
17
|
+
s.date = '2010-07-31'
|
18
18
|
s.rubyforge_project = 'trinidad_sandbox_extension'
|
19
19
|
|
20
20
|
## Make sure your summary is short. The description may be as long
|
@@ -40,7 +40,7 @@ Gem::Specification.new do |s|
|
|
40
40
|
|
41
41
|
## List your runtime dependencies here. Runtime dependencies are those
|
42
42
|
## that are needed for an end user to actually USE your code.
|
43
|
-
['sinatra', 'sinatra-authorization', 'sinatra-respond_to', 'sinatra-flash'].each do |dep|
|
43
|
+
['sinatra', 'sinatra-authorization', 'sinatra-respond_to', 'sinatra-flash', 'haml'].each do |dep|
|
44
44
|
s.add_dependency(dep)
|
45
45
|
end
|
46
46
|
|
@@ -54,6 +54,7 @@ Gem::Specification.new do |s|
|
|
54
54
|
## THE MANIFEST COMMENTS, they are used as delimiters by the task.
|
55
55
|
# = MANIFEST =
|
56
56
|
s.files = %w[
|
57
|
+
History.txt
|
57
58
|
LICENSE
|
58
59
|
README
|
59
60
|
Rakefile
|
metadata
CHANGED
@@ -1,12 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trinidad_sandbox_extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
segments:
|
6
|
-
- 0
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
version: 0.1.0
|
4
|
+
version: 0.2.0
|
10
5
|
platform: ruby
|
11
6
|
authors:
|
12
7
|
- David Calavera
|
@@ -14,81 +9,79 @@ autorequire:
|
|
14
9
|
bindir: bin
|
15
10
|
cert_chain: []
|
16
11
|
|
17
|
-
date: 2010-
|
12
|
+
date: 2010-07-31 00:00:00 +02:00
|
18
13
|
default_executable:
|
19
14
|
dependencies:
|
20
15
|
- !ruby/object:Gem::Dependency
|
21
16
|
name: sinatra
|
22
|
-
|
23
|
-
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
20
|
requirements:
|
25
21
|
- - ">="
|
26
22
|
- !ruby/object:Gem::Version
|
27
|
-
segments:
|
28
|
-
- 0
|
29
23
|
version: "0"
|
30
|
-
|
31
|
-
version_requirements: *id001
|
24
|
+
version:
|
32
25
|
- !ruby/object:Gem::Dependency
|
33
26
|
name: sinatra-authorization
|
34
|
-
|
35
|
-
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
36
30
|
requirements:
|
37
31
|
- - ">="
|
38
32
|
- !ruby/object:Gem::Version
|
39
|
-
segments:
|
40
|
-
- 0
|
41
33
|
version: "0"
|
42
|
-
|
43
|
-
version_requirements: *id002
|
34
|
+
version:
|
44
35
|
- !ruby/object:Gem::Dependency
|
45
36
|
name: sinatra-respond_to
|
46
|
-
|
47
|
-
|
37
|
+
type: :runtime
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
48
40
|
requirements:
|
49
41
|
- - ">="
|
50
42
|
- !ruby/object:Gem::Version
|
51
|
-
segments:
|
52
|
-
- 0
|
53
43
|
version: "0"
|
54
|
-
|
55
|
-
version_requirements: *id003
|
44
|
+
version:
|
56
45
|
- !ruby/object:Gem::Dependency
|
57
46
|
name: sinatra-flash
|
58
|
-
|
59
|
-
|
47
|
+
type: :runtime
|
48
|
+
version_requirement:
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
50
|
requirements:
|
61
51
|
- - ">="
|
62
52
|
- !ruby/object:Gem::Version
|
63
|
-
segments:
|
64
|
-
- 0
|
65
53
|
version: "0"
|
54
|
+
version:
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: haml
|
66
57
|
type: :runtime
|
67
|
-
|
58
|
+
version_requirement:
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: "0"
|
64
|
+
version:
|
68
65
|
- !ruby/object:Gem::Dependency
|
69
66
|
name: rspec
|
70
|
-
|
71
|
-
|
67
|
+
type: :development
|
68
|
+
version_requirement:
|
69
|
+
version_requirements: !ruby/object:Gem::Requirement
|
72
70
|
requirements:
|
73
71
|
- - ">="
|
74
72
|
- !ruby/object:Gem::Version
|
75
|
-
segments:
|
76
|
-
- 0
|
77
73
|
version: "0"
|
78
|
-
|
79
|
-
version_requirements: *id005
|
74
|
+
version:
|
80
75
|
- !ruby/object:Gem::Dependency
|
81
76
|
name: mocha
|
82
|
-
|
83
|
-
|
77
|
+
type: :development
|
78
|
+
version_requirement:
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
84
80
|
requirements:
|
85
81
|
- - ">="
|
86
82
|
- !ruby/object:Gem::Version
|
87
|
-
segments:
|
88
|
-
- 0
|
89
83
|
version: "0"
|
90
|
-
|
91
|
-
version_requirements: *id006
|
84
|
+
version:
|
92
85
|
description: Sandox console for Trinidad. It allows to manage the applications deployed on Trinidad.
|
93
86
|
email: calavera@apache.org
|
94
87
|
executables: []
|
@@ -99,6 +92,7 @@ extra_rdoc_files:
|
|
99
92
|
- README
|
100
93
|
- LICENSE
|
101
94
|
files:
|
95
|
+
- History.txt
|
102
96
|
- LICENSE
|
103
97
|
- README
|
104
98
|
- Rakefile
|
@@ -132,20 +126,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
132
126
|
requirements:
|
133
127
|
- - ">="
|
134
128
|
- !ruby/object:Gem::Version
|
135
|
-
segments:
|
136
|
-
- 0
|
137
129
|
version: "0"
|
130
|
+
version:
|
138
131
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
132
|
requirements:
|
140
133
|
- - ">="
|
141
134
|
- !ruby/object:Gem::Version
|
142
|
-
segments:
|
143
|
-
- 0
|
144
135
|
version: "0"
|
136
|
+
version:
|
145
137
|
requirements: []
|
146
138
|
|
147
139
|
rubyforge_project: trinidad_sandbox_extension
|
148
|
-
rubygems_version: 1.3.
|
140
|
+
rubygems_version: 1.3.5
|
149
141
|
signing_key:
|
150
142
|
specification_version: 2
|
151
143
|
summary: Sandbox console for Trinidad
|