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.
@@ -0,0 +1,9 @@
1
+ == 0.2.0 (2010-07-31)
2
+
3
+ * Support for redeploy applications
4
+ * Upgrade to Tomcat 7
5
+
6
+ == 0.1.0 (2010-05-30)
7
+
8
+ * Initial release
9
+ * Support for start/stop applications
data/README CHANGED
@@ -3,16 +3,46 @@ Trinidad sandbox extension
3
3
 
4
4
  # DESCRIPTION
5
5
 
6
- Extension to allow manage the applications deployed on Trinidad, ala Tomcat manager.
6
+ Trinidad's management console and REST api.
7
7
 
8
- This extension is in an early development stage and right now just shows you a
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
- sorted by priorities
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
- * Buttons to start/stop applications
16
- * UI
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.
@@ -6,7 +6,7 @@ require File.expand_path('../../trinidad-libs/trinidad-sandbox-extension', __FIL
6
6
  module Trinidad
7
7
  module Extensions
8
8
  class SandboxServerExtension < ServerExtension
9
- VERSION = '0.1.0'
9
+ VERSION = '0.2.0'
10
10
 
11
11
  def configure(tomcat)
12
12
  opts = prepare_options
@@ -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
@@ -1,7 +1,7 @@
1
1
  %html
2
2
  %head
3
3
  %title Trinidad's sandbox
4
- %link(rel="stylesheet" href="/sandbox/css/main.css" type="text/css")
4
+ %link(rel="stylesheet" href="#{sandbox_context.path}/css/main.css" type="text/css")
5
5
  %body
6
6
  .site
7
7
  #title
@@ -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.1.0'
17
- s.date = '2010-05-31'
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
- prerelease: false
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-05-31 00:00:00 +02:00
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
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
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
- type: :runtime
31
- version_requirements: *id001
24
+ version:
32
25
  - !ruby/object:Gem::Dependency
33
26
  name: sinatra-authorization
34
- prerelease: false
35
- requirement: &id002 !ruby/object:Gem::Requirement
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
- type: :runtime
43
- version_requirements: *id002
34
+ version:
44
35
  - !ruby/object:Gem::Dependency
45
36
  name: sinatra-respond_to
46
- prerelease: false
47
- requirement: &id003 !ruby/object:Gem::Requirement
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
- type: :runtime
55
- version_requirements: *id003
44
+ version:
56
45
  - !ruby/object:Gem::Dependency
57
46
  name: sinatra-flash
58
- prerelease: false
59
- requirement: &id004 !ruby/object:Gem::Requirement
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
- version_requirements: *id004
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
- prerelease: false
71
- requirement: &id005 !ruby/object:Gem::Requirement
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
- type: :development
79
- version_requirements: *id005
74
+ version:
80
75
  - !ruby/object:Gem::Dependency
81
76
  name: mocha
82
- prerelease: false
83
- requirement: &id006 !ruby/object:Gem::Requirement
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
- type: :development
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.6
140
+ rubygems_version: 1.3.5
149
141
  signing_key:
150
142
  specification_version: 2
151
143
  summary: Sandbox console for Trinidad