rhoconnect 3.1.2 → 3.2.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (248) hide show
  1. data/CHANGELOG.md +14 -2
  2. data/CREDITS +151 -10
  3. data/Gemfile +16 -5
  4. data/Gemfile.lock +58 -23
  5. data/Rakefile +70 -50
  6. data/bench/bench_runner.rb +2 -2
  7. data/bench/benchapp/Gemfile +6 -0
  8. data/bench/benchapp/Gemfile.lock +5 -0
  9. data/bench/benchapp/config.ru +2 -0
  10. data/bench/lib/bench/cli.rb +2 -0
  11. data/bench/lib/bench/distr_runner.rb +3 -2
  12. data/bench/lib/bench/runner.rb +1 -1
  13. data/bench/lib/bench.rb +10 -1
  14. data/bench/run_bench.sh +1 -1
  15. data/bench/scripts/test_query_script.rb +2 -1
  16. data/bench/spec/bench_spec_helper.rb +1 -0
  17. data/bin/rhoconnect +9 -27
  18. data/bin/rhoconnect-benchmark +10 -1
  19. data/commands/commands/dtach_commands/dtach_about.rb +6 -0
  20. data/commands/commands/dtach_commands/dtach_install.rb +30 -0
  21. data/commands/commands/redis_commands/redis_about.rb +6 -0
  22. data/commands/commands/redis_commands/redis_attach.rb +6 -0
  23. data/commands/commands/redis_commands/redis_download.rb +33 -0
  24. data/commands/commands/redis_commands/redis_install.rb +26 -0
  25. data/commands/commands/redis_commands/redis_make.rb +9 -0
  26. data/commands/commands/redis_commands/redis_restart.rb +7 -0
  27. data/commands/commands/redis_commands/redis_runner.rb +67 -0
  28. data/commands/commands/redis_commands/redis_start.rb +6 -0
  29. data/commands/commands/redis_commands/redis_startbg.rb +6 -0
  30. data/commands/commands/redis_commands/redis_stop.rb +6 -0
  31. data/commands/commands/rhoconnect/attach.rb +7 -0
  32. data/commands/commands/rhoconnect/clean_start.rb +9 -0
  33. data/commands/commands/rhoconnect/config.rb +15 -0
  34. data/commands/commands/rhoconnect/console.rb +15 -0
  35. data/commands/commands/rhoconnect/console_helper.rb +3 -0
  36. data/commands/commands/rhoconnect/create_user.rb +18 -0
  37. data/commands/commands/rhoconnect/delete_device.rb +9 -0
  38. data/commands/commands/rhoconnect/delete_user.rb +8 -0
  39. data/commands/commands/rhoconnect/flushdb.rb +14 -0
  40. data/commands/commands/rhoconnect/get_token.rb +25 -0
  41. data/commands/commands/rhoconnect/reset.rb +16 -0
  42. data/commands/commands/rhoconnect/reset_refresh.rb +11 -0
  43. data/commands/commands/rhoconnect/restart.rb +7 -0
  44. data/commands/commands/rhoconnect/secret.rb +11 -0
  45. data/commands/commands/rhoconnect/set_admin_password.rb +26 -0
  46. data/commands/commands/rhoconnect/spec.rb +15 -0
  47. data/commands/commands/rhoconnect/start.rb +18 -0
  48. data/commands/commands/rhoconnect/startbg.rb +34 -0
  49. data/commands/commands/rhoconnect/startdebug.rb +35 -0
  50. data/commands/commands/rhoconnect/stop.rb +11 -0
  51. data/commands/commands/rhoconnect/war.rb +32 -0
  52. data/commands/commands/rhoconnect/web.rb +7 -0
  53. data/commands/execute.rb +35 -0
  54. data/commands/generators/app.rb +6 -0
  55. data/commands/generators/source.rb +6 -0
  56. data/commands/utilities/dtach_installed.rb +10 -0
  57. data/doc/benchmarks-running.txt +5 -0
  58. data/doc/command-line.txt +216 -27
  59. data/doc/heroku-addon.txt +1 -1
  60. data/doc/preparing-production.txt +20 -1
  61. data/doc/public/cli.txt +191 -0
  62. data/doc/push-backend-setup.txt +148 -0
  63. data/doc/push-client-setup.txt +61 -0
  64. data/doc/push-server-setup.txt +91 -0
  65. data/doc/push.txt +8 -137
  66. data/doc/rest-api.txt +96 -0
  67. data/doc/settings.txt +1 -1
  68. data/doc/supported-platforms.txt +2 -1
  69. data/doc/tutorial.txt +6 -4
  70. data/examples/simple/Gemfile +39 -0
  71. data/examples/simple/Rakefile +7 -12
  72. data/examples/simple/config.ru +16 -31
  73. data/examples/simple/settings/settings.yml +5 -4
  74. data/examples/simple/sources/product.rb +51 -0
  75. data/generators/templates/application/Gemfile +7 -0
  76. data/generators/templates/application/Rakefile +5 -18
  77. data/generators/templates/application/config.ru +11 -19
  78. data/install.sh +24 -49
  79. data/installer/unix-like/create_texts.rb +71 -123
  80. data/installer/unix-like/post_install.sh +3 -0
  81. data/installer/unix-like/post_uninstall.sh +2 -0
  82. data/installer/unix-like/pre_install.sh +5 -3
  83. data/installer/unix-like/pre_uninstall.sh +14 -6
  84. data/installer/unix-like/rho_connect_install_checkers.rb +1 -1
  85. data/installer/unix-like/rho_connect_install_constants.rb +6 -10
  86. data/installer/unix-like/rho_connect_install_debian.rb +2 -2
  87. data/installer/unix-like/rho_connect_install_dnd.rb +2 -5
  88. data/installer/unix-like/rho_connect_install_installers.rb +15 -23
  89. data/installer/unix-like/rho_connect_install_yum.rb +2 -2
  90. data/installer/utils/constants.rb +4 -4
  91. data/installer/utils/create_sha1.rb +1 -1
  92. data/installer/utils/nix_install_test.rb +32 -31
  93. data/installer/utils/nix_installation.rake +1 -1
  94. data/installer/utils/package_upload/repos.rake +34 -30
  95. data/installer/utils/package_upload/s3_upload.rb +3 -3
  96. data/lib/rhoconnect/api/source/fast_delete.rb +10 -0
  97. data/lib/rhoconnect/api/source/fast_insert.rb +10 -0
  98. data/lib/rhoconnect/api/source/fast_update.rb +10 -0
  99. data/lib/rhoconnect/api/source/get_source_params.rb +1 -1
  100. data/lib/rhoconnect/api/source/list_sources.rb +2 -2
  101. data/lib/rhoconnect/api/source/save_adapter.rb +1 -1
  102. data/lib/rhoconnect/api/source/update_source_params.rb +6 -0
  103. data/lib/rhoconnect/async.rb +82 -0
  104. data/lib/rhoconnect/bulk_data/bulk_data.rb +5 -1
  105. data/lib/rhoconnect/client_sync.rb +18 -3
  106. data/lib/rhoconnect/console/rhoconnect_api.rb +2 -2
  107. data/lib/rhoconnect/console/server.rb +5 -32
  108. data/lib/rhoconnect/console.rb +2 -2
  109. data/lib/rhoconnect/graph_helper.rb +225 -0
  110. data/lib/rhoconnect/jobs/bulk_data_job.rb +24 -2
  111. data/lib/rhoconnect/server.rb +31 -11
  112. data/lib/rhoconnect/source.rb +10 -5
  113. data/lib/rhoconnect/source_sync.rb +32 -2
  114. data/lib/rhoconnect/tasks.rb +19 -108
  115. data/lib/rhoconnect/test_methods.rb +20 -0
  116. data/lib/rhoconnect/utilities.rb +118 -0
  117. data/lib/rhoconnect/version.rb +1 -1
  118. data/lib/rhoconnect/web-console/controllers/admins.js +245 -0
  119. data/lib/rhoconnect/web-console/models/adapter.js +53 -0
  120. data/lib/rhoconnect/web-console/models/client.js +105 -0
  121. data/lib/rhoconnect/web-console/models/doc.js +113 -0
  122. data/lib/rhoconnect/web-console/models/session.js +40 -0
  123. data/lib/rhoconnect/web-console/models/source.js +115 -0
  124. data/lib/rhoconnect/web-console/models/stats.js +84 -0
  125. data/lib/rhoconnect/web-console/models/user.js +111 -0
  126. data/lib/rhoconnect/web-console/public/backbone.js +1432 -0
  127. data/lib/rhoconnect/web-console/public/bootstrap.css +3990 -0
  128. data/lib/rhoconnect/{console/app → web-console}/public/jqplot/excanvas.min.js +0 -0
  129. data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.barRenderer.min.js +0 -0
  130. data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.canvasAxisLabelRenderer.js +0 -0
  131. data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.canvasAxisTickRenderer.js +0 -0
  132. data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.canvasTextRenderer.js +0 -0
  133. data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.categoryAxisRenderer.min.js +0 -0
  134. data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.cursor.js +0 -0
  135. data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.dateAxisRenderer.js +0 -0
  136. data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.dateAxisRenderer.min.js +0 -0
  137. data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.pointLabels.min.js +0 -0
  138. data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jquery-1.4.2.min.js +0 -0
  139. data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jquery.jqplot.min.css +0 -0
  140. data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jquery.jqplot.min.js +0 -0
  141. data/lib/rhoconnect/web-console/public/jquery-1.7.1.min.js +154 -0
  142. data/lib/rhoconnect/web-console/public/rhoconnect-web.js +15 -0
  143. data/lib/rhoconnect/web-console/public/underscore.js +999 -0
  144. data/lib/rhoconnect/web-console/server.rb +55 -0
  145. data/lib/rhoconnect/web-console/templates/index.erb +90 -0
  146. data/lib/rhoconnect/web-console/templates/jqplot.erb +60 -0
  147. data/lib/rhoconnect/web-console/views/api_token.js +16 -0
  148. data/lib/rhoconnect/web-console/views/doc.js +63 -0
  149. data/lib/rhoconnect/web-console/views/edit_user.js +43 -0
  150. data/lib/rhoconnect/web-console/views/home.js +56 -0
  151. data/lib/rhoconnect/web-console/views/index.js +63 -0
  152. data/lib/rhoconnect/web-console/views/new_ping.js +58 -0
  153. data/lib/rhoconnect/web-console/views/new_user.js +29 -0
  154. data/lib/rhoconnect/web-console/views/server_doc.js +103 -0
  155. data/lib/rhoconnect/web-console/views/set_adapter.js +38 -0
  156. data/lib/rhoconnect/web-console/views/settings.js +53 -0
  157. data/lib/rhoconnect/web-console/views/show_device.js +56 -0
  158. data/lib/rhoconnect/web-console/views/show_user.js +38 -0
  159. data/lib/rhoconnect/web-console/views/source_docs.js +30 -0
  160. data/lib/rhoconnect/web-console/views/stats.js +69 -0
  161. data/lib/rhoconnect/web-console/views/users.js +20 -0
  162. data/lib/rhoconnect.rb +2 -1
  163. data/rhoconnect.gemspec +3 -1
  164. data/spec/api/application/rhoconnect_api_spec.rb +3 -5
  165. data/spec/api/source/fast_delete_spec.rb +27 -0
  166. data/spec/api/source/fast_insert_spec.rb +28 -0
  167. data/spec/api/source/fast_update_spec.rb +51 -0
  168. data/spec/api/source/get_source_params_spec.rb +1 -0
  169. data/spec/api/source/update_source_params_spec.rb +24 -0
  170. data/spec/async_spec.rb +19 -0
  171. data/spec/client_sync_spec.rb +19 -2
  172. data/spec/javascripts/PlayerSpec.js +58 -0
  173. data/spec/javascripts/admins_routes_spec.js +117 -0
  174. data/spec/javascripts/admins_spec.js +27 -0
  175. data/spec/javascripts/doc_view_spec.js +37 -0
  176. data/spec/javascripts/edit_user_view_spec.js +44 -0
  177. data/spec/javascripts/helpers/SpecHelper.js +9 -0
  178. data/spec/javascripts/helpers/jasmine-jquery.js +305 -0
  179. data/spec/javascripts/helpers/jasmine-sinon.js +43 -0
  180. data/spec/javascripts/helpers/sinon-1.3.2.js +3551 -0
  181. data/spec/javascripts/home_view_spec.js +39 -0
  182. data/spec/javascripts/index_view_spec.js +42 -0
  183. data/spec/javascripts/new_ping_view_spec.js +48 -0
  184. data/spec/javascripts/new_user_view_spec.js +42 -0
  185. data/spec/javascripts/server_doc_view_spec.js +39 -0
  186. data/spec/javascripts/set_adapter_view_spec.js +32 -0
  187. data/spec/javascripts/show_device_view_spec.js +41 -0
  188. data/spec/javascripts/show_user_view_spec.js +46 -0
  189. data/spec/javascripts/source_docs_view_spec.js +36 -0
  190. data/spec/javascripts/support/jasmine.yml +79 -0
  191. data/spec/javascripts/support/jasmine_config.rb +23 -0
  192. data/spec/javascripts/support/jasmine_runner.rb +32 -0
  193. data/spec/javascripts/users_view_spec.js +35 -0
  194. data/spec/jobs/bulk_data_job_spec.rb +10 -2
  195. data/spec/perf/bulk_data_perf_spec.rb +1 -0
  196. data/spec/server/server_spec.rb +3 -1
  197. data/spec/source_sync_spec.rb +14 -1
  198. data/spec/spec_helper.rb +51 -0
  199. data/spec/store_spec.rb +6 -0
  200. data/spec/test_methods_spec.rb +11 -0
  201. data/tasks/redis.rake +3 -1
  202. metadata +172 -64
  203. data/doc/contributing.txt +0 -60
  204. data/lib/rhoconnect/console/app/helpers/auth_helper.rb +0 -22
  205. data/lib/rhoconnect/console/app/helpers/extensions.rb +0 -19
  206. data/lib/rhoconnect/console/app/helpers/helpers.rb +0 -57
  207. data/lib/rhoconnect/console/app/public/ThickBox.css +0 -649
  208. data/lib/rhoconnect/console/app/public/home.css +0 -431
  209. data/lib/rhoconnect/console/app/public/images/foot_logo_rhoconnect.png +0 -0
  210. data/lib/rhoconnect/console/app/public/images/header_halo.jpg +0 -0
  211. data/lib/rhoconnect/console/app/public/images/land_separator.gif +0 -0
  212. data/lib/rhoconnect/console/app/public/images/landing_header.jpg +0 -0
  213. data/lib/rhoconnect/console/app/public/images/logo_rhoconnect.png +0 -0
  214. data/lib/rhoconnect/console/app/public/images/tabs_separator.png +0 -0
  215. data/lib/rhoconnect/console/app/public/main.css +0 -7
  216. data/lib/rhoconnect/console/app/public/reset.css +0 -76
  217. data/lib/rhoconnect/console/app/public/style.css +0 -2201
  218. data/lib/rhoconnect/console/app/public/text.txt +0 -0
  219. data/lib/rhoconnect/console/app/routes/adapter.rb +0 -28
  220. data/lib/rhoconnect/console/app/routes/auth.rb +0 -29
  221. data/lib/rhoconnect/console/app/routes/client.rb +0 -31
  222. data/lib/rhoconnect/console/app/routes/docs.rb +0 -145
  223. data/lib/rhoconnect/console/app/routes/heroku.rb +0 -19
  224. data/lib/rhoconnect/console/app/routes/home.rb +0 -63
  225. data/lib/rhoconnect/console/app/routes/timing.rb +0 -242
  226. data/lib/rhoconnect/console/app/routes/user.rb +0 -122
  227. data/lib/rhoconnect/console/app/views/adapter.erb +0 -16
  228. data/lib/rhoconnect/console/app/views/client.erb +0 -30
  229. data/lib/rhoconnect/console/app/views/content.erb +0 -14
  230. data/lib/rhoconnect/console/app/views/doc.erb +0 -8
  231. data/lib/rhoconnect/console/app/views/docdata.erb +0 -28
  232. data/lib/rhoconnect/console/app/views/docs.erb +0 -30
  233. data/lib/rhoconnect/console/app/views/edituser.erb +0 -13
  234. data/lib/rhoconnect/console/app/views/headermenu.erb +0 -40
  235. data/lib/rhoconnect/console/app/views/home.erb +0 -24
  236. data/lib/rhoconnect/console/app/views/index.erb +0 -58
  237. data/lib/rhoconnect/console/app/views/jqplot.erb +0 -52
  238. data/lib/rhoconnect/console/app/views/layout.erb +0 -153
  239. data/lib/rhoconnect/console/app/views/login.erb +0 -26
  240. data/lib/rhoconnect/console/app/views/newuser.erb +0 -17
  241. data/lib/rhoconnect/console/app/views/ping.erb +0 -40
  242. data/lib/rhoconnect/console/app/views/result.erb +0 -11
  243. data/lib/rhoconnect/console/app/views/rightboxlinks.erb +0 -15
  244. data/lib/rhoconnect/console/app/views/select_doc.erb +0 -17
  245. data/lib/rhoconnect/console/app/views/upload_doc.erb +0 -23
  246. data/lib/rhoconnect/console/app/views/user.erb +0 -29
  247. data/lib/rhoconnect/console/app/views/users.erb +0 -19
  248. data/lib/rhoconnect/server/views/index.erb +0 -13
