├── .gitignore ├── Gemfile ├── README.md ├── Rakefile ├── config.ru ├── config └── warble.rb └── lib ├── Vagrantfile ├── shrinkwrap.rb └── winstone-0.9.10.jar /.gitignore: -------------------------------------------------------------------------------- 1 | .bundle/ 2 | shrinkwrap.war 3 | ubuntu10-04.jar 4 | extract/ 5 | 6 | wanton.jar 7 | 8 | Gemfile.lock 9 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'http://rubygems.org' 2 | 3 | gem 'vagrant' 4 | gem 'warbler' 5 | gem 'sinatra' 6 | gem 'jruby-openssl' 7 | gem 'jruby-win32ole' 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | Initial whack at "projectizing" Patrick Debois' idea for packaging 4 | Vagrant boxes as deliverable Java Jar artifacts, to include a web-based 5 | admin UI for managing instances. 6 | 7 | # Requires 8 | 9 | * VirtualBox 10 | * JRuby 11 | * rake and bundler 12 | 13 | # Clone 14 | 15 | $ git clone git@github.com:maestrodev/wanton.git 16 | 17 | # Bundle 18 | 19 | $ bundle install 20 | 21 | # Edit 22 | 23 | Configure your base box environment by editing the lib/Vagrantfile 24 | appropriately. The default is this box: 25 | 26 | 27 | 28 | # Package 29 | 30 | $ rake 31 | 32 | # Run 33 | 34 | $ java -jar wanton.jar 35 | 36 | The first time run will take a bit to fetch the box from S3, and launch. 37 | Hopefully you see something like this: 38 | 39 | [Winstone 2011/03/31 20:45:31] - Beginning extraction from war file 40 | [Winstone 2011/03/31 20:45:33] - No webapp classes folder found - 41 | /private/var/folders/i5/i5UtK1YGGBmH5OaJiz7cX++++TI/-Tmp-/winstoneEmbeddedWAR/WEB-INF/classes 42 | [webapp 2011/03/31 20:45:33] - jruby 1.6.0 (ruby 1.8.7 patchlevel 330) 43 | (2011-03-15 f3b6154) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_24) 44 | [darwin-x86_64-java] 45 | [Winstone 2011/03/31 20:45:40] - HTTP Listener started: port=8080 46 | [Winstone 2011/03/31 20:45:40] - AJP13 Listener started: port=8009 47 | [Winstone 2011/03/31 20:45:40] - Winstone Servlet Engine v0.9.10 48 | 49 | Then from a browser/client hit http://localhost:8080/up and you should 50 | see this in the console: 51 | 52 | running: controlPort=disabled 53 | we are loading the config file 54 | #, 57 | @loaded=false, 58 | @parent=nil, 59 | @vm=nil> 60 | we are uping the machine, please wait... 61 | 62 | And when it finishes loading: 63 | 64 | [webapp 2011/03/31 20:47:52] - 0:0:0:0:0:0:0:1%0 - [31/Mar/2011 20:47:52] "GET /up " 200 9 73.6910 65 | 66 | [webapp 2011/03/31 20:47:53] - 0:0:0:0:0:0:0:1%0 - [31/Mar/2011 20:47:53] "GET /favicon.ico " 404 18 0.0230 67 | 68 | Then, in the browser you see: 69 | 70 | We are up 71 | 72 | # Cleanup 73 | 74 | $ rake clobber 75 | 76 | # Fork Away 77 | 78 | To create your boxes! This project isn't meant to be configurable, just re-used to fabricate your own JAR-based deliverable VMs. It is expected that you'd want to do that anyway by populating the Vagrantfile with your OS and application configuration apparatus (Puppet or Chef). 79 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require 'rake/clean' 2 | 3 | directory 'extract' 4 | task :create_extract => 'extract' 5 | 6 | task :warble do 7 | sh "warble" 8 | end 9 | 10 | task :package => :warble 11 | task :package => :create_extract 12 | 13 | task :package do 14 | sh "cd extract && jar -xvf ../lib/winstone-0.9.10.jar" 15 | sh "cp wanton.war extract/embedded.war" 16 | sh "cd extract && jar cvfm ../wanton.jar META-INF/MANIFEST.MF ." 17 | sh "cd .." 18 | sh "rm wanton.war" 19 | end 20 | 21 | task :default => 'package' 22 | 23 | CLEAN.include('extract/') 24 | CLOBBER.include('wanton.jar') 25 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | require "lib/shrinkwrap" 2 | run Shrinkwrap.new 3 | -------------------------------------------------------------------------------- /config/warble.rb: -------------------------------------------------------------------------------- 1 | Warbler::Config.new do |config| 2 | config.gems += ["jruby-openssl","jruby-win32ole"] 3 | end 4 | -------------------------------------------------------------------------------- /lib/Vagrantfile: -------------------------------------------------------------------------------- 1 | Vagrant::Config.run do |config| 2 | config.vm.box = "wanton" 3 | config.vm.box_url = "http://files.vagrantup.com/lucid32.box" 4 | config.vm.boot_mode = :gui 5 | config.vm.customize do |vm| 6 | vm.memory_size = 384 7 | vm.name = "wanton" 8 | end 9 | config.vm.forward_port "http", 80, 9000 10 | end 11 | -------------------------------------------------------------------------------- /lib/shrinkwrap.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'rubygems' 3 | require 'sinatra' 4 | require 'vagrant' 5 | require 'vagrant/cli' 6 | require 'pp' 7 | 8 | class Shrinkwrap < Sinatra::Application 9 | get '/up' do 10 | body "We do an up" 11 | vagrant_dir=File.expand_path(File.dirname(__FILE__)) 12 | puts "we are loading the config file" 13 | @vagrant_env=Vagrant::Environment.new(:cwd => vagrant_dir) 14 | pp @vagrant_env 15 | @vagrant_env.load! 16 | puts "we are uping the machine, please wait..." 17 | Vagrant::CLI.start(["up"], :env => @vagrant_env) 18 | body "We are up" 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /lib/winstone-0.9.10.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maestrodev/wanton/fe632177e94e5a4cddfb34931dec64b57c0a1ec1/lib/winstone-0.9.10.jar --------------------------------------------------------------------------------