Permalink
Browse files

Merge remote branch 'master' into 'warden'

Change-Id: I0324ac59059cfb1481846b3450fc1558d6de0ebb
  • Loading branch information...
2 parents 086d2f8 + 6f4acf0 commit ed4f6d5dd099413d9e192ebd70e556632c1e308b @cliffwang cliffwang committed May 21, 2012
Showing with 9,409 additions and 2,641 deletions.
  1. +1 −0 AUTHORS
  2. +4 −4 README.md
  3. +0 −7 bin/services/memcache_service
  4. +4 −0 bin/services/snapshot_manager
  5. +3 −3 cloud_controller/Gemfile
  6. +25 −13 cloud_controller/Gemfile.lock
  7. +25 −14 cloud_controller/app/controllers/apps_controller.rb
  8. +22 −12 cloud_controller/app/controllers/bulk_controller.rb
  9. +15 −4 cloud_controller/app/controllers/services_controller.rb
  10. +18 −10 cloud_controller/app/controllers/staging_controller.rb
  11. +3 −3 cloud_controller/app/controllers/users_controller.rb
  12. +56 −17 cloud_controller/app/models/app.rb
  13. +4 −11 cloud_controller/app/models/app_manager.rb
  14. +10 −5 cloud_controller/app/models/app_package.rb
  15. +11 −4 cloud_controller/app/models/service_config.rb
  16. +1 −1 cloud_controller/app/models/staging_task_log.rb
  17. +2 −2 cloud_controller/app/models/uaa_token.rb
  18. +2 −0 cloud_controller/config/appconfig.rb
  19. +1 −1 cloud_controller/config/cloud_controller.yml
  20. +3 −2 cloud_controller/config/routes.rb
  21. +0 −57 cloud_controller/lib/staging_task_manager.rb
  22. +39 −6 cloud_controller/spec/controllers/services_controller_spec.rb
  23. +1 −1 cloud_controller/spec/models/staging_task_log_spec.rb
  24. +13 −0 cloud_controller/spec/requests/bulk_spec.rb
  25. +0 −46 cloud_controller/spec/staging/staging_task_manager_spec.rb
  26. BIN cloud_controller/vendor/cache/cf-uaa-client-0.0.8.gem
  27. BIN cloud_controller/vendor/cache/interact-0.4.2.gem
  28. BIN cloud_controller/vendor/cache/json_pure-1.6.5.gem
  29. BIN cloud_controller/vendor/cache/json_pure-1.6.6.gem
  30. BIN cloud_controller/vendor/cache/stager-client-0.0.2.gem
  31. BIN cloud_controller/vendor/cache/vcap_common-1.0.10.gem
  32. BIN cloud_controller/vendor/cache/vcap_common-1.0.12.gem
  33. BIN cloud_controller/vendor/cache/vcap_logging-1.0.0.gem
  34. BIN cloud_controller/vendor/cache/vcap_logging-1.0.1.gem
  35. BIN cloud_controller/vendor/cache/vcap_stager-0.1.14.gem
  36. BIN cloud_controller/vendor/cache/{vcap_staging-0.1.50.gem → vcap_staging-0.1.59.gem}
  37. +3 −3 common/Gemfile.lock
  38. +1 −1 common/bin/fetch_gems
  39. +161 −0 common/bin/transform_git_source
  40. +8 −3 common/lib/services/api/clients/service_gateway_client.rb
  41. +1 −1 common/lib/vcap/component.rb
  42. +9 −7 common/spec/functional/component_spec.rb
  43. +3 −1 common/spec/unit/service_gateway_client_spec.rb
  44. +1 −1 common/vcap_common.gemspec
  45. +1 −1 dea/Gemfile.lock
  46. +41 −6 dea/lib/dea/agent.rb
  47. +46 −28 dea/spec/functional/agent_spec.rb
  48. +6 −0 dea/spec/functional/server.ru
  49. +13 −49 dea/spec/functional/spec_helper.rb
  50. BIN dea/vendor/cache/vcap_logging-1.0.0.gem
  51. BIN dea/vendor/cache/vcap_logging-1.0.1.gem
  52. +18 −3 dev_setup/bin/vcap_dev
  53. +26 −8 dev_setup/bin/vcap_dev_setup
  54. +2 −1 dev_setup/cookbooks/acmdb/attributes/default.rb
  55. +1 −0 dev_setup/cookbooks/cloud_controller/attributes/default.rb
  56. +2 −0 dev_setup/cookbooks/cloud_controller/templates/default/node.yml.erb
  57. +12 −0 dev_setup/cookbooks/cloud_controller/templates/default/play.yml.erb
  58. +2 −0 dev_setup/cookbooks/cloud_controller/templates/default/rails3.yml.erb
  59. +1 −0 dev_setup/cookbooks/deployment/attributes/default.rb
  60. +9 −6 dev_setup/cookbooks/deployment/recipes/default.rb
  61. +5 −5 dev_setup/cookbooks/erlang/recipes/default.rb
  62. +0 −49 dev_setup/cookbooks/maven/README.md
  63. +8 −0 dev_setup/cookbooks/maven/README.rdoc
  64. +0 −50 dev_setup/cookbooks/maven/metadata.json
  65. +1 −1 dev_setup/cookbooks/maven/metadata.rb
  66. +28 −2 dev_setup/cookbooks/nginx/attributes/default.rb
  67. +175 −5 dev_setup/cookbooks/nginx/recipes/default.rb
  68. +46 −0 dev_setup/cookbooks/nginx/templates/default/nginx.erb
  69. +129 −43 dev_setup/cookbooks/nginx/templates/default/ubuntu-nginx.conf.erb
  70. +5 −0 dev_setup/cookbooks/node/attributes/node04.rb
  71. +2 −0 dev_setup/cookbooks/node/attributes/node06.rb
  72. +38 −6 dev_setup/cookbooks/node/libraries/nodejs_install.rb
  73. +2 −1 dev_setup/cookbooks/node/recipes/node04.rb
  74. +2 −0 dev_setup/cookbooks/redis/attributes/default.rb
  75. +3 −3 dev_setup/cookbooks/redis/recipes/default.rb
  76. +3 −2 dev_setup/cookbooks/ruby/attributes/default.rb
  77. +1 −0 dev_setup/cookbooks/ruby/attributes/ruby18.rb
  78. +4 −4 dev_setup/cookbooks/ruby/libraries/ruby_install.rb
  79. +7 −0 dev_setup/cookbooks/tomcat/README.md
  80. +4 −0 dev_setup/cookbooks/tomcat/attributes/default.rb
  81. +7 −0 dev_setup/cookbooks/tomcat/metadata.rb
  82. +35 −0 dev_setup/cookbooks/tomcat/recipes/default.rb
  83. +8 −4 dev_setup/cookbooks/uaa/recipes/default.rb
  84. +2 −1 dev_setup/cookbooks/uaa/templates/default/uaa.yml.erb
  85. +4 −2 dev_setup/lib/chefsolo_launch.rb
  86. +1 −0 dev_setup/roles/uaa.json
  87. +1 −1 health_manager/Gemfile
  88. +9 −3 health_manager/Gemfile.lock
  89. +8 −5 health_manager/lib/health_manager.rb
  90. +4 −4 health_manager/spec/health_manager_spec.rb
  91. BIN health_manager/vendor/cache/vcap_common-1.0.10.gem
  92. BIN health_manager/vendor/cache/vcap_logging-1.0.0.gem
  93. +4 −1 package_cache/Gemfile.lock
  94. +1 −1 package_cache/INSTALL
  95. +1 −2 package_cache/README
  96. +2 −10 package_cache/TODO
  97. +3 −5 package_cache/config/package_cache.yml
  98. +4 −10 package_cache/lib/vcap/package_cache.rb
  99. +16 −0 package_cache/lib/vcap/package_cache/builder.rb
  100. +7 −8 package_cache/lib/vcap/package_cache/config.rb
  101. +22 −38 package_cache/lib/vcap/package_cache/gem_builder.rb
  102. +39 −0 package_cache/lib/vcap/package_cache/pkg_build.rb
  103. +1 −1 package_cache/lib/vcap/package_cache/pkg_util.rb
  104. +66 −20 package_cache/lib/vcap/package_cache/server.rb
  105. +103 −0 package_cache/lib/vcap/package_cache/warden_env.rb
  106. +53 −0 package_cache/lib/vcap/package_cache/warden_gem_builder.rb
  107. +1 −1 package_cache/package_cache.gemspec
  108. +1 −2 package_cache/spec/unit/gem_builder_spec.rb
  109. +18 −0 package_cache/spec/unit/spec_helper.rb
  110. +33 −0 package_cache/spec/unit/warden_env_spec.rb
  111. +51 −0 package_cache/spec/unit/warden_gem_builder_spec.rb
  112. BIN package_cache/vendor/cache/vcap_logging-0.1.5.gem
  113. BIN package_cache/vendor/cache/warden-client-0.0.1.gem
  114. +1 −0 package_cache_client/Rakefile
  115. +1 −0 router/Gemfile
  116. +12 −4 router/Gemfile.lock
  117. +7 −4 router/Rakefile
  118. +180 −0 router/ext/nginx/tablesave.lua
  119. +253 −0 router/ext/nginx/uls.lua
  120. +16 −11 router/lib/router.rb
  121. +0 −200 router/lib/router/app_connection.rb
  122. +0 −212 router/lib/router/client_connection.rb
  123. +19 −13 router/lib/router/const.rb
  124. +21 −26 router/lib/router/router.rb
  125. +147 −0 router/lib/router/router_uls_server.rb
  126. +0 −35 router/lib/router/utils.rb
  127. +47 −0 router/spec/Rakefile
  128. +51 −125 router/spec/functional/router_spec.rb
  129. +93 −140 router/spec/functional/spec_helper.rb
  130. +274 −0 router/spec/integration/router_spec.rb
  131. +338 −0 router/spec/integration/spec_helper.rb
  132. 0 router/spec/{functional → lib}/nats_timeout.rb
  133. +135 −0 router/spec/lib/spec_helper.rb
  134. +7 −35 router/spec/unit/router_spec.rb
  135. BIN router/vendor/cache/json_pure-1.6.5.gem
  136. BIN router/vendor/cache/json_pure-1.6.6.gem
  137. BIN router/vendor/cache/nats-0.4.22.beta.8.gem
  138. BIN router/vendor/cache/nats-0.4.22.gem
  139. BIN router/vendor/cache/rack-protection-1.2.0.gem
  140. BIN router/vendor/cache/sinatra-1.3.2.gem
  141. BIN router/vendor/cache/tilt-1.3.3.gem
  142. BIN router/vendor/cache/vcap_common-1.0.10.gem
  143. BIN router/vendor/cache/vcap_common-1.0.9.gem
  144. BIN router/vendor/cache/vcap_logging-1.0.0.gem
  145. BIN router/vendor/cache/vcap_logging-1.0.1.gem
  146. +1 −1 services
  147. +3 −1 stager/Gemfile
  148. +10 −3 stager/Gemfile.lock
  149. +0 −29 stager/bin/download_app
  150. +4 −3 stager/bin/stager
  151. +0 −29 stager/bin/upload_droplet
  152. +3 −4 stager/lib/vcap/stager.rb
  153. +99 −0 stager/lib/vcap/stager/process_runner.rb
  154. +103 −47 stager/lib/vcap/stager/server.rb
  155. +208 −253 stager/lib/vcap/stager/task.rb
  156. +4 −0 stager/lib/vcap/stager/task_error.rb
  157. +0 −94 stager/lib/vcap/stager/task_manager.rb
  158. +0 −222 stager/lib/vcap/stager/util.rb
  159. +35 −0 stager/lib/vcap/stager/workspace.rb
  160. +30 −72 stager/spec/functional/stager_spec.rb
  161. +91 −0 stager/spec/functional/task_spec.rb
  162. +36 −0 stager/spec/support/dummy_http_handler.rb
  163. +16 −0 stager/spec/support/util.rb
  164. +44 −0 stager/spec/unit/process_runner_spec.rb
  165. +0 −74 stager/spec/unit/task_manager_spec.rb
  166. +2 −2 stager/spec/unit/task_result_spec.rb
  167. +0 −117 stager/spec/unit/task_spec.rb
  168. +0 −164 stager/spec/unit/util_spec.rb
  169. +32 −0 stager/spec/unit/workspace_spec.rb
  170. BIN stager/vendor/cache/stager-client-0.0.2.gem
  171. BIN stager/vendor/cache/vcap-concurrency-0.0.1.gem
  172. BIN stager/vendor/cache/vcap_logging-1.0.0.gem
  173. BIN stager/vendor/cache/vcap_logging-1.0.1.gem
  174. BIN stager/vendor/cache/{vcap_staging-0.1.50.gem → vcap_staging-0.1.59.gem}
  175. +1 −1 staging/Gemfile.lock
  176. +3 −0 staging/lib/vcap/staging/plugin/common.rb
  177. +2 −2 staging/lib/vcap/staging/plugin/grails/plugin.rb
  178. +9 −0 staging/lib/vcap/staging/plugin/java_autoconfig.rb
  179. +28 −0 staging/lib/vcap/staging/plugin/java_database_support.rb
  180. +4 −5 staging/lib/vcap/staging/plugin/java_web/plugin.rb
  181. +42 −30 staging/lib/vcap/staging/plugin/java_web/tomcat.rb
  182. +2 −2 staging/lib/vcap/staging/plugin/lift/plugin.rb
  183. +11 −0 staging/lib/vcap/staging/plugin/manifests/play.yml
  184. +31 −0 staging/lib/vcap/staging/plugin/node/npm_support/npm_cache.rb
  185. +57 −0 staging/lib/vcap/staging/plugin/node/npm_support/npm_helper.rb
  186. +156 −0 staging/lib/vcap/staging/plugin/node/npm_support/npm_package.rb
  187. +83 −0 staging/lib/vcap/staging/plugin/node/npm_support/npm_support.rb
  188. +25 −8 staging/lib/vcap/staging/plugin/node/plugin.rb
  189. +23 −0 staging/lib/vcap/staging/plugin/node/resources/versioner/node_modules/semver/LICENSE
  190. +119 −0 staging/lib/vcap/staging/plugin/node/resources/versioner/node_modules/semver/README.md
  191. +69 −0 staging/lib/vcap/staging/plugin/node/resources/versioner/node_modules/semver/bin/semver
  192. +34 −0 staging/lib/vcap/staging/plugin/node/resources/versioner/node_modules/semver/package.json
  193. +305 −0 staging/lib/vcap/staging/plugin/node/resources/versioner/node_modules/semver/semver.js
  194. +397 −0 staging/lib/vcap/staging/plugin/node/resources/versioner/node_modules/semver/test.js
  195. +11 −0 staging/lib/vcap/staging/plugin/node/resources/versioner/package.json
  196. +140 −0 staging/lib/vcap/staging/plugin/node/resources/versioner/versioner.js
  197. +55 −0 staging/lib/vcap/staging/plugin/play/plugin.rb
  198. +5 −0 staging/lib/vcap/staging/plugin/play/stage
  199. +2 −1 staging/lib/vcap/staging/plugin/rails3/plugin.rb
  200. BIN ...in/{java_web/resources/auto-reconfiguration-0.6.2.jar → resources/auto-reconfiguration-0.6.4.jar}
  201. BIN staging/lib/vcap/staging/plugin/resources/{cf-autoconfig-0.0.2.gem → cf-autoconfig-0.0.3.gem}
  202. BIN staging/lib/vcap/staging/plugin/{java_web → }/resources/mysql-connector-java-5.1.12-bin.jar
  203. BIN staging/lib/vcap/staging/plugin/{java_web → }/resources/postgresql-9.0-801.jdbc4.jar
  204. +1 −1 staging/lib/vcap/staging/plugin/ruby_autoconfig.rb
  205. +8 −0 staging/lib/vcap/staging/plugin/spring/autostaging_template_spring.xml
  206. +2 −2 staging/lib/vcap/staging/plugin/spring/plugin.rb
  207. +1 −1 staging/lib/vcap/staging/version.rb
  208. BIN staging/spec/fixtures/apps/grails_default_appcontext_and_servlet/source.war
  209. +8 −0 staging/spec/fixtures/apps/node_deps_ignore/source/app.js
  210. +3 −0 staging/spec/fixtures/apps/node_deps_ignore/source/cloudfoundry.json
  211. +22 −0 staging/spec/fixtures/apps/node_deps_ignore/source/node_modules/colors/MIT-LICENSE.txt
  212. +269 −0 staging/spec/fixtures/apps/node_deps_ignore/source/node_modules/colors/colors.js
  213. +28 −0 staging/spec/fixtures/apps/node_deps_ignore/source/node_modules/colors/package.json
  214. 0 staging/spec/fixtures/apps/node_deps_ignore/source/node_modules/colors/patched.js
  215. +7 −0 staging/spec/fixtures/apps/node_deps_ignore/source/npm-shrinkwrap.json
  216. +5 −0 staging/spec/fixtures/apps/node_deps_ignore/source/package.json
  217. +8 −0 staging/spec/fixtures/apps/node_deps_installed/source/app.js
  218. +22 −0 staging/spec/fixtures/apps/node_deps_installed/source/node_modules/colors/MIT-LICENSE.txt
  219. +269 −0 staging/spec/fixtures/apps/node_deps_installed/source/node_modules/colors/colors.js
  220. +28 −0 staging/spec/fixtures/apps/node_deps_installed/source/node_modules/colors/package.json
  221. 0 staging/spec/fixtures/apps/node_deps_installed/source/node_modules/colors/patched.js
  222. +7 −0 staging/spec/fixtures/apps/node_deps_installed/source/npm-shrinkwrap.json
  223. +5 −0 staging/spec/fixtures/apps/node_deps_installed/source/package.json
  224. +8 −0 staging/spec/fixtures/apps/node_deps_native/source/app.js
  225. +3 −0 staging/spec/fixtures/apps/node_deps_native/source/cloudfoundry.json
  226. +9 −0 staging/spec/fixtures/apps/node_deps_native/source/node_modules/bcrypt/CHANGELOG
  227. +19 −0 staging/spec/fixtures/apps/node_deps_native/source/node_modules/bcrypt/LICENSE
  228. +22 −0 staging/spec/fixtures/apps/node_deps_native/source/node_modules/bcrypt/Makefile
  229. +174 −0 staging/spec/fixtures/apps/node_deps_native/source/node_modules/bcrypt/README.md
  230. +6 −0 staging/spec/fixtures/apps/node_deps_native/source/node_modules/bcrypt/bcrypt.js
  231. +40 −0 staging/spec/fixtures/apps/node_deps_native/source/node_modules/bcrypt/package.json
  232. +326 −0 staging/spec/fixtures/apps/node_deps_native/source/node_modules/bcrypt/src/bcrypt.cc
  233. +542 −0 staging/spec/fixtures/apps/node_deps_native/source/node_modules/bcrypt/src/bcrypt_node.cc
  234. +686 −0 staging/spec/fixtures/apps/node_deps_native/source/node_modules/bcrypt/src/blowfish.cc
  235. +99 −0 staging/spec/fixtures/apps/node_deps_native/source/node_modules/bcrypt/src/node_blf.h
  236. +56 −0 staging/spec/fixtures/apps/node_deps_native/source/node_modules/bcrypt/wscript
  237. +7 −0 staging/spec/fixtures/apps/node_deps_native/source/npm-shrinkwrap.json
  238. +7 −0 staging/spec/fixtures/apps/node_deps_native/source/package.json
  239. +8 −0 staging/spec/fixtures/apps/node_deps_patched/source/app.js
  240. +22 −0 staging/spec/fixtures/apps/node_deps_patched/source/node_modules/colors/MIT-LICENSE.txt
  241. +269 −0 staging/spec/fixtures/apps/node_deps_patched/source/node_modules/colors/colors.js
  242. +28 −0 staging/spec/fixtures/apps/node_deps_patched/source/node_modules/colors/package.json
  243. 0 staging/spec/fixtures/apps/node_deps_patched/source/node_modules/colors/patched.js
  244. +5 −0 staging/spec/fixtures/apps/node_deps_patched/source/package.json
  245. +8 −0 staging/spec/fixtures/apps/node_deps_shrinkwrap/source/app.js
  246. +7 −0 staging/spec/fixtures/apps/node_deps_shrinkwrap/source/npm-shrinkwrap.json
  247. +5 −0 staging/spec/fixtures/apps/node_deps_shrinkwrap/source/package.json
  248. +10 −0 staging/spec/fixtures/apps/node_deps_tree/source/app.js
  249. +44 −0 staging/spec/fixtures/apps/node_deps_tree/source/npm-shrinkwrap.json
  250. +5 −0 staging/spec/fixtures/apps/node_deps_tree/source/package.json
  251. +3 −0 staging/spec/fixtures/apps/play_app/source/play-app-dir/start
  252. +1 −0 ...ng/spec/fixtures/apps/play_mysql_app/source/play-app-dir/lib/mysql-connector-java-dummy-5.0.3.jar
  253. +3 −0 staging/spec/fixtures/apps/play_mysql_app/source/play-app-dir/start
  254. +1 −0 ...ing/spec/fixtures/apps/play_postgres_app/source/play-app-dir/lib/postgresql-8.1.1-dummy.jdbc3.jar
  255. +3 −0 staging/spec/fixtures/apps/play_postgres_app/source/play-app-dir/start
  256. BIN staging/spec/fixtures/apps/spring_annotation_context_config_and_servletcontext/source.war
  257. BIN staging/spec/fixtures/apps/spring_annotation_context_config_and_servletcontext_empty/source.war
  258. BIN staging/spec/fixtures/apps/spring_annotation_context_config_and_servletcontext_ns/source.war
  259. BIN staging/spec/fixtures/apps/spring_annotation_context_config_empty_with_servletcontext/source.war
  260. BIN staging/spec/fixtures/apps/spring_annotation_context_config_foo/source.war
  261. BIN staging/spec/fixtures/apps/spring_annotation_servletcontext_no_context_config/source.war
  262. +10 −1 staging/spec/support/staging_spec_helpers.rb
  263. +56 −0 staging/spec/unit/grails_spec.rb
  264. +150 −6 staging/spec/unit/node_spec.rb
  265. +91 −0 staging/spec/unit/play_spec.rb
  266. +1 −1 staging/spec/unit/rack_spec.rb
  267. +2 −2 staging/spec/unit/rails3_spec.rb
  268. +1 −1 staging/spec/unit/sinatra_spec.rb
  269. +0 −1 staging/spec/unit/spec_helper.rb
  270. +368 −3 staging/spec/unit/spring_spec.rb
  271. +1 −1 staging/spec/unit/standalone_spec.rb
  272. +1 −1 tests
  273. +1 −1 uaa
  274. +4 −1 warden-client/lib/warden/client.rb
  275. +1 −1 warden-client/lib/warden/client/version.rb
  276. +2 −2 warden-client/spec/client_spec.rb
  277. +1 −1 warden-client/warden-client.gemspec
  278. +8 −1 warden/README.md
  279. +4 −4 warden/lib/warden/container/base.rb
  280. +1 −1 warden/lib/warden/container/insecure.rb
  281. +6 −2 warden/lib/warden/container/linux.rb
  282. +18 −4 warden/lib/warden/server.rb
  283. +7 −1 warden/root/linux/net.sh
  284. +14 −0 warden/spec/server_linux_spec.rb
  285. +7 −0 warden/spec/support/examples/warden_server.rb