@@ -32,6 +32,10 @@ optparse = OptionParser.new do |opts|
32
32
  options[:web_server] = server
33
33
  end #do
34
34
 
35
+ opts.on('-l', '--Logfile file', ' Specify installtion log file') do |file|
36
+ options[:log_file] = file
37
+ end #do
38
+
35
39
  end #do
36
40
 
37
41
  optparse.parse!
@@ -42,6 +46,9 @@ optparse.parse!
42
46
  @ruby_version = options[:rubyVersion]
43
47
  @profile = (@dist == 'debian') ? '~/.profile' : '~/.bash_profile'
44
48
  @server = options[:web_server]
49
+ @log_file = options[:log_file]
50
+
51
+ @passenger_root = Constants::PASSENGER_ROOT
45
52
 
46
53
  def passenger_version
47
54
  (`#{@prefix}/bin/passenger --version`.match /\d+\.\d+\.\d+/)[0]
@@ -229,7 +236,6 @@ end
229
236
 
230
237
  #
231
238
  # Nginx stuff ...
232
-
233
239
  def create_nginx_init
234
240
  nginx_init_script = <<'_NGINX_INIT_SCRIPT_'
235
241
  #!/bin/sh
@@ -300,11 +306,11 @@ _NGINX_INIT_SCRIPT_
300
306
  `chmod +x #{nginx_script}`
