Permalink
Browse files

micro cloud 1.2 beta1

Change-Id: Ie5d82d2d64f26599396ad06d5efb555d91683807
  • Loading branch information...
1 parent 7183ee7 commit f7fae21d72893175f74a69c46542c48202b91542 @pmenglund pmenglund committed Jan 12, 2012
Showing with 308 additions and 84 deletions.
  1. +40 −29 micro/Gemfile.lock
  2. BIN micro/LICENSES
  3. +6 −6 micro/README
  4. +9 −1 micro/RELEASE_NOTES
  5. +2 −4 micro/SBTA
  6. +1 −0 micro/config/dnsmasq.conf.erb
  7. +4 −0 micro/config/dnsmasq.erb
  8. +20 −10 micro/lib/micro/console.rb
  9. +57 −0 micro/lib/micro/dns.rb
  10. +7 −6 micro/lib/micro/identity.rb
  11. +27 −4 micro/lib/micro/network.rb
  12. +1 −0 micro/lib/micro/settings.rb
  13. +1 −1 micro/lib/micro/version.rb
  14. +7 −3 micro/lib/micro/watcher.rb
  15. +1 −1 micro/spec/assets/config.json
  16. +4 −0 micro/spec/assets/dhcp3/dhclient-enter-hooks.d/dnsmasq
  17. +1 −0 micro/spec/assets/dnsmasq.conf
  18. +20 −0 micro/spec/dns_spec.rb
  19. +26 −8 micro/spec/identity_spec.rb
  20. +1 −1 micro/spec/network_spec.rb
  21. +0 −8 micro/spec/settings_spec.rb
  22. +13 −0 micro/spec/spec_helper.rb
  23. +3 −2 micro/spec/watcher_spec.rb
  24. BIN micro/vendor/cache/addressable-2.2.6.gem
  25. BIN micro/vendor/cache/blobstore_client-0.3.3.gem
  26. BIN micro/vendor/cache/blobstore_client-0.3.7.gem
  27. BIN micro/vendor/cache/ci_reporter-1.6.3.gem
  28. BIN micro/vendor/cache/ci_reporter-1.6.9.gem
  29. BIN micro/vendor/cache/crack-0.1.8.gem
  30. BIN micro/vendor/cache/crack-0.3.1.gem
  31. BIN micro/vendor/cache/diff-lcs-1.1.2.gem
  32. BIN micro/vendor/cache/diff-lcs-1.1.3.gem
  33. BIN micro/vendor/cache/highline-1.6.1.gem
  34. BIN micro/vendor/cache/highline-1.6.9.gem
  35. BIN micro/vendor/cache/httpclient-2.1.6.1.gem
  36. BIN micro/vendor/cache/httpclient-2.2.4.gem
  37. BIN micro/vendor/cache/interact-0.3.gem
  38. BIN micro/vendor/cache/json_pure-1.5.1.gem
  39. BIN micro/vendor/cache/json_pure-1.5.4.gem
  40. BIN micro/vendor/cache/log4r-1.1.10.gem
  41. BIN micro/vendor/cache/mime-types-1.16.gem
  42. BIN micro/vendor/cache/mime-types-1.17.2.gem
  43. BIN micro/vendor/cache/posix-spawn-0.3.3.gem
  44. BIN micro/vendor/cache/posix-spawn-0.3.6.gem
  45. BIN micro/vendor/cache/progressbar-0.9.0.gem
  46. BIN micro/vendor/cache/progressbar-0.9.2.gem
  47. BIN micro/vendor/cache/rcov-0.9.11.gem
  48. BIN micro/vendor/cache/rcov-0.9.9.gem
  49. BIN micro/vendor/cache/rcov_analyzer-0.1.gem
  50. BIN micro/vendor/cache/rcov_analyzer-0.2.gem
  51. BIN micro/vendor/cache/rest-client-1.6.1.gem
  52. BIN micro/vendor/cache/rest-client-1.6.7.gem
  53. BIN micro/vendor/cache/rspec-2.6.0.gem
  54. BIN micro/vendor/cache/rspec-2.8.0.gem
  55. BIN micro/vendor/cache/rspec-core-2.6.4.gem
  56. BIN micro/vendor/cache/rspec-core-2.8.0.gem
  57. BIN micro/vendor/cache/rspec-expectations-2.6.0.gem
  58. BIN micro/vendor/cache/rspec-expectations-2.8.0.gem
  59. BIN micro/vendor/cache/rspec-mocks-2.6.0.gem
  60. BIN micro/vendor/cache/rspec-mocks-2.8.0.gem
  61. BIN micro/vendor/cache/ruby-atmos-pure-1.0.5.gem
  62. BIN micro/vendor/cache/ruby-hmac-0.4.0.gem
  63. BIN micro/vendor/cache/{rubyzip2-2.0.1.gem → rubyzip2-2.0.2.gem}
  64. BIN micro/vendor/cache/spruz-0.2.13.gem
  65. BIN micro/vendor/cache/statemachine-1.2.0.gem
  66. BIN micro/vendor/cache/statemachine-2.0.1.gem
  67. BIN micro/vendor/cache/terminal-table-1.4.2.gem
  68. BIN micro/vendor/cache/terminal-table-1.4.4.gem
  69. BIN micro/vendor/cache/uuidtools-2.1.1.gem
  70. BIN micro/vendor/cache/uuidtools-2.1.2.gem
  71. BIN micro/vendor/cache/vmc-0.2.6.gem
  72. BIN micro/vendor/cache/vmc-0.3.15.gem
  73. BIN micro/vendor/cache/xml-simple-1.0.13.gem
  74. BIN micro/vendor/cache/xml-simple-1.1.1.gem
  75. BIN micro/vendor/cache/yajl-ruby-0.7.8.gem
  76. BIN micro/vendor/cache/yajl-ruby-1.1.0.gem
  77. +1 −0 vmbuilder/lib/vm_builder.rb
  78. +1 −0 vmbuilder/templates/micro/execscript.sh
  79. +53 −0 vmbuilder/templates/micro/instance/dhclient.conf
  80. +1 −0 vmbuilder/templates/micro/instance/extra.conf
  81. +1 −0 vmbuilder/templates/micro/templates/vmware/esxi.vmx.tmpl