View
@@ -11,6 +11,7 @@
- Adam C. Greenfield { email: adam.greenfield@gmail.com }
- Ananthan Srinivasan { email: asrinivasan@vmware.com, name: AB}
- Andrew Liu { email: aliu@vmware.com}
+- Anfernee Yongkun Gui { email: agui@vmware.com }
- Christian Dupuis { email: cdupuis@vmware.com}
- Derek Collison { email: dcollison@vmware.com }
- Ezra Zygmuntowicz { email: ez@vmware.com }
View
@@ -50,8 +50,8 @@ server VM.
### Step 1: create a pristine VM with ssh
-* setup a VM with a pristine Ubuntu 10.04.2 server 64bit image,
- [download here](http://www.ubuntu.com/download/ubuntu/download)
+* setup a VM with a pristine Ubuntu 10.04.4 server 64bit image,
+ [download here](http://releases.ubuntu.com/lucid/)
* setup your VM with 1G or more of memory
* you may wish to snapshot your VM now in case things go pear shaped
(great snapshot spots are here and after step 4)
@@ -162,8 +162,8 @@ Cut and paste the following app into a ruby file (lets say env.rb):
require 'sinatra'
get '/' do
- host = ENV['VMC_APP_HOST']
- port = ENV['VMC_APP_PORT']
+ host = ENV['VCAP_APP_HOST']
+ port = ENV['VCAP_APP_PORT']
"<h1>XXXXX Hello from the Cloud! via: #{host}:#{port}</h1>"
end
@@ -1,7 +0,0 @@
-#!/usr/bin/env ruby
-# Copyright (c) 2009-2011 VMware, Inc.
-
-ENV['BUNDLE_GEMFILE'] = File.dirname(__FILE__) + '/../../services/memcache/Gemfile'
-$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../services/memcache')
-
-require 'memcache_service'
@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby
+# Copyright (c) 2009-2011 VMware, Inc.
+
+exec(File.expand_path("../../../services/tools/backup/manager/bin/snapshot_manager", __FILE__), *ARGV)
View
@@ -8,12 +8,12 @@ gem 'nats', :require => 'nats/client'
# VCAP common components
gem 'vcap_common', :require => ['vcap/common', 'vcap/component']
gem 'vcap_logging', :require => ['vcap/logging']
-gem 'vcap_staging', '~> 0.1.50'
-gem 'cf-uaa-client', '>= 0.0.8'
+gem 'vcap_staging', '~> 0.1.59'
+gem 'cf-uaa-client', '~> 0.0.10', :git => 'git://github.com/cloudfoundry/uaa.git', :ref => '0000f736'
# For queuing staging tasks
gem 'em-hiredis'
-gem 'vcap_stager', '~> 0.1.14'
+gem 'stager-client', '~> 0.0.2'
# Databases
gem 'sqlite3'
@@ -1,3 +1,16 @@
+GIT
+ remote: git://github.com/cloudfoundry/uaa.git
+ revision: 0000f73653ae3a09279063e4f73f87066a91b14a
+ ref: 0000f736
+ specs:
+ cf-uaa-client (0.0.10)
+ em-http-request (<= 1.0.0.beta.3, < 1.0.1)
+ eventmachine
+ interact
+ json_pure
+ rest-client
+ thor
+
GEM
remote: http://rubygems.org/
specs:
@@ -33,11 +46,6 @@ GEM
arel (2.0.9)
bcrypt-ruby (2.1.4)
builder (2.1.2)
- cf-uaa-client (0.0.8)
- em-http-request (= 1.0.0.beta.3)
- eventmachine
- json_pure
- rest-client
chronic (0.6.4)
ci_reporter (1.6.4)
builder (>= 2.1.2)
@@ -62,7 +70,8 @@ GEM
hiredis (0.3.2)
http_parser.rb (0.5.1)
i18n (0.5.0)
- json_pure (1.6.5)
+ interact (0.4.2)
+ json_pure (1.6.6)
mail (2.2.15)
activesupport (>= 2.3.6)
i18n (>= 0.4.0)
@@ -121,6 +130,10 @@ GEM
rack (~> 1.1)
tilt (>= 1.2.2, < 2.0)
sqlite3 (1.3.3)
+ stager-client (0.0.2)
+ eventmachine
+ nats
+ yajl-ruby
thin (1.3.1)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
@@ -131,15 +144,14 @@ GEM
polyglot (>= 0.3.1)
tzinfo (0.3.26)
uuidtools (2.1.2)
- vcap_common (1.0.10)
+ vcap_common (1.0.12)
eventmachine (~> 0.12.11.cloudfoundry.3)
nats (~> 0.4.22.beta.8)
posix-spawn (~> 0.3.6)
thin (~> 1.3.1)
yajl-ruby (~> 0.8.3)
- vcap_logging (1.0.0)
- vcap_stager (0.1.14)
- vcap_staging (0.1.50)
+ vcap_logging (1.0.1)
+ vcap_staging (0.1.59)
nokogiri (>= 1.4.4)
rake
rspec
@@ -154,7 +166,7 @@ PLATFORMS
DEPENDENCIES
SystemTimer (~> 1.2)
bcrypt-ruby (~> 2.1.4)
- cf-uaa-client (>= 0.0.8)
+ cf-uaa-client (~> 0.0.10)!
ci_reporter
delorean
em-hiredis
@@ -175,10 +187,10 @@ DEPENDENCIES
ruby-hmac (~> 0.4.0)
sinatra
sqlite3
+ stager-client (~> 0.0.2)
thin
uuidtools (~> 2.1.2)
vcap_common
vcap_logging
- vcap_stager (~> 0.1.14)
- vcap_staging (~> 0.1.50)
+ vcap_staging (~> 0.1.59)
yajl-ruby (~> 0.8.3)
@@ -1,4 +1,4 @@
-require 'staging_task_manager'
+require "vcap/stager/client"
class AppsController < ApplicationController
before_filter :require_user, :except => [:download_staged]
@@ -104,7 +104,7 @@ def download_staged
app = App.find_by_id(params[:id])
raise CloudError.new(CloudError::APP_NOT_FOUND) unless app && (app.staged_package_hash == params[:hash])
- path = app.staged_package_path
+ path = app.resolve_staged_package_path
if path && File.exists?(path)
if CloudController.use_nginx
response.headers['X-Accel-Redirect'] = '/droplets/' + File.basename(path)
@@ -219,25 +219,36 @@ def files
private
def stage_app(app)
- task_mgr = StagingTaskManager.new(:logger => CloudController.logger,
- :timeout => AppConfig[:staging][:max_staging_runtime])
dl_uri = StagingController.download_app_uri(app)
ul_hdl = StagingController.create_upload(app)
- result = task_mgr.run_staging_task(app, dl_uri, ul_hdl.upload_uri)
+ client = VCAP::Stager::Client::FiberAware.new(NATS.client,
+ AppConfig[:staging][:queue])
- # Update run count to be consistent with previous staging code
- if result.was_success?
- CloudController.logger.debug("Staging task for app_id=#{app.id} succeded.", :tags => [:staging])
- CloudController.logger.debug1("Details: #{result.task_log}", :tags => [:staging])
+ request = {
+ "app_id" => app.id,
+ "properties" => app.staging_task_properties,
+ "download_uri" => dl_uri,
+ "upload_uri" => ul_hdl.upload_uri,
+ }
+
+ begin
+ result = client.stage(request, AppConfig[:staging][:max_staging_runtime])
+ StagingTaskLog.new(app.id, result["task_log"]).save
+ rescue VCAP::Stager::Client::Error => e
+ result = { "error" => e.to_s }
+ end
+
+ if result["error"]
+ CloudController.logger.warn("Staging for app_id=#{app.id} failed")
+ CloudController.logger.warn("Error: #{result["error"]}")
+ raise CloudError.new(CloudError::APP_STAGING_ERROR, result["error"])
+ else
+ # Update run count to be consistent with previous staging code
+ CloudController.logger.info("Staging for app_id=#{app.id} succeeded")
app.update_staged_package(ul_hdl.upload_path)
app.package_state = 'STAGED'
app.update_run_count()
- else
- CloudController.logger.warn("Staging task for app_id=#{app.id} failed: #{result.error}",
- :tags => [:staging])
- CloudController.logger.debug1("Details: #{result.task_log}", :tags => [:staging])
- raise CloudError.new(CloudError::APP_STAGING_ERROR, result.error.to_s)
end
rescue => e
@@ -1,14 +1,12 @@
class BulkController < ApplicationController
-
skip_before_filter :fetch_user_from_token
before_filter :authenticate_bulk_api
- #the password is randomly generated at startup and is
- #discoverable through NATS.request('cloudcontroller.bulk.credentials')
+ # the password is randomly generated at startup and is
+ # discoverable through NATS.request('cloudcontroller.bulk.credentials')
DEFAULT_BATCH_SIZE = 200
-
def users
render_results_and_token_for_model(User)
end
@@ -18,7 +16,6 @@ def apps
end
private
-
def authenticate_bulk_api
authenticate_or_request_with_http_basic do |user, pass|
if user==AppConfig[:bulk_api][:auth][:user] &&
@@ -29,21 +26,31 @@ def authenticate_bulk_api
false
end
end
-
end
def render_results_and_token_for_model(model)
results = retrieve_results(model)
update_token(results)
- render :json => { :results => hash_by_id(results), :bulk_token => bulk_token }
+ render :json => { :results => hash_by_id(model, results), :bulk_token => bulk_token }
end
def retrieve_results(model)
- model.where(where_clause).limit(batch_size).to_a
+ CloudController.logger.debug("Params: #{params}")
+ CloudController.logger.debug("Retrieving bulk results for bulk_token: #{bulk_token}")
+ CloudController.logger.debug("WHERE-clause: #{where_clause}")
+
+ model.where(where_clause).order('id').limit(batch_size).to_a
+ end
+
+ def hash_by_id(model, arr)
+ arr.inject({}) { |hash, elem| hash[elem.id] = hashify(model,elem); hash }
end
- def hash_by_id arr
- arr.inject({}) { |hash, elem| hash[elem.id] = elem; hash }
+ def hashify(model, record)
+ model.column_names.inject(Hash.new) { |hash, col|
+ hash[col] = record.send(col)
+ hash
+ }
end
def update_token(results)
@@ -55,18 +62,21 @@ def where_clause
end
def sanitize_atom(atom)
- unless atom =~ /^\w+$/
+ atom = atom.to_s
+ unless atom =~ /^[a-zA-Z0-9_]+$/
+ CloudController.logger.error("invalid atom #{atom} in bulk_token #{bulk_token}")
raise CloudError.new(CloudError::BAD_REQUEST, "bad atom #{atom} in bulk_api token")
end
atom
end
-
def batch_size
@batch_size||=params['batch_size'] ? json_param('batch_size').to_i : DEFAULT_BATCH_SIZE
end
def bulk_token
@bulk_token||=params['bulk_token'] ? params['bulk_token'] : {}
+ @bulk_token = Yajl::Parser.parse(@bulk_token) if @bulk_token.kind_of? String
+ @bulk_token
end
end
@@ -10,9 +10,9 @@ class ServicesController < ApplicationController
before_filter :require_service_auth_token, :only => [:create, :delete, :update_handle, :list_handles, :list_brokered_services]
before_filter :require_user, :only => [:provision, :bind, :bind_external, :unbind, :unprovision,
:create_snapshot, :enum_snapshots, :snapshot_details,:rollback_snapshot, :delete_snapshot,
- :serialized_url, :import_from_url, :import_from_data, :job_info]
+ :serialized_url, :create_serialized_url, :import_from_url, :import_from_data, :job_info]
before_filter :require_lifecycle_extension, :only => [:create_snapshot, :enum_snapshots, :snapshot_details,:rollback_snapshot, :delete_snapshot,
- :serialized_url, :import_from_url, :import_from_data, :job_info]
+ :serialized_url, :create_serialized_url, :import_from_url, :import_from_data, :job_info]
rescue_from(JsonMessage::Error) {|e| render :status => 400, :json => {:errors => e.to_s}}
rescue_from(ActiveRecord::RecordInvalid) {|e| render :status => 400, :json => {:errors => e.to_s}}
@@ -243,14 +243,25 @@ def delete_snapshot
render :json => result.extract
end
- # Get the url to download serialized data for an instance
+ # Create serialized url for service snapshot
#
+ def create_serialized_url
+ cfg = ServiceConfig.find_by_user_id_and_name(user.id, params['id'])
+ raise CloudError.new(CloudError::SERVICE_NOT_FOUND) unless cfg
+ raise CloudError.new(CloudError::FORBIDDEN) unless cfg.provisioned_by?(user)
+
+ result = cfg.create_serialized_url params['sid']
+
+ render :json => result.extract
+ end
+
+ # Get the url to download serialized data for an instance
def serialized_url
cfg = ServiceConfig.find_by_user_id_and_name(user.id, params['id'])
raise CloudError.new(CloudError::SERVICE_NOT_FOUND) unless cfg
raise CloudError.new(CloudError::FORBIDDEN) unless cfg.provisioned_by?(user)
- result = cfg.serialized_url
+ result = cfg.serialized_url params['sid']
render :json => result.extract
end
@@ -102,22 +102,30 @@ def download_app
app = App.find_by_id(params[:id])
raise CloudError.new(CloudError::APP_NOT_FOUND) unless app
- path = app.unstaged_package_path
- unless path && File.exists?(path)
+ unless path = app.unstaged_package_path
+ CloudController.logger.error("app_id=#{app.id} has no package")
+ raise CloudError.new(CloudError::APP_NOT_FOUND)
+ end
+
+ unless found = File.exist?(path)
+ # Handle the case where the app exists at the old location: the sha1
+ # of its zipfile.
+ path = app.legacy_unstaged_package_path
+ found = File.exist?(path)
+ end
+
+ unless found
CloudController.logger.error("Couldn't find package path for app_id=#{app.id} (stager=#{request.remote_ip})", :tags => [:staging])
raise CloudError.new(CloudError::APP_NOT_FOUND)
end
+
CloudController.logger.debug("Stager (#{request.remote_ip}) requested app_id=#{app.id} @ path=#{path}", :tags => [:staging])
- if path && File.exists?(path)
- if CloudController.use_nginx
- response.headers['X-Accel-Redirect'] = '/droplets/' + File.basename(path)
- render :nothing => true, :status => 200
- else
- send_file path
- end
+ if CloudController.use_nginx
+ response.headers['X-Accel-Redirect'] = '/droplets/' + File.basename(path)
+ render :nothing => true, :status => 200
else
- raise CloudError.new(CloudError::APP_NOT_FOUND)
+ send_file path
end
end
Oops, something went wrong.

0 comments on commit ed4f6d5

Please sign in to comment.