Permalink
Browse files

initial check in.

Change-Id: I770f17211589c30c284cb20fdb22edf52aa03fd8
  • Loading branch information...
0 parents commit 867e326c34607739d4975be06a95337e0bb53be5 Tal Garfinkel committed Jun 7, 2012
Showing with 2,663 additions and 0 deletions.
  1. +15 −0 Gemfile
  2. +71 −0 Gemfile.lock
  3. +20 −0 README
  4. +7 −0 Rakefile
  5. +55 −0 TODO
  6. +21 −0 bin/dea
  7. +90 −0 config/dea.yml
  8. +116 −0 lib/vcap/dea.rb
  9. +10 −0 lib/vcap/dea/.yardoc/checksums
  10. BIN lib/vcap/dea/.yardoc/objects/root.dat
  11. BIN lib/vcap/dea/.yardoc/proxy_types
  12. +80 −0 lib/vcap/dea/app_cache.rb
  13. +100 −0 lib/vcap/dea/config.rb
  14. +11 −0 lib/vcap/dea/convert.rb
  15. +14 −0 lib/vcap/dea/em_fiber_wrap.rb
  16. +117 −0 lib/vcap/dea/env_builder.rb
  17. +7 −0 lib/vcap/dea/errors.rb
  18. +66 −0 lib/vcap/dea/fiber_aware_helpers.rb
  19. +653 −0 lib/vcap/dea/handler.rb
  20. +40 −0 lib/vcap/dea/http_util.rb
  21. +48 −0 lib/vcap/dea/message.rb
  22. +63 −0 lib/vcap/dea/resource_tracker.rb
  23. +210 −0 lib/vcap/dea/server.rb
  24. +39 −0 lib/vcap/dea/snapshot.rb
  25. +5 −0 lib/vcap/dea/version.rb
  26. +178 −0 lib/vcap/dea/warden_env.rb
  27. +4 −0 spec/unit/assets/test_app/startup.sh
  28. +12 −0 spec/unit/config_spec.rb
  29. +14 −0 spec/unit/em_fiber_wrap.rb
  30. +57 −0 spec/unit/fiber_aware_helpers_spec.rb
  31. +46 −0 spec/unit/http_util_spec.rb
  32. +33 −0 spec/unit/old/app_cache_spec_old.rb
  33. +125 −0 spec/unit/old/handle_spec_old.rb
  34. +28 −0 spec/unit/old/server_spec_old.rb
  35. +112 −0 spec/unit/old/spec_helper_old.rb
  36. +37 −0 spec/unit/old/warden_env_spec_old.rb
  37. +27 −0 spec/unit/resource_tracker_spec.rb
  38. +34 −0 spec/unit/spec_helper.rb
  39. +98 −0 test/dea_test
  40. BIN vendor/cache/addressable-2.2.6.gem
  41. BIN vendor/cache/crack-0.1.8.gem
  42. BIN vendor/cache/daemons-1.1.8.gem
  43. BIN vendor/cache/diff-lcs-1.1.3.gem
  44. BIN vendor/cache/em-http-request-0.3.0.gem
  45. BIN vendor/cache/em-posix-spawn-0.0.2.gem
  46. BIN vendor/cache/em-warden-client-0.0.1.gem
  47. BIN vendor/cache/escape_utils-0.2.4.gem
  48. BIN vendor/cache/eventmachine-0.12.10.gem
  49. BIN vendor/cache/json_pure-1.6.5.gem
  50. BIN vendor/cache/little-plugger-1.1.3.gem
  51. BIN vendor/cache/logging-1.6.2.gem
  52. BIN vendor/cache/nats-0.4.10.gem
  53. BIN vendor/cache/posix-spawn-0.3.6.gem
  54. BIN vendor/cache/rack-1.4.1.gem
  55. BIN vendor/cache/rake-0.9.2.2.gem
  56. BIN vendor/cache/rspec-2.8.0.gem
  57. BIN vendor/cache/rspec-core-2.8.0.gem
  58. BIN vendor/cache/rspec-expectations-2.8.0.gem
  59. BIN vendor/cache/rspec-mocks-2.8.0.gem
  60. BIN vendor/cache/thin-1.3.1.gem
  61. BIN vendor/cache/vcap_common-1.0.0.gem
  62. BIN vendor/cache/vcap_logging-0.1.4.gem
  63. BIN vendor/cache/webmock-1.7.4.gem
  64. BIN vendor/cache/yajl-ruby-1.1.0.gem