View
@@ -1,54 +1,65 @@
GEM
remote: http://rubygems.org/
specs:
+ addressable (2.2.6)
aws-s3 (0.6.2)
builder
mime-types
xml-simple
- blobstore_client (0.3.3)
+ blobstore_client (0.3.7)
aws-s3
httpclient
+ ruby-atmos-pure (>= 1.0.4)
uuidtools
builder (3.0.0)
- ci_reporter (1.6.3)
+ ci_reporter (1.6.9)
builder (>= 2.1.2)
- crack (0.1.8)
- diff-lcs (1.1.2)
- highline (1.6.1)
- httpclient (2.1.6.1)
- json_pure (1.5.1)
- mime-types (1.16)
+ crack (0.3.1)
+ diff-lcs (1.1.3)
+ highline (1.6.9)
+ httpclient (2.2.4)
+ interact (0.3)
+ json_pure (1.5.4)
+ spruz (~> 0.2.8)
+ log4r (1.1.10)
+ mime-types (1.17.2)
monit_api (1.0.2)
crack
netaddr (1.5.0)
- posix-spawn (0.3.3)
- progressbar (0.9.0)
- rcov (0.9.9)
- rcov_analyzer (0.1)
+ posix-spawn (0.3.6)
+ progressbar (0.9.2)
+ rcov (0.9.11)
+ rcov_analyzer (0.2)
builder
rcov
- rest-client (1.6.1)
+ rest-client (1.6.7)
mime-types (>= 1.16)
- rspec (2.6.0)
- rspec-core (~> 2.6.0)
- rspec-expectations (~> 2.6.0)
- rspec-mocks (~> 2.6.0)
- rspec-core (2.6.4)
- rspec-expectations (2.6.0)
+ rspec (2.8.0)
+ rspec-core (~> 2.8.0)
+ rspec-expectations (~> 2.8.0)
+ rspec-mocks (~> 2.8.0)
+ rspec-core (2.8.0)
+ rspec-expectations (2.8.0)
diff-lcs (~> 1.1.2)
- rspec-mocks (2.6.0)
- rubyzip2 (2.0.1)
- statemachine (1.2.0)
- terminal-table (1.4.2)
- uuidtools (2.1.1)
- vmc (0.2.6)
- highline (~> 1.6.1)
+ rspec-mocks (2.8.0)
+ ruby-atmos-pure (1.0.5)
+ log4r (>= 1.1.9)
+ ruby-hmac (>= 0.4.0)
+ ruby-hmac (0.4.0)
+ rubyzip2 (2.0.2)
+ spruz (0.2.13)
+ statemachine (2.0.1)
+ terminal-table (1.4.4)
+ uuidtools (2.1.2)
+ vmc (0.3.15)
+ addressable (~> 2.2.6)
+ interact (~> 0.3.0)
json_pure (~> 1.5.1)
- rest-client (< 1.7.0, >= 1.6.1)
+ rest-client (>= 1.6.1, < 1.7.0)
rubyzip2 (~> 2.0.1)
terminal-table (~> 1.4.2)
- xml-simple (1.0.13)
- yajl-ruby (0.7.8)
+ xml-simple (1.1.1)
+ yajl-ruby (1.1.0)
PLATFORMS
ruby
View
Binary file not shown.
View
@@ -1,4 +1,4 @@
-Micro Cloud Foundry version 1.1
+Micro Cloud Foundry version 1.2
===============================
This is the second release of Micro Cloud Foundry.
@@ -7,7 +7,7 @@ IMPORTANT : You MUST have a valid CloudFoundry.com account to get the required
Micro Cloud Foundry Token needed to configure the Micro Cloud Foundry VM.
To signup for a Cloud Foundry account, please go to http://cloudfoundry.com/signup
after receiving your account information, get your token from
-http://cloudfoundry.com/micro
+http://my.cloudfoundry.com/micro
by signing in with your CloudFoundry.com credentials.
- The Cloud Foundry Team
@@ -23,7 +23,7 @@ by signing in with your CloudFoundry.com credentials.
http://cloudfoundry.com/signup
* Get your Micro Cloud Foundry token at
- http://cloudfoundry.com/micro
+ http://my.cloudfoundry.com/micro
by signing in with your Cloud Foundry account.
* Learn more about Cloud Foundry at :
@@ -35,8 +35,8 @@ by signing in with your CloudFoundry.com credentials.
Default configuration:
-Micro Cloud Foundry
-VM: 1GB RAM / 8GB disk / 2 VCPUs
+Micro Cloud Foundry
+VM: 1GB RAM / 16GB disk / 2 VCPUs
-----------------------------------------------
MySQL: 2GB storage, max 256MB storage per instance
Postgres: 2GB storage, max 256MB storage per instance
@@ -53,7 +53,7 @@ Runtimes
| ruby18 | Ruby 1.8 | 1.8.7 |
| ruby19 | Ruby 1.9 | 1.9.2p180 |
| java | Java 6 | 1.6 |
-| node | Node.js | 0.4.5 |
+| node | Node.js | 0.4.12 |
+--------+-------------+-----------+
Frameworks
View
@@ -1,6 +1,14 @@
-Micro Cloud Foundry version 1.1
+Micro Cloud Foundry version 1.2
===============================
+Changes since version 1.1:
+--------------------------
+- added offline mode
+- added keyboard reconfiguration option
+- updated node.js to version 0.4.12
+- updated Tomcat to 6.0.35
+- enabled debugging mode for JVM apps
+
Changes since version 1.0:
--------------------------
- added postgres & rabbit mq services
View
@@ -1,5 +1,4 @@
-bplist00�_WebMainResource�
- _WebResourceData_WebResourceMIMEType_WebResourceTextEncodingName_WebResourceFrameName^WebResourceURLOT/<html><head></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">VMWARE, INC.
+VMWARE, INC.
SOFTWARE BETA TEST AGREEMENT
@@ -67,11 +66,10 @@ In certain jurisdictions where certain warranties or conditions cannot be contra
(d) Modification. This is the entire agreement between the parties relating to the subject matter hereof and to the fullest extent permitted by law, all other terms, representations, negotiations, arrangements or understandings are rejected. This Agreement supersedes and replaces any other agreements, representations, negotiations, arrangements or understandings between the parties and Licensee hereby waives any form requirements that may be contained in previous agreements and agrees that this Agreement shall take precedent with respect to its subject matter. No party has entered into this Agreement relying on any representations made by or on behalf of the other, other than those expressly made in this Agreement. No waiver or modification of this Agreement shall be valid unless in writing signed by each party.
-(e) Language of Contract. The parties have required that this Agreement and all documents relating thereto be drawn up in English. Les parties ont demandé que cette convention ainsi que tous les documents que s'y attachent soient rédigés en anglais.
+(e) Language of Contract. The parties have required that this Agreement and all documents relating thereto be drawn up in English. Les parties ont demandé que cette convention ainsi que tous les documents que s'y attachent soient rédigés en anglais.
(f) Severability. In the event any of the terms and conditions hereof shall contradict with any mandatory or restrictive provisions of the applicable laws at any time and thereby becomes invalid or unenforceable, such invalidity or unenforceability shall not affect the validity and enforceability of the other terms and conditions of this Agreement, which shall thereafter be construed in all respects as if such invalid or unenforceable provisions were omitted, provided that no party is, as a result thereof, deprived of the enjoyment of its substantial benefits under this Agreement.
(g) Waivers. The waivers, express or implied, by any of the parties to this Agreement of any right hereunder or of any failure to perform, or of any breach by any other party or parties shall not constitute or be deemed as a waiver of such provision(s) granting such right or requiring such performance, or of the right of such party to thereafter enforce each and every such provision, or to enforce any other right hereunder. Any specific right or remedy contained in this Agreement shall not be exclusive but shall be cumulative upon all allowable under applicable law.
8. CONTACT INFORMATION. If you have any questions about this Software Beta Test Agreement, or if you want to contact VMware for any reason, please direct all correspondence to: VMware, Inc., 3401 Hillview Avenue, Palo Alto, CA 94304, United States of America or email info@vmware.com. VMware is a trademark of VMware, Inc.
-</pre></body></html>Ztext/plainUUTF-8P_�https://s3.amazonaws.com/prod.tracker2/resource/2971983/Micro_Cloud_Master_SBTA_08_22_11.txt?AWSAccessKeyId=05YP14W7GHYPY3RGXW82&Expires=1316471475&Signature=2S3YdeiRoit2X1jpPgdErzNUjRw%3D (:Pn��T�T�T�T�U�
@@ -0,0 +1 @@
+address=/<%= @domain %>/<%= @ip %>
View
@@ -0,0 +1,4 @@
+if [ "$reason" = "BOUND" ]; then
+ echo "address=/<%= @domain %>/$new_ip_address" > /etc/dnsmasq.conf
+ service dnsmasq restart
+fi
View
@@ -11,7 +11,7 @@
require 'micro/memory'
require 'micro/proxy'
require 'micro/core_ext'
-
+require 'micro/dns'
module VCAP
module Micro
@@ -23,9 +23,10 @@ def self.run
LOGFILE = "/var/vcap/sys/log/micro/micro.log"
def self.logger
- FileUtils.mkdir_p(File.dirname(LOGFILE))
+ logfile = ENV['LOGFILE'] ? ENV['LOGFILE'] : LOGFILE
+ FileUtils.mkdir_p(File.dirname(logfile))
unless defined? @@logger
- @@logger = Logger.new(LOGFILE, 5, 1024*100)
+ @@logger = Logger.new(logfile, 5, 1024*100)
@@logger.level = Logger::INFO
end
@@logger
@@ -100,6 +101,8 @@ def network_status
else
stat.yellow
end
+ stat += " / #{@network.online_status}" unless @network.online?
+ stat
end
def dns_status
@@ -126,6 +129,7 @@ def menu
menu.choice("reconfigure vcap password") { configure_password }
menu.choice("reconfigure domain") { configure_domain }
menu.choice("reconfigure network [#{@network.type}]") { configure_network }
+ menu.choice("toggle #{@network.online_status} mode") { @network.toggle_online_status }
menu.choice("reconfigure proxy [#{@proxy.name}]") { configure_proxy }
menu.choice("service status [#{service_status}]") { display_services }
menu.choice("restart network") { restart }
@@ -154,7 +158,7 @@ def configure
def configure_password(initial=false)
password = "foo"
confirmation = "bar"
- say("\nSet password Micro Cloud Foundry VM user")
+ say("\nSet password Micro Cloud Foundry VM user (vcap)")
while password != confirmation
password = ask("Password: ") { |q| q.echo = "*" }
confirmation = ask("Confirmation: ") { |q| q.echo = "*" }
@@ -171,22 +175,26 @@ def configure_password(initial=false)
end
def configure_domain(initial=false)
+ ip = VCAP::Micro::Network.local_ip
unless initial
say("\nCreate a new domain or regenerate a token for an existing")
- say("at www.cloudfoundry.com/micro\n")
+ say("at my.cloudfoundry.com/micro\n")
end
- token = ask("\nEnter Micro Cloud Foundry configuration token: ")
+ token = ask("\nEnter Micro Cloud Foundry configuration token or offline domain name:")
if token == "quit" && ! initial
return
- elsif token == "vcap.me"
+ elsif token =~ /[^\.]+\.[^\.]+/
+ # TODO sanity check of admin email
+ email = ask("Admin email: ")
@identity.clear
- @identity.vcap_me
+ @identity.offline(ip, token, email)
else
@identity.clear
@identity.nonce = token
- @identity.install(VCAP::Micro::Network.local_ip)
+ @identity.install(ip)
end
@identity.save
+ DNS.new(ip, @identity.subdomain).generate
unless initial
say("Reconfiguring Micro Cloud Foundry with new settings...")
Bosh::Agent::Monit.stop_services(60) # is it enough to stop only cc?
@@ -253,6 +261,7 @@ def configure_proxy(initial=false)
def configure_memory(initial=false)
mem = @memory.current
say("Reconfiguring Micro Cloud Foundry with new memory: #{mem}")
+ say("Will take up to 5 minutes...")
@memory.save_spec(@memory.update_spec(mem))
@memory.update_previous
unless initial
@@ -384,7 +393,7 @@ def debug_menu
state = @watcher.paused ? "enable" : "disable"
menu.choice("#{state} network watcher") { toggle_watcher }
menu.choice("reapply configuration") { reapply }
- menu.choice("network touble shooting") { network_troubleshooting }
+ menu.choice("network trouble shooting") { network_troubleshooting }
# nasty hack warning:
# exec-ing causes the console program to restart when dpkg-reconfigrue exits
menu.choice("change keyboard layout") do
@@ -393,6 +402,7 @@ def debug_menu
end
menu.choice("return to main menu") { return }
end
+ press_return_to_continue
end
end
View
@@ -0,0 +1,57 @@
+module VCAP::Micro
+ class DNS
+
+ # no reverse for now
+ FILES = {
+ "dnsmasq.conf.erb" => "dnsmasq.conf",
+ "dnsmasq.erb" => "dhcp3/dhclient-enter-hooks.d/dnsmasq"
+ }
+
+ def initialize(ip, domain)
+ @domain = domain
+ @ip = ip
+ end
+
+ def generate(dest="/etc")
+ FILES.each_key do |file|
+ src = File.expand_path("config/#{file}")
+ dst = "#{dest}/#{FILES[file]}"
+ generate_template(src, dst)
+ end
+ restart
+ end
+
+ def generate_template(src, dst)
+ erb = ERB.new(template(src), 0, '%<>')
+ dir = File.dirname(dst)
+ FileUtils.mkdir_p(dir) unless Dir.exist?(dir)
+ File.open(dst, 'w') do |f|
+ f.write(erb.result(binding))
+ end
+ end
+
+ def restart
+ execute "service dnsmasq restart" do |msg|
+ Console.logger.error "failed to restart dnsmasq: #{msg}"
+ end
+ end
+
+ private
+
+ def template(src)
+ File.open(src) do |f|
+ f.read
+ end
+ end
+
+ def execute(cmd)
+ result, status = ex(cmd)
+ yield result if block_given? && status != 0
+ end
+
+ def ex(cmd)
+ result = %x[#{cmd} 2>&1]
+ [result, $?.exitstatus]
+ end
+ end
+end
@@ -88,12 +88,13 @@ def install(ip)
end
# used if you want to work in offline mode
- def vcap_me
- @logger.info("configuring vcap.me")
- @admins = @config['admins'] = [ "admin@vcap.me" ]
- @cloud = @config['cloud'] = "vcap.me"
- @name = @config['name'] = nil
- @ip = @config['ip'] = "127.0.0.1"
+ def offline(ip, domain, admin)
+ @logger.info("configuring offline mode with: #{domain}")
+ @admins = @config['admins'] = [ admin ]
+ name, cloud = domain.split(/\./, 2)
+ @cloud = @config['cloud'] = cloud
+ @name = @config['name'] = name
+ @ip = @config['ip'] = ip
end
# POST /api/v1/micro/token
Oops, something went wrong.

0 comments on commit f7fae21

Please sign in to comment.