301
307
 
302
308
  # Set run levels
303
- # if @dist == 'debian'
304
- # #`update-rc.d -f nginx defaults`
305
- # else
306
- # #`/sbin/chkconfig nginx on`
307
- # end
309
+ # if @dist == 'debian'
310
+ # #`update-rc.d -f nginx defaults`
311
+ # else
312
+ # #`/sbin/chkconfig nginx on`
313
+ # end
308
314
 
309
315
  end
310
316
 
@@ -329,7 +335,6 @@ end
329
335
  def create_nginx_conf_files(app_name)
330
336
  nginx_server_conf = <<'_NGINX_CONF_'
331
337
  user nginx;
332
-
333
338
  worker_processes 4;
334
339
 
335
340
  error_log logs/error.log;
@@ -367,28 +372,40 @@ _NGINX_CONF_
367
372
 
368
373
  Dir.mkdir "/opt/nginx/conf/conf.d" unless File.exist? "/opt/nginx/conf/conf.d"
369
374
  rho_vhost_conf = <<_VHOST_CONF_
375
+ upstream thin_cluster {
376
+ server unix:/tmp/thin.sock;
377
+ #server unix:/tmp/thin.0.sock;
378
+ #server unix:/tmp/thin.1.sock;
379
+ #server unix:/tmp/thin.2.sock;
380
+ #server unix:/tmp/thin.3.sock;
381
+ }
382
+
370
383
  server {
371
384
  listen 80;
372
385
  root /opt/nginx/html/#{app_name}/public; # <-- be sure to point to 'public' folder of your application!
373
- passenger_enabled on;
374
- # access_log off; # <-- disable access logging
375
- # error_log /dev/null crit; # <-- disable error logging, but critical errors only
376
- }
386
+ # access_log off; # <-- disable access logging
387
+ # error_log /dev/null crit; # <-- disable error logging, but critical errors only
388
+
389
+ location / {
390
+ proxy_set_header X-Real-IP $remote_addr;
391
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
392
+ proxy_set_header Host $http_host;
393
+ proxy_redirect off;
394
+
395
+ proxy_pass http://thin_cluster;
396
+ }
397
+
398
+ error_page 500 502 503 504 /50x.html;
399
+ location = /50x.html {
400
+ root html;
401
+ }
402
+ }
377
403
  _VHOST_CONF_
