openshifter 0.2 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -102
- data/lib/openshifter/version.rb +1 -1
- data/templates/openshift/action_hooks/build +182 -135
- data/templates/openshift/action_hooks/templates/MANIFEST.MF +2 -0
- data/templates/openshift/action_hooks/templates/init.rb +4 -0
- data/templates/openshift/action_hooks/templates/jboss-web.xml +4 -0
- data/templates/openshift/action_hooks/templates/standalone.xml +232 -0
- data/templates/openshift/action_hooks/templates/web.xml +35 -0
- data/templates/openshift/config/standalone.xml +2 -0
- metadata +8 -3
data/README.md
CHANGED
@@ -1,110 +1,10 @@
|
|
1
1
|
## OpenShifter
|
2
2
|
|
3
|
-
|
3
|
+
CLI tool to siplify the deployment of JRuby applications to OpenShift
|
4
4
|
|
5
5
|
## How to
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
Install openshifter
|
10
|
-
|
11
|
-
gem install openshifter
|
12
|
-
|
13
|
-
### Step 2
|
14
|
-
|
15
|
-
Create your application on OpenShift (JBoss) and clone your repository localy, then cd into the directory.
|
16
|
-
|
17
|
-
### Step 3
|
18
|
-
|
19
|
-
Now you setup your environment
|
20
|
-
|
21
|
-
openshifter-setup
|
22
|
-
|
23
|
-
This step replaces .openshift folder contaning meta-data for your application.
|
24
|
-
|
25
|
-
### Step 4
|
26
|
-
|
27
|
-
Now you may modify configuration of your deployment. It is stored in .openshift/openshifter. It is ordinary YAML file. Possible options are
|
28
|
-
|
29
|
-
jruby: 1.6.6 # JRuby version you want to use
|
30
|
-
jrack: 1.1.3 # JRuby-Rack version used
|
31
|
-
install: vendor # Instalation method vendor/remote
|
32
|
-
|
33
|
-
Vendor instalation method installs all libraries and gems in .openshift folder and are versioned with your application. Remote installation installed all libraries and gems on server in the time of deployment.
|
34
|
-
|
35
|
-
If you decide to use remote installation method. You are done. For vendor installation method, please continue.
|
36
|
-
|
37
|
-
### Step 5
|
38
|
-
|
39
|
-
Downloads JRuby and JRuby-Rack to create runtime environment. Then Bundler is instaled locally for the application.
|
40
|
-
|
41
|
-
openshifter-download
|
42
|
-
|
43
|
-
### Step 4
|
44
|
-
|
45
|
-
At the setup time and whenever you add gems to your Gemfile, just run
|
46
|
-
|
47
|
-
openshifter-bundle
|
48
|
-
|
49
|
-
gems will be venoder in .openshift folder and you have to add them to VCS.
|
50
|
-
|
51
|
-
### Step 5
|
52
|
-
|
53
|
-
Add, commit and push to openshift.
|
54
|
-
|
55
|
-
## Upgrading
|
56
|
-
|
57
|
-
### OpenShifter
|
58
|
-
|
59
|
-
For remote install just run
|
60
|
-
|
61
|
-
openshifter-setup --upgrade
|
62
|
-
|
63
|
-
for vendored install it's more complicated
|
64
|
-
|
65
|
-
openshifter-setup --upgrade
|
66
|
-
openshifter-download
|
67
|
-
openshifter-bundle
|
68
|
-
|
69
|
-
**will be simplified in the future version**
|
70
|
-
|
71
|
-
### JRuby
|
72
|
-
|
73
|
-
For remote install, just modify .openshift/openshifter configuration.
|
74
|
-
|
75
|
-
For vendor install modify .openshift/openshifter configuration and then run.
|
76
|
-
|
77
|
-
openshifter-download
|
78
|
-
|
79
|
-
## Interface
|
80
|
-
|
81
|
-
Setup the environment
|
82
|
-
|
83
|
-
openshifter-setup
|
84
|
-
|
85
|
-
To upgrade openshifter
|
86
|
-
|
87
|
-
openshifter-setup --upgrade
|
88
|
-
|
89
|
-
Download JRuby and environment libraries
|
90
|
-
|
91
|
-
openshifter-download
|
92
|
-
|
93
|
-
Bundler wrapper
|
94
|
-
|
95
|
-
openshifter-bundle
|
96
|
-
|
97
|
-
Gem wrapper
|
98
|
-
|
99
|
-
openshifter-gem
|
100
|
-
|
101
|
-
JRuby wrapper
|
102
|
-
|
103
|
-
openshifter-ruby
|
104
|
-
|
105
|
-
Clean up your environment
|
106
|
-
|
107
|
-
openshifter-clean
|
7
|
+
[OpenShifter -> JRuby for OpenShift](http://blog.marekjelen.cz/article/openshifter-jruby-for-openshift)
|
108
8
|
|
109
9
|
## License
|
110
10
|
|
data/lib/openshifter/version.rb
CHANGED
@@ -5,9 +5,18 @@ $stdout.sync = true
|
|
5
5
|
require 'fileutils'
|
6
6
|
require 'yaml'
|
7
7
|
require 'digest'
|
8
|
+
require 'erb'
|
9
|
+
|
10
|
+
def start_cmd(cmd, prefix = '')
|
11
|
+
io = IO.popen(cmd)
|
12
|
+
io.each_line { |line| puts "#{prefix} #{line}"}
|
13
|
+
Process.wait(io.pid)
|
14
|
+
end
|
8
15
|
|
9
16
|
FileUtils.cd(ENV['OPENSHIFT_REPO_DIR'])
|
10
17
|
|
18
|
+
# Common configuration
|
19
|
+
|
11
20
|
data = YAML.load_file('.openshift/openshifter')
|
12
21
|
data = {} unless data
|
13
22
|
CONFIG = data
|
@@ -15,172 +24,210 @@ CONFIG = data
|
|
15
24
|
CONFIG['jruby'] ||= '1.6.6'
|
16
25
|
CONFIG['install'] ||= 'vendor'
|
17
26
|
CONFIG['jrack'] ||= '1.1.3'
|
27
|
+
CONFIG['torquebox'] ||= 614
|
28
|
+
|
29
|
+
SYS = {}
|
30
|
+
|
31
|
+
SYS[:root] = File.join(ENV['OPENSHIFT_REPO_DIR'], 'deployments')
|
32
|
+
SYS[:target] = File.join(SYS[:root], 'application.war')
|
33
|
+
SYS[:target_meta] = File.join(SYS[:target], 'META-INF')
|
34
|
+
SYS[:target_web] = File.join(SYS[:target], 'WEB-INF')
|
35
|
+
|
36
|
+
# Configuration per installation method
|
37
|
+
|
38
|
+
def setup_remote
|
39
|
+
SYS[:gems] = File.join(ENV['OPENSHIFT_DATA_DIR'], 'jruby', 'gems')
|
40
|
+
SYS[:libs] = File.join(ENV['OPENSHIFT_DATA_DIR'], 'jruby', 'libs')
|
41
|
+
SYS[:jruby] = File.join(SYS[:libs], "jruby-#{CONFIG['jruby']}.jar")
|
42
|
+
SYS[:jrack] = File.join(SYS[:libs], "jruby-rack-#{CONFIG['jrack']}.jar")
|
43
|
+
SYS[:gemfile_hash] = File.join(ENV['OPENSHIFT_DATA_DIR'], 'jruby', 'Gemfile.hash')
|
44
|
+
end
|
45
|
+
|
46
|
+
def setup_vendor
|
47
|
+
SYS[:gems] = File.expand_path('.openshift/gems')
|
48
|
+
end
|
18
49
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
libs = File.join(ENV['OPENSHIFT_DATA_DIR'], 'jruby', 'libs')
|
25
|
-
|
26
|
-
when 'vendor'
|
27
|
-
File.expand_path('.openshift/gems')
|
28
|
-
when 'remote'
|
29
|
-
File.join(ENV['OPENSHIFT_DATA_DIR'], 'jruby', 'gems')
|
50
|
+
def setup_torquebox
|
51
|
+
SYS[:torquebox] = File.join(ENV['OPENSHIFT_DATA_DIR'], 'jruby', 'torquebox', "modules-#{CONFIG['torquebox']}")
|
52
|
+
SYS[:torquebox_jruby] = File.join(ENV['OPENSHIFT_DATA_DIR'], 'jruby', 'torquebox', "jruby-#{CONFIG['jruby']}")
|
53
|
+
SYS[:gems] = File.join(ENV['OPENSHIFT_DATA_DIR'], 'jruby', 'torquebox', "gems")
|
54
|
+
SYS[:gemfile_hash] = File.join(ENV['OPENSHIFT_DATA_DIR'], 'jruby', 'torquebox', 'Gemfile.hash')
|
55
|
+
SYS[:libs] = File.join(ENV['OPENSHIFT_DATA_DIR'], 'jruby', 'libs')
|
56
|
+
SYS[:jrack] = File.join(SYS[:libs], "jruby-rack-#{CONFIG['jrack']}.jar")
|
30
57
|
end
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
58
|
+
|
59
|
+
# Configure particular method
|
60
|
+
|
61
|
+
send("setup_#{CONFIG['install']}".to_sym)
|
62
|
+
|
63
|
+
# Start creating environment
|
64
|
+
|
65
|
+
ENV['GEM_PATH'] = ENV['GEM_HOME'] = SYS[:gems]
|
35
66
|
|
36
67
|
puts '-> Cleaning target'
|
37
|
-
FileUtils.rm_rf(
|
68
|
+
FileUtils.rm_rf(SYS[:root])
|
38
69
|
|
39
70
|
puts '-> Creating target'
|
40
|
-
FileUtils.mkdir_p(
|
71
|
+
FileUtils.mkdir_p(SYS[:target])
|
41
72
|
|
42
73
|
puts '-> Public files'
|
43
|
-
FileUtils.cp_r(Dir.glob('public/*'),
|
74
|
+
FileUtils.cp_r(Dir.glob('public/*'), SYS[:target])
|
44
75
|
|
45
76
|
puts '-> META-INF'
|
46
|
-
FileUtils.mkdir_p(
|
77
|
+
FileUtils.mkdir_p(SYS[:target_meta])
|
47
78
|
|
48
79
|
puts '--> Manifest'
|
49
|
-
|
50
|
-
data = <<EOF
|
51
|
-
Manifest-Version: 1.0
|
52
|
-
Created-By: OpenShifter
|
53
|
-
EOF
|
54
|
-
file.print(data)
|
55
|
-
end
|
80
|
+
FileUtils.cp(File.expand_path('../templates/MANIFEST.MF', __FILE__), File.join(SYS[:target_meta], 'MANIFEST.MF'))
|
56
81
|
|
57
82
|
puts '--> init.rb'
|
58
|
-
File.
|
59
|
-
|
60
|
-
ENV['GEM_HOME'] ||= '#{gems}'
|
61
|
-
ENV['BUNDLE_GEMFILE'] = 'Gemfile'
|
62
|
-
ENV['RACK_ENV'] = 'production'
|
63
|
-
require 'psych.rb' # Hack for Ruby 1.6.6
|
64
|
-
EOF
|
65
|
-
file.print(data)
|
66
|
-
end
|
83
|
+
initrb = ERB.new(File.read(File.expand_path('../templates/init.rb', __FILE__))).result(binding)
|
84
|
+
File.open(File.join(SYS[:target_meta], 'init.rb'), 'w') { |file| file.print(initrb) }
|
67
85
|
|
68
86
|
puts '-> WEB-INF'
|
69
|
-
FileUtils.mkdir_p(
|
87
|
+
FileUtils.mkdir_p(SYS[:target_web])
|
70
88
|
|
71
89
|
puts '--> Application data'
|
72
90
|
app = Dir.glob('*')
|
73
91
|
app.delete('.openshift')
|
74
92
|
app.delete('public')
|
75
93
|
app.delete('deployments')
|
76
|
-
FileUtils.cp_r(app,
|
94
|
+
FileUtils.cp_r(app, SYS[:target_web])
|
77
95
|
|
78
96
|
puts '--> Lib'
|
79
|
-
FileUtils.mkdir_p(File.join(
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
97
|
+
FileUtils.mkdir_p(File.join(SYS[:target_web], 'lib'))
|
98
|
+
|
99
|
+
# Installation method specific tasks
|
100
|
+
|
101
|
+
def create_remote
|
102
|
+
puts '--> Copy runtime'
|
103
|
+
FileUtils.mkdir_p(SYS[:libs])
|
104
|
+
FileUtils.mkdir_p(SYS[:gems])
|
105
|
+
|
106
|
+
# Download JRuby if not present
|
107
|
+
unless File.exists?(SYS[:jruby])
|
108
|
+
Dir.glob(File.join(SYS[:libs], "jruby-*")) { |file| FileUtils.rm(file) }
|
109
|
+
puts "---> Downloading jRuby #{CONFIG['jruby']}"
|
110
|
+
puts `curl -o #{SYS[:jruby]} "http://jruby.org.s3.amazonaws.com/downloads/#{CONFIG['jruby']}/jruby-complete-#{CONFIG['jruby']}.jar"`
|
111
|
+
end
|
112
|
+
|
113
|
+
# Download JRuby-Rack if not present
|
114
|
+
unless File.exists?(SYS[:jrack])
|
115
|
+
Dir.glob(File.join(SYS[:libs], "jruby-rack-*")) { |file| FileUtils.rm(file) }
|
116
|
+
puts "---> Downloading jRuby-Rack #{CONFIG['jrack']}"
|
117
|
+
puts `curl -o #{SYS[:jrack]} "http://repository.codehaus.org/org/jruby/rack/jruby-rack/#{CONFIG['jrack']}/jruby-rack-#{CONFIG['jrack']}.jar"`
|
118
|
+
end
|
119
|
+
|
120
|
+
puts '---> Copying libraries'
|
121
|
+
FileUtils.cp(Dir.glob(File.join(SYS[:libs], '*.jar')), File.join(SYS[:target_web], 'lib'))
|
122
|
+
|
123
|
+
puts '--> Gems'
|
124
|
+
|
125
|
+
gemfile = Digest::SHA256.file('Gemfile').hexdigest
|
126
|
+
oldhash = File.exists?(SYS[:gemfile_hash]) ? File.read(SYS[:gemfile_hash]) : ''
|
127
|
+
|
128
|
+
# Gemfile was changes since last deploy
|
129
|
+
unless gemfile == oldhash
|
130
|
+
puts '---> Cleaning gems'
|
131
|
+
FileUtils.rm_rf(SYS[:gems])
|
132
|
+
|
133
|
+
puts '---> Installing Bundler'
|
134
|
+
start_cmd("java -jar #{SYS[:jruby]} -S gem install bundler --no-ri --no-rdoc")
|
135
|
+
|
136
|
+
puts "---> Bundling gems"
|
137
|
+
start_cmd("java -Xmx512m -Xss2048k -XX:+UseCompressedOops -jar #{SYS[:jruby]} -S bundle install")
|
138
|
+
|
139
|
+
File.open(SYS[:gemfile_hash], 'w') { |file| file.print(gemfile) }
|
140
|
+
end
|
106
141
|
end
|
107
142
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
143
|
+
def create_vendor
|
144
|
+
puts '--> Copy runtime'
|
145
|
+
FileUtils.cp(Dir.glob('.openshift/lib/*.jar'), File.join(SYS[:target_web], 'lib'))
|
146
|
+
end
|
147
|
+
|
148
|
+
def create_torquebox
|
149
|
+
puts '--> Install JRuby'
|
150
|
+
unless File.exists?(SYS[:torquebox_jruby])
|
151
|
+
Dir.glob(File.join(ENV['OPENSHIFT_DATA_DIR'], 'jruby', 'torquebox', "jruby-*")) { |file| FileUtils.rm_rf(file) }
|
152
|
+
FileUtils.mkdir_p(SYS[:torquebox_jruby])
|
153
|
+
puts `curl -o jruby.tar.gz "http://jruby.org.s3.amazonaws.com/downloads/#{CONFIG['jruby']}/jruby-bin-#{CONFIG['jruby']}.tar.gz"`
|
154
|
+
start_cmd("tar -xzf jruby.tar.gz -C #{File.expand_path('..', SYS[:torquebox_jruby])}")
|
155
|
+
start_cmd("rm jruby.tar.gz")
|
156
|
+
start_cmd("rm -rf #{SYS[:torquebox_jruby]}/share/ri/1.8/system/*")
|
157
|
+
FileUtils.rm(SYS[:gemfile_hash])
|
158
|
+
|
159
|
+
puts '---> Installing Bundler'
|
160
|
+
start_cmd("#{SYS[:torquebox_jruby]}/bin/jruby -S gem install bundler --no-ri --no-rdoc")
|
161
|
+
end
|
162
|
+
|
163
|
+
unless File.exists?(SYS[:jrack])
|
164
|
+
Dir.glob(File.join(SYS[:libs], "jruby-rack-*")) { |file| FileUtils.rm(file) }
|
165
|
+
puts "---> Downloading jRuby-Rack #{CONFIG['jrack']}"
|
166
|
+
puts `curl -o #{SYS[:jrack]} "http://repository.codehaus.org/org/jruby/rack/jruby-rack/#{CONFIG['jrack']}/jruby-rack-#{CONFIG['jrack']}.jar"`
|
167
|
+
end
|
168
|
+
|
169
|
+
puts '--> Gems'
|
170
|
+
|
171
|
+
gemfile = Digest::SHA256.file('Gemfile').hexdigest
|
172
|
+
oldhash = File.exists?(SYS[:gemfile_hash]) ? File.read(SYS[:gemfile_hash]) : ''
|
173
|
+
|
174
|
+
# Gemfile was changes since last deploy
|
175
|
+
unless gemfile == oldhash
|
176
|
+
puts '---> Cleaning gems'
|
177
|
+
FileUtils.rm_rf(SYS[:gems])
|
178
|
+
|
179
|
+
puts "---> Bundling gems"
|
180
|
+
start_cmd("#{SYS[:torquebox_jruby]}/bin/jruby -S bundle install")
|
181
|
+
|
182
|
+
File.open(SYS[:gemfile_hash], 'w') { |file| file.print(gemfile) }
|
183
|
+
end
|
184
|
+
|
185
|
+
puts '--> Install Torquebox'
|
186
|
+
unless File.exists?(SYS[:torquebox])
|
187
|
+
Dir.glob(File.join(ENV['OPENSHIFT_DATA_DIR'], 'jruby', 'torquebox', "modules-*")) { |file| FileUtils.rm_rf(file) }
|
188
|
+
FileUtils.mkdir_p(SYS[:torquebox])
|
189
|
+
puts `curl -o #{SYS[:torquebox]}/torquebox-dist-modules.zip "http://repository-torquebox.forge.cloudbees.com/incremental/torquebox/#{CONFIG['torquebox']}/torquebox-dist-modules.zip"`
|
190
|
+
puts `unzip -d #{SYS[:torquebox]} #{SYS[:torquebox]}/torquebox-dist-modules.zip`
|
191
|
+
FileUtils.rm("#{SYS[:torquebox]}/torquebox-dist-modules.zip")
|
192
|
+
|
193
|
+
puts '---> Installing Torquebox gems'
|
194
|
+
start_cmd("#{SYS[:torquebox_jruby]}/bin/jruby -S gem install torquebox --pre --source http://torquebox.org/2x/builds/#{CONFIG['torquebox']}/gem-repo/")
|
195
|
+
end
|
196
|
+
|
197
|
+
script_path = "#{ENV['OPENSHIFT_APP_DIR']}#{ENV['OPENSHIFT_APP_TYPE']}/bin/standalone.conf"
|
198
|
+
script = File.read(script_path)
|
199
|
+
jruby_home = "JAVA_OPTS=\"$JAVA_OPTS -Djruby.home=#{SYS[:torquebox_jruby]}\""
|
200
|
+
if match = /JAVA_OPTS=".+jruby\-(\d\.\d\.\d)"/.match(script)
|
201
|
+
script.sub!(match[0], jruby_home)
|
128
202
|
else
|
129
|
-
|
203
|
+
script += "\n"
|
204
|
+
script += jruby_home
|
205
|
+
end
|
206
|
+
FileUtils.mv(script_path, "#{script_path}.old")
|
207
|
+
File.open(script_path, 'w') { |file| file.print(script) }
|
208
|
+
|
209
|
+
puts "--> Setup Torquebox modules"
|
210
|
+
FileUtils.mkdir_p(".openshift/config/modules/org")
|
211
|
+
# FileUtils.ln_s(File.join(path, 'modules', 'org', 'torquebox'), ".openshift/config/modules/org/torquebox") # For newer version of Torquebox
|
212
|
+
FileUtils.ln_s(File.join(SYS[:torquebox], 'torquebox'), ".openshift/config/modules/org/torquebox")
|
213
|
+
FileUtils.cp(File.expand_path('../templates/standalone.xml', __FILE__), '.openshift/config/standalone.xml')
|
214
|
+
|
215
|
+
puts '--> Copying libraries'
|
216
|
+
FileUtils.cp(Dir.glob(File.join(SYS[:libs], '*.jar')), File.join(SYS[:target_web], 'lib'))
|
217
|
+
|
130
218
|
end
|
131
219
|
|
220
|
+
# Run the tasks
|
221
|
+
|
222
|
+
send("create_#{CONFIG['install']}".to_sym)
|
223
|
+
|
224
|
+
# Common tasks for setting Java thingies
|
225
|
+
|
132
226
|
puts '--> jboss-web.xml'
|
133
|
-
|
134
|
-
data = <<EOF
|
135
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
136
|
-
<jboss-web>
|
137
|
-
<context-root />
|
138
|
-
</jboss-web>
|
139
|
-
EOF
|
140
|
-
file.print(data)
|
141
|
-
end
|
227
|
+
FileUtils.cp(File.expand_path('../templates/jboss-web.xml', __FILE__), File.join(SYS[:target_web], 'jboss-web.xml'))
|
142
228
|
|
143
229
|
puts '--> web.xml'
|
144
|
-
|
145
|
-
data = <<EOF
|
146
|
-
<!DOCTYPE web-app PUBLIC
|
147
|
-
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
|
148
|
-
"http://java.sun.com/dtd/web-app_2_3.dtd">
|
149
|
-
<web-app>
|
150
|
-
|
151
|
-
<context-param>
|
152
|
-
<param-name>public.root</param-name>
|
153
|
-
<param-value>/</param-value>
|
154
|
-
</context-param>
|
155
|
-
|
156
|
-
<context-param>
|
157
|
-
<param-name>jruby.compat.version</param-name>
|
158
|
-
<param-value>1.9</param-value>
|
159
|
-
</context-param>
|
160
|
-
|
161
|
-
<context-param>
|
162
|
-
<param-name>rack.env</param-name>
|
163
|
-
<param-value>production</param-value>
|
164
|
-
</context-param>
|
165
|
-
|
166
|
-
<filter>
|
167
|
-
<filter-name>RackFilter</filter-name>
|
168
|
-
<filter-class>org.jruby.rack.RackFilter</filter-class>
|
169
|
-
</filter>
|
170
|
-
|
171
|
-
<filter-mapping>
|
172
|
-
<filter-name>RackFilter</filter-name>
|
173
|
-
<url-pattern>/*</url-pattern>
|
174
|
-
</filter-mapping>
|
175
|
-
|
176
|
-
<listener>
|
177
|
-
<listener-class>org.jruby.rack.RackServletContextListener</listener-class>
|
178
|
-
</listener>
|
179
|
-
|
180
|
-
</web-app>
|
181
|
-
EOF
|
182
|
-
file.print(data)
|
183
|
-
end
|
230
|
+
FileUtils.cp(File.expand_path('../templates/web.xml', __FILE__), File.join(SYS[:target_web], 'web.xml'))
|
184
231
|
|
185
232
|
puts '-> Deployment marker'
|
186
|
-
FileUtils.touch("#{
|
233
|
+
FileUtils.touch("#{SYS[:target]}.dodeploy")
|
@@ -0,0 +1,232 @@
|
|
1
|
+
<!--
|
2
|
+
~ JBoss, Home of Professional Open Source.
|
3
|
+
~ Copyright 2011, Red Hat, Inc., and individual contributors
|
4
|
+
~ as indicated by the @author tags. See the copyright.txt file in the
|
5
|
+
~ distribution for a full listing of individual contributors.
|
6
|
+
~
|
7
|
+
~ This is free software; you can redistribute it and/or modify it
|
8
|
+
~ under the terms of the GNU Lesser General Public License as
|
9
|
+
~ published by the Free Software Foundation; either version 2.1 of
|
10
|
+
~ the License, or (at your option) any later version.
|
11
|
+
~
|
12
|
+
~ This software is distributed in the hope that it will be useful,
|
13
|
+
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
15
|
+
~ Lesser General Public License for more details.
|
16
|
+
~
|
17
|
+
~ You should have received a copy of the GNU Lesser General Public
|
18
|
+
~ License along with this software; if not, write to the Free
|
19
|
+
~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
20
|
+
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
21
|
+
-->
|
22
|
+
|
23
|
+
<server xmlns="urn:jboss:domain:1.0">
|
24
|
+
|
25
|
+
<extensions>
|
26
|
+
<extension module="org.jboss.as.clustering.infinispan"/>
|
27
|
+
<extension module="org.jboss.as.connector"/>
|
28
|
+
<extension module="org.jboss.as.deployment-scanner"/>
|
29
|
+
<extension module="org.jboss.as.ee"/>
|
30
|
+
<extension module="org.jboss.as.ejb3"/>
|
31
|
+
<extension module="org.jboss.as.jaxrs"/>
|
32
|
+
<extension module="org.jboss.as.jmx"/>
|
33
|
+
<extension module="org.jboss.as.jpa"/>
|
34
|
+
<extension module="org.jboss.as.logging"/>
|
35
|
+
<extension module="org.jboss.as.naming"/>
|
36
|
+
<extension module="org.jboss.as.sar"/>
|
37
|
+
<extension module="org.jboss.as.security"/>
|
38
|
+
<extension module="org.jboss.as.threads"/>
|
39
|
+
<extension module="org.jboss.as.transactions"/>
|
40
|
+
<extension module="org.jboss.as.web" />
|
41
|
+
<extension module="org.jboss.as.weld" />
|
42
|
+
<extension module='org.torquebox.bootstrap' />
|
43
|
+
<extension module='org.torquebox.core' />
|
44
|
+
<extension module='org.torquebox.cdi' />
|
45
|
+
<extension module='org.torquebox.jobs' />
|
46
|
+
<extension module='org.torquebox.security' />
|
47
|
+
<extension module='org.torquebox.services' />
|
48
|
+
<extension module='org.torquebox.web' />
|
49
|
+
|
50
|
+
</extensions>
|
51
|
+
|
52
|
+
<profile>
|
53
|
+
<subsystem xmlns="urn:jboss:domain:logging:1.0">
|
54
|
+
<!--console-handler name="CONSOLE">
|
55
|
+
<level name="INFO"/>
|
56
|
+
<formatter>
|
57
|
+
<pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
|
58
|
+
</formatter>
|
59
|
+
</console-handler-->
|
60
|
+
|
61
|
+
<periodic-rotating-file-handler name="FILE">
|
62
|
+
<level name="INFO"/>
|
63
|
+
<formatter>
|
64
|
+
<pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
|
65
|
+
</formatter>
|
66
|
+
<file relative-to="jboss.server.log.dir" path="server.log"/>
|
67
|
+
<suffix value=".yyyy-MM-dd"/>
|
68
|
+
</periodic-rotating-file-handler>
|
69
|
+
|
70
|
+
<logger category="com.arjuna">
|
71
|
+
<level name="WARN"/>
|
72
|
+
</logger>
|
73
|
+
<logger category="org.apache.tomcat.util.modeler">
|
74
|
+
<level name="WARN"/>
|
75
|
+
</logger>
|
76
|
+
<logger category="sun.rmi">
|
77
|
+
<level name="WARN"/>
|
78
|
+
</logger>
|
79
|
+
|
80
|
+
<root-logger>
|
81
|
+
<level name="INFO"/>
|
82
|
+
<handlers>
|
83
|
+
<!--handler name="CONSOLE"/-->
|
84
|
+
<handler name="FILE"/>
|
85
|
+
</handlers>
|
86
|
+
</root-logger>
|
87
|
+
</subsystem>
|
88
|
+
<subsystem xmlns="urn:jboss:domain:datasources:1.0">
|
89
|
+
<datasources>
|
90
|
+
<datasource jndi-name="java:jboss/datasources/ExampleDS" enabled="true" use-java-context="true" pool-name="H2DS">
|
91
|
+
<connection-url>jdbc:h2:${jboss.server.data.dir}/test;DB_CLOSE_DELAY=-1</connection-url>
|
92
|
+
<driver>h2</driver>
|
93
|
+
<pool></pool>
|
94
|
+
<security>
|
95
|
+
<user-name>sa</user-name>
|
96
|
+
<password>sa</password>
|
97
|
+
</security>
|
98
|
+
<validation></validation>
|
99
|
+
<timeout></timeout>
|
100
|
+
<statement></statement>
|
101
|
+
</datasource>
|
102
|
+
<datasource jndi-name="java:jboss/datasources/MysqlDS" enabled="${mysql.enabled}" use-java-context="true" pool-name="MysqlDS">
|
103
|
+
<connection-url>jdbc:mysql://${OPENSHIFT_DB_HOST}:${OPENSHIFT_DB_PORT}/${OPENSHIFT_APP_NAME}</connection-url>
|
104
|
+
<driver>mysql</driver>
|
105
|
+
<security>
|
106
|
+
<user-name>${OPENSHIFT_DB_USERNAME}</user-name>
|
107
|
+
<password>${OPENSHIFT_DB_PASSWORD}</password>
|
108
|
+
</security>
|
109
|
+
</datasource>
|
110
|
+
<datasource jndi-name="java:jboss/datasources/PostgreSQLDS" enabled="${postgresql.enabled}" use-java-context="true" pool-name="PostgreSQLDS" use-ccm="true">
|
111
|
+
<connection-url>jdbc:postgresql://${OPENSHIFT_DB_HOST}:${OPENSHIFT_DB_PORT}/${OPENSHIFT_APP_NAME}</connection-url>
|
112
|
+
<driver>postgresql</driver>
|
113
|
+
<security>
|
114
|
+
<user-name>${OPENSHIFT_DB_USERNAME}</user-name>
|
115
|
+
<password>${OPENSHIFT_DB_PASSWORD}</password>
|
116
|
+
</security>
|
117
|
+
</datasource>
|
118
|
+
<drivers>
|
119
|
+
<driver name="h2" module="com.h2database.h2">
|
120
|
+
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
|
121
|
+
</driver>
|
122
|
+
<driver name="mysql" module="com.mysql.jdbc">
|
123
|
+
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
|
124
|
+
</driver>
|
125
|
+
<driver name="postgresql" module="org.postgresql.jdbc">
|
126
|
+
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
|
127
|
+
</driver>
|
128
|
+
</drivers>
|
129
|
+
</datasources>
|
130
|
+
</subsystem>
|
131
|
+
<subsystem xmlns="urn:jboss:domain:deployment-scanner:1.0">
|
132
|
+
<deployment-scanner scan-interval="5000" relative-to="jboss.server.base.dir" path="deployments" />
|
133
|
+
</subsystem>
|
134
|
+
<subsystem xmlns="urn:jboss:domain:ee:1.0" />
|
135
|
+
<subsystem xmlns="urn:jboss:domain:ejb3:1.0" />
|
136
|
+
<subsystem xmlns="urn:jboss:domain:infinispan:1.0" default-cache-container="hibernate">
|
137
|
+
<cache-container name="hibernate" default-cache="local-query">
|
138
|
+
<local-cache name="entity">
|
139
|
+
<eviction strategy="LRU" max-entries="10000"/>
|
140
|
+
<expiration max-idle="100000"/>
|
141
|
+
</local-cache>
|
142
|
+
<local-cache name="local-query">
|
143
|
+
<eviction strategy="LRU" max-entries="10000"/>
|
144
|
+
<expiration max-idle="100000"/>
|
145
|
+
</local-cache>
|
146
|
+
<local-cache name="timestamps">
|
147
|
+
<eviction strategy="NONE"/>
|
148
|
+
</local-cache>
|
149
|
+
</cache-container>
|
150
|
+
</subsystem>
|
151
|
+
<subsystem xmlns="urn:jboss:domain:jaxrs:1.0"/>
|
152
|
+
<subsystem xmlns="urn:jboss:domain:jca:1.0">
|
153
|
+
<archive-validation enabled="false" />
|
154
|
+
<bean-validation enabled="false" />
|
155
|
+
<default-workmanager>
|
156
|
+
<short-running-threads blocking="true">
|
157
|
+
<core-threads count="5" per-cpu="10"/>
|
158
|
+
<queue-length count="5" per-cpu="10"/>
|
159
|
+
<max-threads count="5" per-cpu="10"/>
|
160
|
+
<keepalive-time time="10" unit="seconds"/>
|
161
|
+
</short-running-threads>
|
162
|
+
<long-running-threads blocking="true">
|
163
|
+
<core-threads count="5" per-cpu="10"/>
|
164
|
+
<queue-length count="5" per-cpu="10"/>
|
165
|
+
<max-threads count="5" per-cpu="10"/>
|
166
|
+
<keepalive-time time="10" unit="seconds"/>
|
167
|
+
</long-running-threads>
|
168
|
+
</default-workmanager>
|
169
|
+
</subsystem>
|
170
|
+
<subsystem xmlns="urn:jboss:domain:jpa:1.0">
|
171
|
+
<jpa default-datasource=""/>
|
172
|
+
</subsystem>
|
173
|
+
<subsystem xmlns="urn:jboss:domain:naming:1.0" />
|
174
|
+
<subsystem xmlns="urn:jboss:domain:resource-adapters:1.0" />
|
175
|
+
<subsystem xmlns="urn:jboss:domain:sar:1.0"/>
|
176
|
+
<subsystem xmlns="urn:jboss:domain:security:1.0">
|
177
|
+
<security-domains>
|
178
|
+
<security-domain name="other" cache-type="default">
|
179
|
+
<authentication>
|
180
|
+
<login-module code="UsersRoles" flag="required"/>
|
181
|
+
</authentication>
|
182
|
+
</security-domain>
|
183
|
+
</security-domains>
|
184
|
+
</subsystem>
|
185
|
+
<subsystem xmlns="urn:jboss:domain:threads:1.0"/>
|
186
|
+
<subsystem xmlns="urn:jboss:domain:transactions:1.0">
|
187
|
+
<recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager"/>
|
188
|
+
<core-environment>
|
189
|
+
<process-id>
|
190
|
+
<uuid />
|
191
|
+
</process-id>
|
192
|
+
</core-environment>
|
193
|
+
<coordinator-environment default-timeout="300"/>
|
194
|
+
</subsystem>
|
195
|
+
<subsystem xmlns="urn:jboss:domain:web:1.0" default-virtual-server="default-host">
|
196
|
+
<connector name="http" scheme="http" protocol="HTTP/1.1" socket-binding="http"/>
|
197
|
+
<virtual-server name="default-host" enable-welcome-root="false">
|
198
|
+
<alias name="localhost" />
|
199
|
+
</virtual-server>
|
200
|
+
</subsystem>
|
201
|
+
<subsystem xmlns="urn:jboss:domain:weld:1.0" />
|
202
|
+
<subsystem xmlns='urn:jboss:domain:torquebox-bootstrap:1.0' />
|
203
|
+
<subsystem xmlns='urn:jboss:domain:torquebox-core:1.0' />
|
204
|
+
<subsystem xmlns='urn:jboss:domain:torquebox-cdi:1.0' />
|
205
|
+
<subsystem xmlns='urn:jboss:domain:torquebox-jobs:1.0' />
|
206
|
+
<subsystem xmlns='urn:jboss:domain:torquebox-security:1.0' />
|
207
|
+
<subsystem xmlns='urn:jboss:domain:torquebox-services:1.0' />
|
208
|
+
<subsystem xmlns='urn:jboss:domain:torquebox-web:1.0' />
|
209
|
+
</profile>
|
210
|
+
|
211
|
+
<interfaces>
|
212
|
+
<interface name="management">
|
213
|
+
<loopback-address value="${OPENSHIFT_INTERNAL_IP}"/>
|
214
|
+
</interface>
|
215
|
+
<interface name="public">
|
216
|
+
<loopback-address value="${OPENSHIFT_INTERNAL_IP}"/>
|
217
|
+
</interface>
|
218
|
+
</interfaces>
|
219
|
+
|
220
|
+
<socket-binding-group name="standard-sockets" default-interface="public">
|
221
|
+
<socket-binding name="http" port="8080"/>
|
222
|
+
<socket-binding name="https" port="8443"/>
|
223
|
+
<socket-binding name="jmx-connector-registry" port="1090"/>
|
224
|
+
<socket-binding name="jmx-connector-server" port="1091"/>
|
225
|
+
<socket-binding name="jndi" port="1099"/>
|
226
|
+
<socket-binding name="osgi-http" port="8090"/>
|
227
|
+
<socket-binding name="remoting" port="4447"/>
|
228
|
+
<socket-binding name="txn-recovery-environment" port="4712"/>
|
229
|
+
<socket-binding name="txn-status-manager" port="4713"/>
|
230
|
+
</socket-binding-group>
|
231
|
+
|
232
|
+
</server>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<!DOCTYPE web-app PUBLIC
|
2
|
+
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
|
3
|
+
"http://java.sun.com/dtd/web-app_2_3.dtd">
|
4
|
+
<web-app>
|
5
|
+
|
6
|
+
<context-param>
|
7
|
+
<param-name>public.root</param-name>
|
8
|
+
<param-value>/</param-value>
|
9
|
+
</context-param>
|
10
|
+
|
11
|
+
<context-param>
|
12
|
+
<param-name>jruby.compat.version</param-name>
|
13
|
+
<param-value>1.9</param-value>
|
14
|
+
</context-param>
|
15
|
+
|
16
|
+
<context-param>
|
17
|
+
<param-name>rack.env</param-name>
|
18
|
+
<param-value>production</param-value>
|
19
|
+
</context-param>
|
20
|
+
|
21
|
+
<filter>
|
22
|
+
<filter-name>RackFilter</filter-name>
|
23
|
+
<filter-class>org.jruby.rack.RackFilter</filter-class>
|
24
|
+
</filter>
|
25
|
+
|
26
|
+
<filter-mapping>
|
27
|
+
<filter-name>RackFilter</filter-name>
|
28
|
+
<url-pattern>/*</url-pattern>
|
29
|
+
</filter-mapping>
|
30
|
+
|
31
|
+
<listener>
|
32
|
+
<listener-class>org.jruby.rack.RackServletContextListener</listener-class>
|
33
|
+
</listener>
|
34
|
+
|
35
|
+
</web-app>
|
@@ -39,6 +39,7 @@
|
|
39
39
|
<extension module="org.jboss.as.transactions"/>
|
40
40
|
<extension module="org.jboss.as.web" />
|
41
41
|
<extension module="org.jboss.as.weld" />
|
42
|
+
<!--Torquebox-extensions-->
|
42
43
|
</extensions>
|
43
44
|
|
44
45
|
<profile>
|
@@ -191,6 +192,7 @@
|
|
191
192
|
</virtual-server>
|
192
193
|
</subsystem>
|
193
194
|
<subsystem xmlns="urn:jboss:domain:weld:1.0" />
|
195
|
+
<!--Torquebox-subsystems-->
|
194
196
|
</profile>
|
195
197
|
|
196
198
|
<interfaces>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openshifter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.3'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,9 +9,9 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-02-
|
12
|
+
date: 2012-02-22 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
|
-
description: Simplify deployments of
|
14
|
+
description: Simplify deployments of JRuby applications to OpenShift
|
15
15
|
email:
|
16
16
|
- marek@jelen.biz
|
17
17
|
executables:
|
@@ -36,6 +36,11 @@ files:
|
|
36
36
|
- templates/openshift/action_hooks/deploy
|
37
37
|
- templates/openshift/action_hooks/post_deploy
|
38
38
|
- templates/openshift/action_hooks/pre_build
|
39
|
+
- templates/openshift/action_hooks/templates/init.rb
|
40
|
+
- templates/openshift/action_hooks/templates/jboss-web.xml
|
41
|
+
- templates/openshift/action_hooks/templates/MANIFEST.MF
|
42
|
+
- templates/openshift/action_hooks/templates/standalone.xml
|
43
|
+
- templates/openshift/action_hooks/templates/web.xml
|
39
44
|
- templates/openshift/config/standalone.xml
|
40
45
|
- templates/openshift/gems/README
|
41
46
|
- templates/openshift/lib/README
|