15 Gemfile
@@ -0,0 +1,15 @@
+source :rubygems
+
+gem 'em-http-request'
+gem 'em-warden-client'
+gem 'em-posix-spawn'
+gem 'nats'
+
+gem 'vcap_common'
+gem 'vcap_logging'
+
+group :test do
+ gem 'rake'
+ gem 'rspec', '>= 2.0.0'
+ gem 'webmock'
+end
@@ -0,0 +1,71 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ addressable (2.2.6)
+ crack (0.1.8)
+ daemons (1.1.8)
+ diff-lcs (1.1.3)
+ em-http-request (0.3.0)
+ addressable (>= 2.0.0)
+ escape_utils
+ eventmachine (>= 0.12.9)
+ em-posix-spawn (0.0.2)
+ eventmachine
+ posix-spawn
+ em-warden-client (0.0.1)
+ eventmachine
+ yajl-ruby
+ escape_utils (0.2.4)
+ eventmachine (0.12.10)
+ json_pure (1.6.5)
+ little-plugger (1.1.3)
+ logging (1.6.2)
+ little-plugger (>= 1.1.3)
+ nats (0.4.10)
+ daemons (>= 1.1.0)
+ eventmachine (>= 0.12.10)
+ json_pure (>= 1.5.1)
+ posix-spawn (0.3.6)
+ rack (1.4.1)
+ rake (0.9.2.2)
+ 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.8.0)
+ thin (1.3.1)
+ daemons (>= 1.0.9)
+ eventmachine (>= 0.12.6)
+ rack (>= 1.0.0)
+ vcap_common (1.0.0)
+ eventmachine (~> 0.12.10)
+ logging (>= 1.5.0)
+ nats
+ posix-spawn
+ rake
+ thin
+ vcap_logging
+ yajl-ruby
+ vcap_logging (0.1.4)
+ rake
+ webmock (1.7.4)
+ addressable (~> 2.2, > 2.2.5)
+ crack (>= 0.1.7)
+ yajl-ruby (1.1.0)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ em-http-request
+ em-posix-spawn
+ em-warden-client
+ nats
+ rake
+ rspec (>= 2.0.0)
+ vcap_common
+ vcap_logging
+ webmock
20 README
@@ -0,0 +1,20 @@
+DEA NG
+------
+
+Some differences from previous version.
+
+-Introduces a more modular structure than the prior DEA incarnation.
+-EM/fiber based concurrency used prevasively.
+-Warden the only supported means of running apps.
+-File downloading handled from within app container.
+
+
+Live updates:
+
+DEA updates: Sending a SIGINT to the DEA to snapshot its state and shutdown. On restart, the DEA will
+resume from this snapshot, and reconnect to and resume containers in the warden.
+
+Warden updates: The DEA depends on the presence of the warden and will shutdown immediately if
+warden goes down. On warden updates, we assume containers cannot be easily resumed, so we rely
+
+
@@ -0,0 +1,7 @@
+require "rspec/core/rake_task"
+require "rspec/core/version"
+
+desc "Run all examples"
+RSpec::Core::RakeTask.new(:spec) do |t|
+ t.rspec_opts = %w[--color --format documentation]
+end
55 TODO
@@ -0,0 +1,55 @@
+###Features:
+
+-fix up dea status handler
+
+-look at how stopped app state gets cleaned up.
+
+-look at how to add crashed app monitoring.
+
+-look into how we do stats monitoring, implement monitoring, finish varz support.
+
+-add resource usage monitoring for memory and disk.
+
+-setup dea file serving using nginx.
+ -figure out authentication story.
+ -create simple nginx conf.
+ -test stand-alone.
+ -move into container.
+ -test in container.
+ -figure out how to package with gem.
+
+-should we sanity check how much memory/disk we advertise?
+
+###Bugz:
+
+-apps can be left in a stopped state...
+
+###Cleanup:
+
+-attend to all XXX
+
+
+###Testing:
+
+-get BVT's running with new DEA.
+
+-fix broken unit tests (e.g. app_cache)
+
+-add server unit test.
+
+-improve/cleanup dea_test tool.
+ -remove vcap requirement, serve sample droplet with thin.
+
+-have dea_test generate diverse start messages.
+
+-add a load test.
+
+###Structure:
+
+ -refactor handler to ease unit testing.
+
+ -add types to all untyped exceptions.
+
+###Packaging/Deployment:
+ -add gem spec
+ -get dea2 bosh packaging.
21 bin/dea
@@ -0,0 +1,21 @@
+#!/usr/bin/env ruby
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+
+require 'rubygems'
+require 'bundler/setup'
+
+$LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
+
+require 'vcap/common'
+require 'vcap/dea'
+
+config_file = VCAP::Dea::Config::DEFAULT_CONFIG_PATH
+
+OptionParser.new do |op|
+ op.on('-c', '--config [FILENAME]', 'Config filename') do |val|
+ config_file = val
+ end
+end.parse!
+
+VCAP::Dea.init(config_file)
+VCAP::Dea.start_server!
@@ -0,0 +1,90 @@
+---
+base_dir: /var/vcap.local/dea2
+pid_filename: /var/vcap/sys/run/dea2.pid
+nats_uri: nats://localhost:4222/
+logging:
+ level: debug
+
+#helpful for development
+reset_at_startup: true
+
+warden_socket_path: /tmp/warden.sock
+
+resources:
+ node_limits:
+ max_memory: 4096
+ max_disk: 409600
+ max_instances: 100
+ default_app_quota:
+ mem_quota: 512
+ disk_quota: 256
+
+# This is where the execution agent determines its available runtimes.
+# version flags are assumed to be '-v' unless noted below.
+
+runtimes:
+ ruby18:
+ executable: /usr/bin/ruby
+ version: 1.8.7
+ version_flag: "-e 'puts RUBY_VERSION'"
+ additional_checks: "-e 'puts RUBY_PATCHLEVEL >= 174'"
+ environment:
+ ruby19:
+ executable: ruby
+ version: 1.9.2
+ version_flag: "-e 'puts RUBY_VERSION'"
+ additional_checks: "-e 'puts RUBY_PATCHLEVEL >= 180'"
+ environment:
+ node:
+ executable: node
+ version: 0.4.12
+ version_flag: '-v'
+ environment:
+ debug_env:
+ run:
+ - NODE_ARGS="--debug=$VCAP_DEBUG_PORT"
+ suspend:
+ - NODE_ARGS="--debug-brk=$VCAP_DEBUG_PORT"
+ node06:
+ executable: node
+ version: 0.6.8
+ version_flag: '-v'
+ environment:
+ debug_env:
+ run:
+ - NODE_ARGS="--debug=$VCAP_DEBUG_PORT"
+ suspend:
+ - NODE_ARGS="--debug-brk=$VCAP_DEBUG_PORT"
+ java:
+ executable: java
+ version: 1.6.0
+ version_flag: '-version'
+ environment:
+ debug_env:
+ run:
+ - JAVA_OPTS="$JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=$VCAP_DEBUG_PORT,server=y,suspend=n"
+ suspend:
+ - JAVA_OPTS="$JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=$VCAP_DEBUG_PORT,server=y,suspend=y"
+ php:
+ executable: php
+ version: 5.3.[2-6]
+ version_flag: '-v'
+ environment:
+ erlangR14B02:
+ executable: /var/vcap/runtimes/erlang-R14B02/bin/erl
+ version: ".* 5.8.3"
+ version_flag: '-version'
+ environment:
+ python2:
+ executable: python
+ version: 2.6.5
+ version_flag: '--version'
+ environment:
+
+# Used for /healthz and /vars endpoints. If not provided random
+# values will be generated on component start. Uncomment to use
+# static values.
+#status:
+# port: 34501
+# user: thin
+# password: thin
Oops, something went wrong.

0 comments on commit 867e326

Please sign in to comment.