378
- File.open('/opt/nginx/conf/conf.d/rhoconnect.conf', 'w' ) { |f| f << rho_vhost_conf }
379
404
 
380
- passenger_conf = <<_PASSENGER_CONF_
381
- passenger_root /opt/rhoconnect/lib/ruby/gems/1.8/gems/passenger-#{passenger_version};
382
- passenger_ruby /opt/rhoconnect/bin/ruby;
383
- passenger_max_pool_size 20;
384
- passenger_min_instances 6;
385
- _PASSENGER_CONF_
386
- File.open('/opt/nginx/conf/conf.d/passenger.conf', 'w' ) { |f| f << passenger_conf }
405
+ File.open('/opt/nginx/conf/conf.d/rhoconnect.conf', 'w' ) { |f| f << rho_vhost_conf }
387
406
  end
388
-
389
407
  # End of nginx stuff ...
390
408
 
391
-
392
409
  # generate_common_info
393
410
  # Generates the readme info that is common across all distributions
394
411
  def generate_common_info
@@ -456,87 +473,6 @@ _README2_
456
473
  readme
457
474
  end #generate_common_info
458
475
 
459
- def create_passenger_load
460
- if @dist == 'debian'
461
- passenger_load_file = '/etc/apache2/mods-available/passenger.load'
462
- else
463
- passenger_load_file = '/etc/httpd/conf.d/passenger.conf'
464
- end # if
465
-
466
- passenger_load = <<_PASSENGER_LOAD_
467
- LoadModule passenger_module /opt/rhoconnect/lib/ruby/gems/1.8/gems/passenger-#{passenger_version}/ext/apache2/mod_passenger.so
468
- PassengerRoot /opt/rhoconnect/lib/ruby/gems/1.8/gems/passenger-#{passenger_version}
469
- PassengerRuby /opt/rhoconnect/bin/ruby
470
- _PASSENGER_LOAD_
471
-
472
- File.open( passenger_load_file, 'w' ) { |f| f << passenger_load }
473
- end #create_passenger_load
474
-
475
- def create_apache_vhost
476
- if @dist == 'debian'
477
- vhost_file = '/etc/apache2/sites-available/rhoconnect'
478
- else
479
- vhost_file = '/etc/httpd/conf.d/rhoconnect.conf'
480
- end
481
- vhost = <<_VHOST_
482
- <VirtualHost *:80>
483
- ServerName www.yourhost.com
484
- DocumentRoot /var/www/rhoapp/public
485
- PassengerMaxPoolSize 20
486
- PassengerMinInstances 6
487
- #...
488
- <Directory /var/www/rhoconnect/public>
489
- AllowOverride all
490
- Options -MultiViews
491
- </Directory>
492
- </VirtualHost>
493
- _VHOST_
494
-
495
- File.open( vhost_file, 'w' ) { |f| f << vhost }
496
- end #create_apache_vhost
497
-
498
- # The debian Apache2 specific part of the readme and places it in options[:prefix]
499
- def debian_apache_readme
500
- readme = <<_README_
501
- 4) Installer created the following Apache2 configuration files:
502
- - rhoconnect application template (/etc/apache2/sites-available/rhoconnect)
503
- - passenger module (/etc/apache2/mods-available/passenger.load)
504
-
505
- To complete setup of web server
506
- A) Configure virtual host for rhoconnect application:
507
- Edit the file /etc/apache2/sites-available/rhoconnect so that it reflects your specifications.
508
-
509
- B) Enable the virtual host:
510
- sudo a2ensite rhoconnect
511
-
512
- C) Load the passenger.load module
513
- sudo a2enmod passenger
514
-
515
- D) Start server to pick up the changes:
516
- sudo /etc/init.d/apache2 start
517
- _README_
518
-
519
- readme
520
- end
521
-
522
- # The non-debian Apache2 specific part of the readme file and places it in options[:prefix]
523
- def yum_apache_readme
524
- readme = <<_README_
525
- 4) Installer created the following Apache2 configuration files:
526
- - rhoconnect application template (/etc/httpd/conf.d/rhoconnect.conf)
527
- - passenger module (/etc/httpd/conf.d/passenger.conf)
528
-
529
- To complete setup of web server
530
- A) Configure virtual host for rhoconnect application:
531
- Edit the file /etc/httpd/conf.d/rhoconnect.conf so that it reflects your specifications.
532
-
533
- B) As root user start server to pick up the changes:
534
- /sbin/service httpd start
535
- _README_
536
-
537
- readme
538
- end
539
-
540
476
  def nginx_readme
