trinidad 1.3.5 → 1.4.0.RC
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +8 -2
- data/History.txt +43 -0
- data/LICENSE +3 -2
- data/README.md +121 -51
- data/Rakefile +2 -3
- data/lib/trinidad.rb +6 -10
- data/lib/trinidad/command_line_parser.rb +65 -65
- data/lib/trinidad/configuration.rb +103 -26
- data/lib/trinidad/lifecycle/base.rb +70 -0
- data/lib/trinidad/lifecycle/host.rb +87 -0
- data/lib/trinidad/lifecycle/host/restart_reload.rb +13 -0
- data/lib/trinidad/lifecycle/host/rolling_reload.rb +72 -0
- data/lib/trinidad/lifecycle/web_app/default.rb +94 -0
- data/lib/trinidad/lifecycle/web_app/shared.rb +53 -0
- data/lib/trinidad/lifecycle/web_app/war.rb +52 -0
- data/lib/trinidad/logging.rb +282 -0
- data/lib/trinidad/server.rb +142 -149
- data/lib/trinidad/version.rb +1 -1
- data/lib/trinidad/web_app.rb +278 -106
- data/rakelib/tomcat.rake +41 -10
- data/src/java/org/apache/juli/FileHandler.java +401 -0
- data/trinidad.gemspec +5 -9
- metadata +29 -19
- data/lib/trinidad/core_ext.rb +0 -42
- data/lib/trinidad/lifecycle/lifecycle_listener_base.rb +0 -88
- data/lib/trinidad/lifecycle/lifecycle_listener_default.rb +0 -84
- data/lib/trinidad/lifecycle/lifecycle_listener_host.rb +0 -81
- data/lib/trinidad/lifecycle/lifecycle_listener_war.rb +0 -43
- data/lib/trinidad/lifecycle/takeover.rb +0 -25
- data/lib/trinidad/log_formatter.rb +0 -18
- data/lib/trinidad/rackup_web_app.rb +0 -16
- data/lib/trinidad/rails_web_app.rb +0 -13
- data/lib/trinidad/war_web_app.rb +0 -19
data/Gemfile
CHANGED
data/History.txt
CHANGED
@@ -1,3 +1,46 @@
|
|
1
|
+
== Trinidad 1.4.0.RC (2012-07-03)
|
2
|
+
|
3
|
+
* requires latest Tomcat 7.0.28 (jars 1.0.5) due context reloading fix
|
4
|
+
* requires latest jruby-rack 1.1.7 due delegating RackLogger to JUL
|
5
|
+
* Trinidad::WebApp API revisited some changes are non-backwards compatible !
|
6
|
+
* enable running multiple applications with different ruby versions (using the
|
7
|
+
jruby_compat_version configuration option)
|
8
|
+
* allow arbitrary keys to be stored with Trinidad::Configuration
|
9
|
+
* changed Trinidad::Lifecycle::Base to be a (ruby-like) base lifecycle listener
|
10
|
+
skeleton implementation, thus removed all web app specifics from the class
|
11
|
+
(include Trinidad::Lifecycle::WebApp::Shared to gain the same functionality)
|
12
|
+
* removed unused Trinidad::Rack module and KeyTool from Trinidad::Tomcat
|
13
|
+
* reinvented server/application logging with Trinidad::Logging :
|
14
|
+
- refactored Trinidad's global logging configuration with JUL
|
15
|
+
- application logs into log/env.log by default with daily rolling
|
16
|
+
- console logs are now less chatty and only print logs from applications
|
17
|
+
running in development mode (configuration to come in a later release)
|
18
|
+
- make sure Trinidad's custom log formatter prints thrown exceptions
|
19
|
+
- use local timestamps with (file) log formatter by default
|
20
|
+
* Trinidad::Server#add_web_app for code re-use during rolling redeploys
|
21
|
+
* refactored application (monitor based `touch 'tmp/restart.txt'`) reloading
|
22
|
+
- bring back synchronous context reloading and make it default
|
23
|
+
- "zero downtime" async rolling reload is still supported and configurable via
|
24
|
+
the reload_strategy: rolling configuration option
|
25
|
+
- updated the context restart code - hot deploys should now work reliably (#75)
|
26
|
+
- moved Trinidad::Lifecycle::Host under Trinidad::Lifecycle::WebApp::Host
|
27
|
+
- Trinidad::Lifecycle::Host now accepts a server instance instead of a tomcat
|
28
|
+
- introduced Trinidad::WebApp::Holder to be used instead of bare Hash
|
29
|
+
* add async_supported attribute for servlet (3.0) configuration
|
30
|
+
|
31
|
+
== Trinidad_jars 1.0.5 (2012-07-03)
|
32
|
+
|
33
|
+
* Upgrade to Tomcat 7.0.28
|
34
|
+
* Patched org.apache.juli.FileHandler to allow daily rolling customization
|
35
|
+
|
36
|
+
== Trinidad_jars 1.0.4 (2012-06-14)
|
37
|
+
|
38
|
+
* Upgrade to Tomcat 7.0.27
|
39
|
+
|
40
|
+
== Trinidad_jars 1.0.3 (2012-04-04)
|
41
|
+
|
42
|
+
* Upgrade to Tomcat 7.0.26
|
43
|
+
|
1
44
|
== Trinidad 1.3.5 (2012-04-04)
|
2
45
|
|
3
46
|
* Correctly detect :rackup from main config for web apps (#66)
|
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
== Trinidad
|
2
2
|
|
3
|
-
Copyright (c) 2009 David Calavera
|
3
|
+
Copyright (c) 2009-2012 David Calavera
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
6
6
|
a copy of this software and associated documentation files (the
|
@@ -23,4 +23,5 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
23
|
|
24
24
|
== Additional Bundled Software
|
25
25
|
|
26
|
-
Apache Tomcat is licensed according to the terms of Apache License, Version 2.0 (current).
|
26
|
+
Apache Tomcat is licensed according to the terms of Apache License, Version 2.0 (current).
|
27
|
+
See http://www.apache.org/licenses/LICENSE-2.0 for details.
|
data/README.md
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
# Trinidad
|
2
2
|
|
3
|
-
Trinidad allows you to run
|
3
|
+
Trinidad allows you to run Rails or Rack applications within an embedded
|
4
|
+
Apache Tomcat container.
|
4
5
|
|
5
|
-
*
|
6
|
-
* Bug
|
7
|
-
*
|
6
|
+
* Mailing List: http://groups.google.com/group/rails-trinidad
|
7
|
+
* Bug Tracker: http://github.com/trinidad/trinidad/issues
|
8
|
+
* IRC Channel (on FreeNode): #trinidad
|
8
9
|
|
9
10
|
## Installation
|
10
11
|
|
@@ -19,39 +20,43 @@ $ cd myapp
|
|
19
20
|
$ jruby -S trinidad
|
20
21
|
```
|
21
22
|
|
22
|
-
###
|
23
|
+
### Setup
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
You can run your Sinatra application with Trinidad from the command line like this:
|
25
|
+
If you use Bundler, you might want to add Trinidad to your *Gemfile*:
|
27
26
|
|
28
27
|
```
|
29
|
-
|
28
|
+
gem 'trinidad', :require => nil
|
30
29
|
```
|
31
30
|
|
32
|
-
|
31
|
+
**Rails**
|
33
32
|
|
34
|
-
|
35
|
-
require 'sinatra'
|
36
|
-
require 'trinidad'
|
33
|
+
If you have Trinidad in your Gemfile you can start it with `rails server`:
|
37
34
|
|
38
|
-
|
39
|
-
|
40
|
-
end
|
35
|
+
```
|
36
|
+
$ rails s trinidad
|
41
37
|
```
|
42
38
|
|
43
|
-
|
39
|
+
or simply, if you prefer not to use the Rack handler, use:
|
44
40
|
|
45
41
|
```
|
46
|
-
|
42
|
+
$ trinidad
|
47
43
|
```
|
48
44
|
|
49
|
-
**
|
50
|
-
|
51
|
-
If you already have Trinidad in your Gemfile you can start the server with the rails command:
|
45
|
+
**Sinatra**
|
52
46
|
|
53
47
|
```
|
54
|
-
$
|
48
|
+
$ ruby app.rb -s Trinidad
|
49
|
+
```
|
50
|
+
|
51
|
+
or configure your application to always use Trinidad:
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
require 'sinatra'
|
55
|
+
require 'trinidad'
|
56
|
+
|
57
|
+
configure do
|
58
|
+
set :server, :trinidad
|
59
|
+
end
|
55
60
|
```
|
56
61
|
|
57
62
|
**Rackup**
|
@@ -70,7 +75,8 @@ Or you can set Trinidad by default in your `config.ru` file:
|
|
70
75
|
|
71
76
|
## Configuration
|
72
77
|
|
73
|
-
Trinidad allows you to configure
|
78
|
+
Trinidad allows you to configure parameters from the command line, the following
|
79
|
+
is a list of the currently supported options (try `trinidad -h`):
|
74
80
|
|
75
81
|
```
|
76
82
|
* -p, --port PORT => port to bind to.
|
@@ -86,47 +92,109 @@ Trinidad allows you to configure some parameters when the server is started from
|
|
86
92
|
* -g, --log LEVEL => set the log level, default INFO.
|
87
93
|
* --apps APPS_BASE_DIRECTORY => set the applications base directory.
|
88
94
|
```
|
89
|
-
You can also specify a default web.xml to configure your web application. By default the server tries to load the file `config/web.xml` but you can modify this path by adding the option `default_web_xml` within your configuration file.
|
90
95
|
|
91
|
-
|
96
|
+
You can also specify a default *web.xml* to configure your web application.
|
97
|
+
By default the server tries to load the file *config/web.xml* but you can change
|
98
|
+
the path by adding the option `default_web_xml` within your configuration file.
|
92
99
|
|
93
|
-
###
|
100
|
+
### YAML Configuration
|
101
|
+
|
102
|
+
The server can also be configured from a .yml file. By default, if a file is
|
103
|
+
not specified, the server tries to load *config/trinidad.yml*.
|
104
|
+
Within this file you can specify options available on the command line and tune
|
105
|
+
server settings or configure multiple applications to be hosted on the server.
|
106
|
+
|
107
|
+
Advanced configuration options are explained in the wiki:
|
108
|
+
http://wiki.github.com/trinidad/trinidad/advanced-configuration
|
94
109
|
|
95
|
-
The server can also be configured from a yaml file. By default, if a file is not specified, the server tries to load the file `config/trinidad.yml`. Within this file you can add other options like jruby.min.runtimes(:jruby _ min _ runtimes) or jruby.max.runtimes(:jruby _ max _ runtimes).
|
96
110
|
|
97
111
|
```
|
98
|
-
$ jruby -S trinidad --config
|
112
|
+
$ jruby -S trinidad --config my_trinidad.yml
|
99
113
|
```
|
100
114
|
|
101
115
|
```yml
|
102
116
|
---
|
103
|
-
port:
|
117
|
+
port: 4242
|
104
118
|
address: 0.0.0.0
|
105
119
|
```
|
106
120
|
|
107
|
-
### Ruby
|
121
|
+
### Ruby Configuration
|
108
122
|
|
109
|
-
|
123
|
+
As an alternative to the *config/trinidad.yml* file, a .rb configuration file
|
124
|
+
might be used to setup Trinidad. It follows the same convention as the yaml
|
125
|
+
configuration - the file `config/trinidad.rb` is loaded by default if exists.
|
110
126
|
|
111
127
|
```ruby
|
112
128
|
Trinidad.configure do |config|
|
113
|
-
config.port =
|
129
|
+
config.port = 4242
|
114
130
|
config.address = '0.0.0.0'
|
115
131
|
end
|
116
132
|
```
|
117
133
|
|
118
|
-
|
134
|
+
### Logging
|
135
|
+
|
136
|
+
As you might notice on your first `trinidad` the server uses standard output :
|
137
|
+
|
138
|
+
```
|
139
|
+
kares@theborg:~/workspace/trinidad/MegaUpload$ trinidad -p 8000 -e staging
|
140
|
+
Initializing ProtocolHandler ["http-bio-8000"]
|
141
|
+
Starting Servlet Engine: Apache Tomcat/7.0.28
|
142
|
+
Starting ProtocolHandler ["http-bio-8000"]
|
143
|
+
Context with name [/] has started rolling
|
144
|
+
Context with name [/] has completed rolling
|
145
|
+
```
|
146
|
+
|
147
|
+
It also prints warnings and error messages on error output, while application
|
148
|
+
specific log messages (e.g. logs from `Rails.logger`) go into the expected file
|
149
|
+
location at *log/{environment}.log*.
|
150
|
+
|
151
|
+
Application logging performs daily rolling out of the box and only prints
|
152
|
+
messages from an application to the console while it runs in development mode.
|
153
|
+
|
154
|
+
Please note that these logging details as well as the logging format will be
|
155
|
+
configurable with *trinidad.yml/.rb* within the next **1.4.x** release.
|
119
156
|
|
120
|
-
|
157
|
+
## Hot Deployment
|
121
158
|
|
122
|
-
|
159
|
+
Trinidad supports monitoring a file to reload applications, when the file
|
160
|
+
*tmp/restart.txt* is updated (e.g. `touch tmp/restart.txt`), the server reloads
|
161
|
+
the application the file belongs.
|
162
|
+
The file monitor can be customized with the `monitor` configuration option.
|
123
163
|
|
124
|
-
|
164
|
+
Since version **1.4.0** Trinidad supports 2 reload strategies :
|
165
|
+
|
166
|
+
* **restart** (default) synchronous reloading (exposed by Tomcat). This strategy
|
167
|
+
pauses incoming requests while it reloads the application and than serves them
|
168
|
+
once ready (or timeouts if it takes too long). It has been chosen as the default
|
169
|
+
strategy since **1.4.0** due it's more predictable memory requirements.
|
170
|
+
|
171
|
+
* **rolling** "zero-downtime" (asynchronous) reloading strategy similar to
|
172
|
+
Passenger's rolling reloads. This has been the default since **1.1.0** up till
|
173
|
+
Trinidad version **1.3.0**. If you use this you should account that while
|
174
|
+
rolling memory requirements for the JVM might increase quite a lot since
|
175
|
+
requests are being served and there's 2 versions of your application loaded at
|
176
|
+
the same time.
|
177
|
+
|
178
|
+
Configure the reload strategy per web application or globally e.g. :
|
179
|
+
|
180
|
+
```yml
|
181
|
+
---
|
182
|
+
port: 8080
|
183
|
+
environment: production
|
184
|
+
reload_strategy: rolling
|
185
|
+
```
|
186
|
+
|
187
|
+
## Virtual Hosts
|
188
|
+
|
189
|
+
It's possible to use Trinidad with multiple hosts and load the applications under
|
190
|
+
them automatically. Please remember that each host must have its applications in
|
191
|
+
a different directory.
|
125
192
|
|
126
193
|
```ruby
|
127
194
|
Trinidad.configure do |config|
|
128
195
|
config.hosts = {
|
129
|
-
# applications_path => host_name_list
|
196
|
+
# applications_path => host_name_list
|
197
|
+
# (first one is the real host name, the other ones are aliases)
|
130
198
|
'app_local' => ['localhost', '127.0.0.1'],
|
131
199
|
'apps_lol' => ['lolhost', 'lol'],
|
132
200
|
'apps_foo' => 'foo'
|
@@ -134,14 +202,16 @@ Trinidad.configure do |config|
|
|
134
202
|
end
|
135
203
|
```
|
136
204
|
|
137
|
-
If
|
205
|
+
If applications are configured via the `web_apps` section, the host for each app
|
206
|
+
can be added with the `hosts` key under each application.
|
207
|
+
If several applications belong to the same host put them under the same directory
|
208
|
+
and specify the name of the host for each one e.g. :
|
138
209
|
|
139
210
|
```ruby
|
140
211
|
Trinidad.configure do |config|
|
141
212
|
config.web_apps = {
|
142
213
|
:mock1 => {
|
143
214
|
:web_app_dir => 'rails_apps/mock1',
|
144
|
-
# host_name_list (the first one in the list is real host name, the other ones are aliases)
|
145
215
|
:hosts => ['rails.virtual.host', 'rails.host']
|
146
216
|
},
|
147
217
|
:mock2 => {
|
@@ -150,7 +220,6 @@ Trinidad.configure do |config|
|
|
150
220
|
},
|
151
221
|
:mock3 => {
|
152
222
|
:web_app_dir => 'rack_apps/mock3',
|
153
|
-
# host_name_list (the first one in the list is real host name, the other ones are aliases)
|
154
223
|
:hosts => ['rack.virtual.host', 'rack.host']
|
155
224
|
}
|
156
225
|
}
|
@@ -159,20 +228,21 @@ end
|
|
159
228
|
|
160
229
|
## Extensions
|
161
230
|
|
162
|
-
|
231
|
+
Trinidad allows to extend itself with more (not just Tomcat) features,
|
232
|
+
here is a list of the available extensions that are "officially supported":
|
163
233
|
|
164
|
-
|
165
|
-
*
|
166
|
-
*
|
167
|
-
*
|
168
|
-
*
|
169
|
-
*
|
170
|
-
* Lifecycle, application and server lifecycle management: http://github.com/trinidad/trinidad_lifecycle_extension
|
234
|
+
* Database Connection Pooling: http://github.com/trinidad/trinidad_dbpool_extension
|
235
|
+
* Daemonize Trinidad, based on Akuma: http://github.com/trinidad/trinidad_daemon_extension
|
236
|
+
* Init Services (for Unix and Windows), based on Commons Daemon: http://github.com/trinidad/trinidad_init_services
|
237
|
+
* Logging, enhance Trinidad's logging system: http://github.com/trinidad/trinidad_logging_extension
|
238
|
+
* Application and Server Lifecycle Management: http://github.com/trinidad/trinidad_lifecycle_extension
|
239
|
+
* Trinidad's Management Console and REST API: http://github.com/trinidad/trinidad_sandbox_extension
|
171
240
|
* Scheduler, based on Quartz: http://github.com/trinidad/trinidad_scheduler_extension
|
241
|
+
* Valves - components inserted into the request pipeline (e.g. Access Log): http://github.com/trinidad/trinidad_valve_extension
|
172
242
|
|
173
|
-
|
174
|
-
|
243
|
+
You can find further information on how to write extensions in the wiki:
|
244
|
+
http://wiki.github.com/trinidad/trinidad/extensions
|
175
245
|
|
176
246
|
## Copyright
|
177
247
|
|
178
|
-
Copyright (c) 2011 David Calavera
|
248
|
+
Copyright (c) 2011-2012 David Calavera. See LICENSE for details.
|
data/Rakefile
CHANGED
@@ -18,9 +18,8 @@ def release(name, gem_file, version)
|
|
18
18
|
exit!
|
19
19
|
end
|
20
20
|
sh "git commit --allow-empty -a -m 'Release #{name} #{version}'"
|
21
|
-
sh "git tag
|
22
|
-
sh "git push origin master"
|
23
|
-
sh "git push --tags"
|
21
|
+
sh "git tag #{name}-#{version}"
|
22
|
+
sh "git push origin master --tags"
|
24
23
|
sh "gem push pkg/#{gem_file}"
|
25
24
|
end
|
26
25
|
|
data/lib/trinidad.rb
CHANGED
@@ -3,19 +3,15 @@ require 'java'
|
|
3
3
|
require 'jruby-rack'
|
4
4
|
|
5
5
|
require 'trinidad/version'
|
6
|
-
require 'trinidad/core_ext'
|
7
6
|
require 'trinidad/extensions'
|
8
7
|
require 'trinidad/configuration'
|
9
8
|
require 'trinidad/command_line_parser'
|
10
9
|
require 'trinidad/jars'
|
10
|
+
require 'trinidad/logging'
|
11
11
|
require 'trinidad/server'
|
12
|
-
require 'trinidad/
|
13
|
-
require 'trinidad/lifecycle/
|
14
|
-
require 'trinidad/lifecycle/
|
15
|
-
require 'trinidad/lifecycle/
|
16
|
-
require 'trinidad/lifecycle/
|
17
|
-
require 'trinidad/lifecycle/lifecycle_listener_war'
|
12
|
+
require 'trinidad/lifecycle/base'
|
13
|
+
require 'trinidad/lifecycle/host'
|
14
|
+
require 'trinidad/lifecycle/web_app/shared'
|
15
|
+
require 'trinidad/lifecycle/web_app/default'
|
16
|
+
require 'trinidad/lifecycle/web_app/war'
|
18
17
|
require 'trinidad/web_app'
|
19
|
-
require 'trinidad/rails_web_app'
|
20
|
-
require 'trinidad/rackup_web_app'
|
21
|
-
require 'trinidad/war_web_app'
|
@@ -1,8 +1,5 @@
|
|
1
1
|
module Trinidad
|
2
|
-
require 'optparse'
|
3
|
-
|
4
2
|
class CommandLineParser
|
5
|
-
attr_reader :default_options
|
6
3
|
|
7
4
|
def self.parse(argv)
|
8
5
|
CommandLineParser.new.parse!(argv)
|
@@ -12,10 +9,13 @@ module Trinidad
|
|
12
9
|
CommandLineParser.new.load!(options)
|
13
10
|
end
|
14
11
|
|
12
|
+
attr_reader :default_options
|
13
|
+
|
15
14
|
def initialize
|
16
15
|
@default_options = {}
|
17
16
|
end
|
18
17
|
|
18
|
+
# Parse the arguments and return the loaded Trinidad configuration.
|
19
19
|
def parse!(argv)
|
20
20
|
begin
|
21
21
|
options_parser.parse!(argv)
|
@@ -27,107 +27,106 @@ module Trinidad
|
|
27
27
|
load!(default_options)
|
28
28
|
end
|
29
29
|
|
30
|
+
# Load the configuration from the given options and return it.
|
30
31
|
def load!(options)
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
require 'yaml'
|
36
|
-
require 'erb'
|
32
|
+
config = config_file(options[:web_app_dir])
|
33
|
+
if config && File.exist?(config)
|
34
|
+
if yaml = (File.extname(config) == '.yml')
|
35
|
+
require 'yaml'; require 'erb'
|
37
36
|
config_options = YAML.load(ERB.new(File.read(config)).result(binding))
|
38
|
-
options.deep_merge!(config_options.symbolize!)
|
39
37
|
end
|
38
|
+
# NOTE: provided options should override configuration values :
|
39
|
+
Trinidad.configure(config_options, options) do
|
40
|
+
load config unless yaml # if not .yml assume it's ruby (.rb)
|
41
|
+
end
|
42
|
+
else
|
43
|
+
Trinidad.configure(options)
|
40
44
|
end
|
41
|
-
|
42
|
-
Trinidad.configure(options)
|
43
|
-
if ruby_configuration?(config)
|
44
|
-
load config
|
45
|
-
end
|
46
|
-
|
47
|
-
options
|
48
45
|
end
|
49
46
|
alias_method :load_configuration, :load!
|
50
47
|
|
51
|
-
def
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
48
|
+
def config_file(base_dir = nil)
|
49
|
+
base_dir ||= Dir.pwd
|
50
|
+
if @config_file.nil? # false means do not use no config file
|
51
|
+
Dir.glob(File.join(base_dir, 'config', 'trinidad.{yml,rb}')).first
|
52
|
+
else
|
53
|
+
@config_file && File.expand_path(@config_file, base_dir)
|
54
|
+
end
|
57
55
|
end
|
58
|
-
|
56
|
+
|
57
|
+
attr_writer :config_file
|
58
|
+
|
59
59
|
def options_parser
|
60
|
+
require 'optparse'
|
60
61
|
@parser ||= OptionParser.new do |opts|
|
61
62
|
opts.banner = 'Trinidad server default options:'
|
62
63
|
opts.separator ''
|
63
64
|
|
64
|
-
opts.on('-d', '--dir WEB_APP_DIRECTORY', '
|
65
|
-
"default: #{Dir.pwd}") do |
|
66
|
-
default_options[:web_app_dir] =
|
65
|
+
opts.on('-d', '--dir WEB_APP_DIRECTORY', 'web app directory path',
|
66
|
+
"default: #{Dir.pwd}") do |dir|
|
67
|
+
default_options[:web_app_dir] = dir
|
67
68
|
end
|
68
69
|
|
69
|
-
opts.on('-e', '--env ENVIRONMENT', '
|
70
|
-
"default: #{default_options[:environment]}") do |
|
71
|
-
default_options[:environment] =
|
70
|
+
opts.on('-e', '--env ENVIRONMENT', '(rails) environment',
|
71
|
+
"default: #{default_options[:environment]}") do |env|
|
72
|
+
default_options[:environment] = env
|
72
73
|
end
|
73
74
|
|
74
|
-
opts.on('-p', '--port PORT', '
|
75
|
-
"default: #{default_options[:port]}") do |
|
76
|
-
default_options[:port] =
|
75
|
+
opts.on('-p', '--port PORT', 'port to bind to',
|
76
|
+
"default: #{default_options[:port]}") do |port|
|
77
|
+
default_options[:port] = port
|
77
78
|
end
|
78
79
|
|
79
|
-
opts.on('-c', '--context CONTEXT_PATH', '
|
80
|
-
"default: #{default_options[:context_path]}") do |
|
81
|
-
default_options[:context_path] =
|
80
|
+
opts.on('-c', '--context CONTEXT_PATH', 'application context path',
|
81
|
+
"default: #{default_options[:context_path]}") do |path|
|
82
|
+
default_options[:context_path] = path
|
82
83
|
end
|
83
84
|
|
84
|
-
opts.on('--lib', '--jars LIBS_DIR', '
|
85
|
-
"default: #{default_options[:libs_dir]}") do |
|
86
|
-
default_options[:libs_dir] =
|
85
|
+
opts.on('--lib', '--jars LIBS_DIR', 'directory containing java jars used by the application',
|
86
|
+
"default: #{default_options[:libs_dir]}") do |dir|
|
87
|
+
default_options[:libs_dir] = dir
|
87
88
|
end
|
88
89
|
|
89
|
-
opts.on('--classes', '--classes CLASSES_DIR', '
|
90
|
-
"default: #{default_options[:classes_dir]}") do |
|
91
|
-
default_options[:classes_dir] =
|
90
|
+
opts.on('--classes', '--classes CLASSES_DIR', 'directory containing java classes used by the application',
|
91
|
+
"default: #{default_options[:classes_dir]}") do |dir|
|
92
|
+
default_options[:classes_dir] = dir
|
92
93
|
end
|
93
94
|
|
94
|
-
opts.on('-s', '--ssl [SSL_PORT]', '
|
95
|
-
"default port: 8443") do |
|
96
|
-
|
97
|
-
default_options[:ssl] = {:port => ssl_port}
|
95
|
+
opts.on('-s', '--ssl [SSL_PORT]', 'enable secure socket layout',
|
96
|
+
"default port: 8443") do |port|
|
97
|
+
default_options[:ssl] = { :port => (port || 8443).to_i }
|
98
98
|
end
|
99
99
|
|
100
|
-
opts.on('-a', '--ajp [AJP_PORT]', '
|
101
|
-
"default port: 8009") do |
|
102
|
-
|
103
|
-
default_options[:ajp] = {:port => ajp_port}
|
100
|
+
opts.on('-a', '--ajp [AJP_PORT]', 'enable ajp connections (deprecated)',
|
101
|
+
"default port: 8009") do |port|
|
102
|
+
default_options[:ajp] = { :port => (port || 8009).to_i }
|
104
103
|
end
|
105
104
|
|
106
|
-
opts.on('-f', '--config [CONFIG_FILE]', '
|
107
|
-
"default: config/trinidad.yml") do |file|
|
108
|
-
|
105
|
+
opts.on('-f', '--config [CONFIG_FILE]', 'configuration file',
|
106
|
+
"default: config/trinidad.{yml,rb}") do |file|
|
107
|
+
self.config_file = file
|
109
108
|
end
|
110
109
|
|
111
|
-
opts.on('-r', '--rackup [RACKUP_FILE]', '
|
112
|
-
'default: config.ru') do |
|
113
|
-
default_options[:rackup] =
|
110
|
+
opts.on('-r', '--rackup [RACKUP_FILE]', 'rackup configuration file',
|
111
|
+
'default: config.ru') do |rackup|
|
112
|
+
default_options[:rackup] = rackup || 'config.ru'
|
114
113
|
end
|
115
114
|
|
116
|
-
opts.on('--public', '--public DIRECTORY', '
|
117
|
-
default_options[:public] =
|
115
|
+
opts.on('--public', '--public DIRECTORY', 'public directory', 'default: public') do |public|
|
116
|
+
default_options[:public] = public
|
118
117
|
end
|
119
118
|
|
120
|
-
opts.on('-t', '--threadsafe', '
|
119
|
+
opts.on('-t', '--threadsafe', 'force thread-safe mode') do
|
121
120
|
default_options[:jruby_min_runtimes] = 1
|
122
121
|
default_options[:jruby_max_runtimes] = 1
|
123
122
|
end
|
124
123
|
|
125
|
-
opts.on('--address', '--address ADDRESS', '
|
126
|
-
default_options[:address] =
|
124
|
+
opts.on('--address', '--address ADDRESS', 'host address', 'default: localhost') do |address|
|
125
|
+
default_options[:address] = address
|
127
126
|
end
|
128
127
|
|
129
|
-
opts.on('-g', '--log LEVEL', '
|
130
|
-
default_options[:log] =
|
128
|
+
opts.on('-g', '--log LEVEL', 'log level', 'default: INFO') do |log|
|
129
|
+
default_options[:log] = log
|
131
130
|
end
|
132
131
|
|
133
132
|
opts.on('-v', '--version', 'display the current version') do
|
@@ -137,7 +136,7 @@ module Trinidad
|
|
137
136
|
|
138
137
|
opts.on('-l', '--load EXTENSION_NAMES', Array, 'load options for extensions') do |ext_names|
|
139
138
|
ext_names.each do |ext|
|
140
|
-
Trinidad::Extensions.configure_options_extensions({ext => {}}, opts, default_options)
|
139
|
+
Trinidad::Extensions.configure_options_extensions({ ext => {} }, opts, default_options)
|
141
140
|
end
|
142
141
|
end
|
143
142
|
|
@@ -148,12 +147,13 @@ module Trinidad
|
|
148
147
|
opts.on('--monitor' '--monitor MONITOR_FILE', 'monitor file for hot deployments') do |monitor|
|
149
148
|
default_options[:monitor] = monitor
|
150
149
|
end
|
151
|
-
|
150
|
+
|
152
151
|
opts.on('-h', '--help', 'display the help') do
|
153
152
|
puts opts
|
154
153
|
exit
|
155
154
|
end
|
156
155
|
end
|
157
156
|
end
|
157
|
+
|
158
158
|
end
|
159
159
|
end
|