Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 8536373803
Fetching contributors…

Cannot retrieve contributors at this time

496 lines (462 sloc) 24.119 kb
#! /usr/bin/env ruby
# This script takes the Java application template created from the
# JBoss AS7 cartridge on OpenShift Express and converts it to the Ruby
# application template suitable for use with TorqueBox.
require 'fileutils'
require 'rexml/document'
root = File.expand_path(File.dirname(__FILE__))
# Remove Java files
FileUtils.rm(File.join(root, 'pom.xml')) if File.exist?(File.join(root, 'pom.xml'))
FileUtils.rm_r(File.join(root, 'src')) if File.exist?(File.join(root, 'src'))
FileUtils.rm_r(File.join(root, 'deployments')) if File.exist?(File.join(root, 'deployments'))
# Ensure .openshift/config/modules directory exists
FileUtils.mkdir_p(File.join(root, '.openshift', 'config', 'modules'))
FileUtils.touch(File.join(root, '.openshift', 'config', 'modules', '.gitkeep'))
# Add TorqueBox bits to standalone.xml
modules = %w(bootstrap core cdi jobs security services web)
standalone_xml = File.join(root, '.openshift', 'config', 'standalone.xml')
doc = REXML::Document.new(File.read(standalone_xml))
extensions = doc.root.get_elements('extensions').first
jboss_config_done = false; extensions.each_element_with_attribute('module', "org.torquebox.bootstrap") {|e| jboss_config_done = true }
unless (jboss_config_done)
modules.each do |name|
extensions.add_element('extension', 'module'=>"org.torquebox.#{name}")
end
profiles = doc.root.get_elements('//profile')
profiles.each do |profile|
modules.each do |name|
profile.add_element('subsystem', 'xmlns'=>"urn:jboss:domain:torquebox-#{name}:1.0")
end
scanner_subsystem = profile.get_elements("subsystem[@xmlns='urn:jboss:domain:deployment-scanner:1.0']").first
scanner = scanner_subsystem.get_elements('deployment-scanner').first
scanner.add_attribute('deployment-timeout', '1200')
end
File.open(File.join(root, '.openshift', 'config', 'standalone.xml'), 'w') do |file|
doc.write(file, 4)
end
end
# Add TorqueBox bits to .openshift/action_hooks/build
File.open(File.join(root, '.openshift', 'action_hooks', 'build'), 'wb') do |file|
file.write(<<-END_OF_BUILD)
#!/bin/bash
# This is a simple build script, place your post-deploy but pre-start commands
# in this script. This script gets executed directly, so it could be python,
# php, ruby, etc.
JRUBY_VERSION="1.6.5"
TORQUEBOX_BUILD="614"
RACK_ENV="production"
cd ${OPENSHIFT_DATA_DIR}
# Download a JRuby and plonk it next to our jboss.home.dir
if [ ! -d jruby-${JRUBY_VERSION} ]; then
curl -o jruby-bin-${JRUBY_VERSION}.tar.gz "http://jruby.org.s3.amazonaws.com/downloads/${JRUBY_VERSION}/jruby-bin-${JRUBY_VERSION}.tar.gz"
tar -xzf jruby-bin-${JRUBY_VERSION}.tar.gz
rm jruby-bin-${JRUBY_VERSION}.tar.gz
rm -rf jruby-${JRUBY_VERSION}/share/ri/1.8/system/*
ln -sf jruby-${JRUBY_VERSION} jruby
fi
# Download a TorqueBox distribution and extract the modules
if [ ! -d ${OPENSHIFT_APP_DIR}${OPENSHIFT_APP_TYPE}/modules/org/torquebox ] && [ ! -d torquebox-${TORQUEBOX_BUILD}-modules ]; then
curl -o torquebox-dist-modules.zip "http://repository-torquebox.forge.cloudbees.com/incremental/torquebox/${TORQUEBOX_BUILD}/torquebox-dist-modules.zip"
unzip -d torquebox-${TORQUEBOX_BUILD}-modules torquebox-dist-modules.zip
rm torquebox-dist-modules.zip
fi
if [ ! -d ${OPENSHIFT_APP_DIR}${OPENSHIFT_APP_TYPE}/modules/org/torquebox ]; then
# Symlink TorqueBox modules into the app's .openshift/config/modules directory
mkdir -p ${OPENSHIFT_REPO_DIR}/.openshift/config/modules/org
ln -s ${OPENSHIFT_DATA_DIR}/torquebox-${TORQUEBOX_BUILD}-modules/torquebox ${OPENSHIFT_REPO_DIR}/.openshift/config/modules/org/torquebox
fi
# Add jruby to our path
export PATH=${OPENSHIFT_DATA_DIR}/jruby/bin:$PATH
# Set JRUBY_HOME if we need to
if ! grep 'jruby.home' ${OPENSHIFT_APP_DIR}${OPENSHIFT_APP_TYPE}/bin/standalone.conf > /dev/null; then
# Copy the symlinked file to a new file
mv ${OPENSHIFT_APP_DIR}${OPENSHIFT_APP_TYPE}/bin/standalone.conf ${OPENSHIFT_APP_DIR}${OPENSHIFT_APP_TYPE}/bin/standalone.conf.original
cp ${OPENSHIFT_APP_DIR}${OPENSHIFT_APP_TYPE}/bin/standalone.conf.original ${OPENSHIFT_APP_DIR}${OPENSHIFT_APP_TYPE}/bin/standalone.conf
echo -e "\\nJAVA_OPTS=\\"\\$JAVA_OPTS -Djruby.home=${OPENSHIFT_DATA_DIR}jruby\\"" >> ${OPENSHIFT_APP_DIR}${OPENSHIFT_APP_TYPE}/bin/standalone.conf
else
echo "jruby.home has already been set."
fi
# Install Bundler if needed
if ! jruby -S gem list | grep bundler > /dev/null; then
jruby -S gem install bundler
fi
# Install Rack if needed
if ! jruby -S gem list | grep rack > /dev/null; then
jruby -S gem install rack
fi
# Install the TorqueBox gems if needed
if ! jruby -S gem list | grep "torquebox (2.x.incremental.${TORQUEBOX_BUILD})" > /dev/null; then
jruby -S gem install torquebox --pre --source http://torquebox.org/2x/builds/${TORQUEBOX_BUILD}/gem-repo/
fi
# If .bundle isn't currently committed and a Gemfile is then bundle install
if [ ! -d ${OPENSHIFT_REPO_DIR}/.bundle ] && [ -f ${OPENSHIFT_REPO_DIR}/Gemfile ]; then
jruby -J-Xmx192m -S bundle install --gemfile ${OPENSHIFT_REPO_DIR}/Gemfile
fi
# Ensure a deployments directory exists
mkdir -p ${OPENSHIFT_REPO_DIR}/deployments
# Create a deployment descriptor for this app
cat <<__EOF__ > ${OPENSHIFT_REPO_DIR}/deployments/app-knob.yml
---
application:
root: ${OPENSHIFT_REPO_DIR}
environment:
RACK_ENV: ${RACK_ENV}
__EOF__
touch ${OPENSHIFT_REPO_DIR}/deployments/app-knob.yml.dodeploy
END_OF_BUILD
end
# Add Ruby application template
unless File.exist?(File.join(root, 'config.ru'))
File.open(File.join(root, 'config.ru'), 'w') do |file|
file.write(<<-END_OF_CONFIG_RU)
require 'rack/lobster'
map '/health' do
health = proc do |env|
[200, { "Content-Type" => "text/html" }, ["1"]]
end
run health
end
map '/lobster' do
run Rack::Lobster.new
end
map '/' do
welcome = proc do |env|
[200, { "Content-Type" => "text/html" }, ["<!doctype html>
<html lang=\\"en\\">
<head>
<meta charset=\\"utf-8\\">
<meta http-equiv=\\"X-UA-Compatible\\" content=\\"IE=edge,chrome=1\\">
<title>Welcome to OpenShift</title>
<style>
html { background: black; }
body {
background: #333;
background: -webkit-linear-gradient(top, black, #666);
background: -o-linear-gradient(top, black, #666);
background: -moz-linear-gradient(top, black, #666);
background: linear-gradient(top, black, #666);
color: white;
font-family: 'Liberation Sans', Verdana, Arial, Sans-serif;
width: 40em;
margin: 0 auto;
padding: 3em;
}
a {
color: #bfdce8;
}
h1 {
text-transform: uppercase;
-moz-text-shadow: 2px 2px 2px black;
-webkit-text-shadow: 2px 2px 2px black;
text-shadow: 2px 2px 2px black;
background: #c00;
width: 22.5em;
margin: .5em -2em;
padding: .3em 0 .3em 1.5em;
position: relative;
}
h1:before {
content: '';
width: 0;
height: 0;
border: .5em solid #900;
border-left-color: transparent;
border-bottom-color: transparent;
position: absolute;
bottom: -1em;
left: 0;
z-index: -1000;
}
h1:after {
content: '';
width: 0;
height: 0;
border: .5em solid #900;
border-right-color: transparent;
border-bottom-color: transparent;
position: absolute;
bottom: -1em;
right: 0;
z-index: -1000;
}
h2 {
text-transform: uppercase;
margin: 2em 0 .5em;
}
pre {
background: black;
padding: 1em 0 0;
-webkit-border-radius: 1em;
-moz-border-radius: 1em;
border-radius: 1em;
color: #9cf;
}
ul { margin: 0; padding: 0; }
li {
list-style-type: none;
padding: .5em 0;
}
</style>
</head>
<body>
<img
alt=\\"OpenShift logo\\"
src=\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAABKCAYAAACVbQIxAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz
AAAWcQAAFnEBAJr2QQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAACAASURB
VHic7Z15nBxVtce/p7pnsj4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z46NSdFdDJ1rT
skWs9C6borKsXJuFkv2seM6l28FhVZ3fbjJbAQQesVxZ0BbVHdXG6rGTvgBmAU/5i/HexltbkC0G
9wPzkrazDW9x70Q61p6r8Lpmv5C0nSRel0k9cEkPfkcDTydt51/AZ4DfJeKxXa9KSsRjryVtZyfg
drUgsStyWiF/8Wvr3wWeSdrOEryAeTaeSH3LP+2HwBP+osgNwPA8pkvhL8AtvjD3wVuzov6GPwlh
NXBX0naaEvFYl8sXEvFYxp/t9ljSdk7E63L7MN7nkncMG/g93rWuTtrOQ3gz0ObntEjvwVtLcjre
VOO+eFOZA64HHkzazvF4LZJaAHk3xgVCQkLeO5K2cyzwViIeW9lNnoF44xWteDXWDwArg1Xc/hqA
U/GCxzy8we6lwSC8X3ue4J+3FK/10WVw8Wv3abyxgON8X/Py5LvHt/XrHq5xMtCciMeastJ6+2VO
BmtHkrbTHy+Y9sUbxH8ux86heAPGq/EWR34MeCwRj3Vq6SVtZygwJhGPNeSk9wemJOKxR7LSRuBN
W16LN5ZzKl4QD6YYj8FrAbyciMc6Vcry+O6PJxwj8MYzlgSTBZLeyvYTcvwLXqujHu9zS+axGQM+
jrcq3gYOyVkvcjjwUWA53iD6KaGAhISEvC/xg+QaYFQiHivqXVAh7w7hLxKGhIS8XzkHeCoUj/cv
/w+9BQu2G5s85QAAAABJRU5ErkJggg==\\">
<h1>
Welcome to OpenShift
</h1>
<p>
Place your application here
</p>
<p>
In order to commit to your new project, go to your projects git repo (created with the rhc-create-app command). Make your changes, then run:
</p>
<pre>
git commit -a -m 'Some commit message'
git push
</pre>
<p>
Then reload this page.
</p>
<h2>
What's next?
</h2>
<ul>
<li>
Why not visit us at <a href=\\"http://openshift.redhat.com\\">http://openshift.redhat.com</a>, or
</li>
<li>
You could get help in the <a href=\\"http://www.redhat.com/openshift\\">OpenShift forums</a>, or
</li>
<li>
You're welcome to come chat with us in our IRC channel at #openshift on freenode.net
</li>
</ul>
</body>
</html>
"]]
end
run welcome
end
END_OF_CONFIG_RU
end
end
def tb_ose_start_process(pname)
IO.popen(pname) do |output|
output.each { |line| puts "#{line}" }
end
end
# Add java_to_ruby.rb to .gitignore
File.open('.gitignore', 'r+') do |file|
lines = file.readlines
file.write("java_to_ruby.rb\n") unless lines.index("java_to_ruby.rb\n")
end
setup_git = ARGV.index('--no-git').nil? && ARGV.index('-ng').nil?
setup_rails = ARGV.index('--setup-rails') || ARGV.index('-r')
if setup_git
puts "Adding git directories.."
system 'git add .openshift/'
system 'git add config.ru'
puts "Committing changes to git."
system 'git commit -am "converted to torquebox."'
end
if setup_rails
puts "#{ENV['TORQUEBOX_HOME']}"
app_name = Dir.pwd.split(/[\/\\]/).last
puts "Installing Rails for application #{app_name}..."
STDOUT.sync = true
tb_ose_start_process "jruby -S gem install rails"
Dir.chdir('..')
puts "The current dir is now #{Dir.pwd}"
tb_ose_start_process "jruby -S rails new #{app_name} -m $TORQUEBOX_HOME/share/rails/template.rb -b $TORQUEBOX_HOME/share/rails/openshift_app_builder.rb --skip-bundle"
puts "Done creating Rails app; now resolving bundle dependencies."
Dir.chdir("#{app_name}")
tb_ose_start_process "bundle install --without assets"
if setup_git
puts "Adding git directories and committing changes to git..."
tb_ose_start_process 'find . -not -name java_to_ruby.rb -not -name tmp -not -name .bundle -maxdepth 1 | xargs git add'
tb_ose_start_process "git commit -am \"Added rails application for app #{app_name}.\""
puts "Changes committed."
end
end
Jump to Line
Something went wrong with that request. Please try again.