541
477
  readme = <<_NGINX_README_
542
478
  4) Installer compiled Nginx web server (/opt/nginx) with the following configuration files:
@@ -587,6 +523,30 @@ def copy_benchapp(rho_path)
587
523
  `chown -R nginx:nginx benchapp/`
588
524
  end
589
525
 
526
+ def config_and_install_thin_scripts(rho_path)
527
+ puts "Configuring and installing thin scripts ..."
528
+ `#{rho_path}/bin/thin install`
529
+
530
+ # >> Installing thin service at /etc/rc.d/thin ...
531
+ # mkdir -p /etc/rc.d
532
+ # writing /etc/rc.d/thin
533
+ # chmod +x /etc/rc.d/thin
534
+ # mkdir -p /etc/thin
535
+ #
536
+ # To configure thin to start at system boot:
537
+ # on RedHat like systems:
538
+ # sudo /sbin/chkconfig --level 345 thin on
539
+ # on Debian-like systems (Ubuntu):
540
+ # sudo /usr/sbin/update-rc.d -f thin defaults
541
+ # on Gentoo:
542
+ # sudo rc-update add thin default
543
+ #
544
+ # Then put your config files in /etc/thin
545
+
546
+ `#{rho_path}/bin/thin config -C /etc/thin/rhoapp.yml -c /opt/nginx/html/rhoapp/ --socket /tmp/thin.sock --log /opt/nginx/logs/thin.log --pid /var/run/thin.pid -e production`
547
+ `ln -s /etc/rc.d/thin /etc/init.d/.` if File.directory?('/etc/rc.d')
548
+ end
549
+
590
550
  def create_texts
591
551
  if @redis
592
552
  create_redis_init
@@ -595,8 +555,8 @@ def create_texts
595
555
 
596
556
  if @server == 'nginx'
597
557
  create_nginx_init
598
-
599
558
  create_nginx_logrotate
559
+
600
560
  @use_bench_app = File.exist? "#{@prefix}/installer/bench.tar.gz"
601
561
  if @use_bench_app
602
562
  create_nginx_conf_files "benchapp"
@@ -605,12 +565,8 @@ def create_texts
605
565
  create_nginx_conf_files "rhoapp"
606
566
  generate_rhoapp @prefix
607
567
  end
608
-
568
+ config_and_install_thin_scripts(@prefix)
609
569
  distro_info = nginx_readme
610
- else
611
- create_passenger_load
612
- create_apache_vhost
613
- distro_info = (@dist == 'debian') ? debian_apache_readme : yum_apache_readme
614
570
  end
615
571
 
616
572
  common_info = generate_common_info
@@ -641,30 +597,22 @@ _IT_SHOULD_BE_DONE_
641
597
 
642
598
  _NGINX_TO_DO_
643
599
  else
644
- if @server == 'nginx'
645
- server_todo_list = <<_NGINX_TO_DO_
600
+ server_todo_list = <<_NGINX_TO_DO_
646
601
  2) Try rhoconnect 'rhoapp' application, created in /opt/nginx/html directory
647
602
  A) As root user start redis and nginx servers:
648
603
  /etc/init.d/redis start
649
604
  /etc/init.d/nginx start
605
+ /etc/init.d/thin start
650
606
  B) Open RhoConnect application web console in your browser:
651
607
  http://localhost/console/
652
608
 
653
609
  _NGINX_TO_DO_
654
- else
655
- server_todo_list = <<_APACHE2_TO_DO_
656
- 2) Complete setup of Apache2 web server
657
- A) Configure virtual host for your rhoconnect application:
658
- Edit the file /etc/httpd/conf.d/rhoconnect.conf so that it reflects your specifications.
659
- B) As root user start server to pick up the changes:
660
- /sbin/service httpd start
661
-
662
- _APACHE2_TO_DO_
663
- end
664
610
  end
665
611
 
666
- puts afterwords + about_app + "For more details see #{@prefix}/README file."
667
-
668
- end #create_texts
612
+ afterwords << about_app
613
+ afterwords << "For more details see #{@prefix}/README file."
614
+ puts afterwords
615
+ File.open("#{@log_file}", 'a') { |f| f << afterwords } if @log_file
616
+ end
669
617
 
670
618
  create_texts
@@ -1,4 +1,7 @@
1
1
  #!/bin/sh
2
2
 
3
+ #echo "after_install script is running ..."
4
+ echo "Starting rhoconnect installer ..."
5
+
3
6
  cd /opt/rhoconnect/installer
4
7
  ./install.sh
@@ -1,5 +1,7 @@
1
1
  #!/bin/bash
2
2
 
3
+ #echo "after_remove script is running ..."
4
+
3
5
  if [ -d "/opt/rhoconnect" ]; then
4
6
  rm -rf /opt/rhoconnect
5
7
  fi
@@ -1,8 +1,10 @@
1
1
  #!/bin/bash
2
2
 
3
- if [ -d "/opt/rhoconnect" ]; then
4
- rm -rf /opt/rhoconnect
5
- fi
3
+ #echo "before_install script is running ..."
4
+
5
+ #if [ -d "/opt/rhoconnect" ]; then
6
+ # rm -rf /opt/rhoconnect
7
+ #fi
6
8
 
7
9
  #if [ -d "/opt/nginx" ]; then
8
10
  # rm -rf /opt/nginx
@@ -1,23 +1,31 @@
1
1
  #!/bin/bash
2
2
 
3
+ #echo "before_remove script is running ..."
4
+ echo "Stopping rhoconnect services and remove init scripts ..."
5
+
3
6
  # Stop redis
4
7
  if [ -e "/etc/init.d/redis" ]; then
5
8
  /etc/init.d/redis stop
6
- if [[ `which dpkg 2> /dev/null` != "" ]]; then # Debian
9
+ if [[ `which dpkg 2> /dev/null` != "" ]]; then # Debian
7
10
  update-rc.d -f redis remove
8
- elif [[ `which rpm 2> /dev/null` != "" ]]; then # Red Hat
11
+ elif [[ `which rpm 2> /dev/null` != "" ]]; then # Red Hat
9
12
  /sbin/chkconfig redis off
10
13
  fi
11
14
  fi
12
15
 
16
+ #stop thin
17
+ if [ -e "/etc/init.d/thin" ]; then /etc/init.d/thin stop; fi
18
+
13
19
  #stop nginx
14
- if [ -e "/etc/init.d/nginx" ]; then
15
- /etc/init.d/nginx stop
16
- fi
20
+ if [ -e "/etc/init.d/nginx" ]; then /etc/init.d/nginx stop; fi
17
21
 
18
- # /etc/logrotate.d/redis
22
+ #/etc/logrotate.d/redis
19
23
  rm -f /etc/init.d/redis
20
24
  rm -f /etc/logrotate.d/redis
21
25
 
22
26
  rm -f /etc/init.d/nginx
23
27
  rm -f /etc/logrotate.d/nginx
28
+
29
+ rm -f /etc/thin/rhoapp.yml
30
+ rm -f /etc/rc.d/thin
31
+ rm -f /etc/init.d/thin
@@ -110,7 +110,7 @@ module Checkers
110
110
  end #if
111
111
  log_print string
112
112
  rescue
113
- @log.error {"#{@options[:web_server]} web server not unresponsive!"}
113
+ @log.error {"#{@options[:web_server]} web server unresponsive!"}
114
114
  end
115
115
 
116
116
  running
@@ -8,23 +8,19 @@ module Constants
8
8
  "libaprutil1-dev",
9
9
  "dtach"]
10
10
 
11
+ RUBY = "ruby-1.9.3-p125"
11
12
  REDIS = "redis-2.4.10"
12
13
  SQLITE3 = "sqlite-autoconf-3071000"
14
+ NGINX = "nginx-1.0.15"
15
+ PASSENGER_ROOT = "/opt/rhoconnect/lib/ruby/gems/1.9.1/gems/passenger"
13
16
 
14
- RUBY = "ruby-enterprise-1.8.7-2012.02"
15
- Nginx = "nginx-1.0.14"
16
-
17
- SOFTWARE = [ REDIS, SQLITE3, RUBY, Nginx ]
17
+ SOFTWARE = [ REDIS, SQLITE3, RUBY, NGINX ]
18
18
 
19
19
  REDIS_URL = "http://redis.googlecode.com/files/#{ REDIS }.tar.gz"
20
20
  SQLITE3_URL = "http://www.sqlite.org/sqlite-autoconf-3071000.tar.gz"
21
-
22
21
  URLS = [ REDIS_URL, SQLITE3_URL ]
23
-
24
- RUBYGEMS_VERSION = "1.8.15"
25
- GEMS = ["bundler", "passenger",
26
- "thor", "ffaker"] # thor and ffaker required by rhoconnect-benchmark utility
27
-
22
+ GEMS = ["bundler", "thin", "foreman"]
23
+
28
24
  SUPPORTED_PKG_MGRS = ["apt-get", "yum"]
29
25
  SUPPORTED_WEB_SERVERS = ["apache2", "nginx"]
30
26
 
@@ -40,8 +40,8 @@ class Debian
40
40
 
41
41
  #start installing
42
42
  install_all_gems
43
- configure_passenger @options
44
-
43
+ configure_nginx @options
44
+
45
45
  #install rhoconnect
46
46
  install_rhoconnect
47
47
 
@@ -15,9 +15,6 @@ module DownloadAndDocompress
15
15
  downloads += 1
16
16
  end #if
17
17
  end #do
18
- # if downloads == 0
19
- # log_print "Nothing additional to download"
20
- # end #if
21
18
  end #download_and_decompress
22
19
 
23
20
  # wget_download
@@ -26,7 +23,7 @@ module DownloadAndDocompress
26
23
  def wget_download(prefix, url)
27
24
  if !File.exists?("#{ prefix }/#{ get_tarball_name url }") &&
28
25
  !File.directory?("#{ prefix }/#{ get_version url }")
29
- cmd "wget -P #{ prefix } #{ url } "
26
+ cmd "wget -P #{prefix} #{url} -o /dev/null"
30
27
  end #if
31
28
  end #wget_download
32
29
 
@@ -36,7 +33,7 @@ module DownloadAndDocompress
36
33
  def decompress(prefix, url)
37
34
  tarball = get_tarball_name(url)
38
35
  dir = get_version(url)
39
- cmd "tar -xzf #{ prefix }/#{ tarball } -C #{ prefix }" unless File.directory? "#{ prefix }/#{ dir }"
36
+ cmd "tar -xzf #{prefix}/#{tarball} -C #{prefix} > /dev/null 2>&1" unless File.directory? "#{prefix}/#{dir}"
40
37
  end #decompress
41
38
 
42
39
  # get_version
@@ -4,32 +4,24 @@ require 'rho_connect_install_checkers'
4
4
  include Checkers
5
5
 
6
6
  module Installers
7
- # configure_passenger
8
- # This method installs items that were retrieved via wget as well as passenger
9
- def configure_passenger(options)
7
+ def configure_nginx(options)
10
8
  raise "Please stop the web server and then reinstall the package." if check_web_server_running
11
-
12
9
  @options=options
13
- print_header "Configuring passenger ..."
14
- if @options[:web_server]
15
- if @options[:web_server] == "apache2"
16
- print_header "Configuring apache2 to work with passenger ..."
17
- cmd "yes | #{@options[:prefix]}/bin/passenger-install-#{ @options[:web_server] }-module"
18
- elsif @options[:web_server] == "nginx"
19
- nginx_version = Constants::Nginx
20
- print_header "Downloading http://nginx.org/download/#{nginx_version}.tar.gz ..."
21
- cmd "cd #{@options[:prefix]}; wget http://nginx.org/download/#{nginx_version}.tar.gz -o /dev/null; tar -xzvf #{nginx_version}.tar.gz"
22
- print_header "Configuring and compiling Nginx to work with passenger ..."
23
- cmd "#{@options[:prefix]}/bin/passenger-install-nginx-module --auto --prefix=/opt/nginx \
24
- --nginx-source-dir=#{@options[:prefix]}/#{nginx_version} \
25
- --extra-configure-flags='--with-http_ssl_module --with-http_gzip_static_module --user=nginx --group=nginx'"
26
- else
27
- raise "Unsupported web server."
28
- end
10
+ if @options[:web_server] && @options[:web_server] == "nginx"
11
+ nginx_version = Constants::NGINX
12
+ print_header "Downloading http://nginx.org/download/#{nginx_version}.tar.gz ..."
13
+ cmd "cd #{@options[:prefix]}; wget http://nginx.org/download/#{nginx_version}.tar.gz -o /dev/null; tar -xzvf #{nginx_version}.tar.gz"
14
+ print_header "Configuring and compiling Nginx web server ..."
15
+
16
+ Dir.chdir("#{@options[:prefix]}/#{nginx_version}")
17
+ cmd "./configure --prefix=/opt/nginx --with-http_ssl_module --with-http_gzip_static_module --user=nginx --group=nginx"
18
+ cmd "make 2>&1; make install"
19
+ else
20
+ raise "Inernal error: only nginx is supported."
29
21
  end
30
22
  raise "Nginx installation failed." if $? != 0
31
23
  end
32
-
24
+
33
25
  # install_all_gems
34
26
  # This method installs all gems specified in the GEMS list defined in the
35
27
  # Constants file
@@ -90,7 +82,7 @@ module Installers
90
82
  # install_sqlite
91
83
  # This method instaqll sqlite
92
84
  def install_sqlite
93
- print_header "Installing sqlite3 libs ..."
85
+ print_header "Installing sqlite3 ..."
94
86
  Dir.chdir("#{@options[:prefix]}/#{Constants::SQLITE3}")
95
87
  cmd "./configure --prefix=#{@options[:prefix]}"
96
88
  cmd "make 2>&1; make install"
@@ -100,7 +92,7 @@ module Installers
100
92
  # install_rhoconnect
101
93
  # This method installs rhoconnect
102
94
  def install_rhoconnect
103
- print_header "Installing rhoconnect ..."
95
+ print_header "\nInstalling rhoconnect ..."
104
96
  Dir.chdir(@options[:start_dir])
105
97
 
106
98
  cmd "#{@options[:prefix]}/bin/bundle config build.sqlite3 " +
@@ -36,8 +36,8 @@ class Yum
36
36
 
37
37
  #start installing
38
38
  install_all_gems
39
- configure_passenger @options
40
-
39
+ configure_nginx @options
40
+
41
41
  #install rhoconnect
42
42
  install_rhoconnect
43
43
 
@@ -17,14 +17,14 @@ module Constants
17
17
  :key_name => 'jenkinskey',
18
18
  :groups => 'load-test',
19
19
  :user => 'ubuntu'}
20
-
20
+
21
21
  CENTOS_STACK = { :image_id => 'ami-13346656',
22
22
  :flavor_id => 'c1.medium',
23
23
  :key_name => 'jenkinskey',
24
24
  :groups => 'load-test',
25
25
  :user => 'root'}
26
26
 
27
- STACKS = [ UBUNTU_STACK,
27
+ STACKS = [ UBUNTU_STACK,
28
28
  CENTOS_STACK ]
29
29
 
30
30
  DEB_DEPS = [ "build-essential",
@@ -34,11 +34,11 @@ module Constants
34
34
  "libreadline5-dev",
35
35
  "libsqlite3-0",
36
36
  "libsqlite3-dev" ]
37
-
37
+
38
38
  RPM_DEPS = [ "gcc-c++",
39
39
  "zlib-devel",
40
40
  "curl-devel",
41
41
  "pcre-devel",
42
42
  "openssl-devel",
43
- "readline-devel" ]
43
+ "readline-devel" ]
44
44
  end #Constants
@@ -23,4 +23,4 @@ Find.find(dir) do |path|
23
23
  end #do
24
24
 
25
25
  Dir.mkdir(dest_dir) unless File.directory?(dest_dir)
26
- File.open("#{dest_dir}/checksum", 'w') { |f| f.write(dir_digest) }
26
+ File.open("#{dest_dir}/checksum", 'w') { |f| f.write(dir_digest) }