rhoconnect 3.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (361) hide show
  1. data/CHANGELOG +208 -0
  2. data/CREDITS +38 -0
  3. data/Gemfile +18 -0
  4. data/Gemfile.lock +97 -0
  5. data/LICENSE +75 -0
  6. data/README.md +10 -0
  7. data/Rakefile +82 -0
  8. data/bench/bench +7 -0
  9. data/bench/bench_runner.rb +112 -0
  10. data/bench/benchapp/Gemfile +21 -0
  11. data/bench/benchapp/Gemfile.lock +76 -0
  12. data/bench/benchapp/Rakefile +22 -0
  13. data/bench/benchapp/application.rb +39 -0
  14. data/bench/benchapp/config.ru +36 -0
  15. data/bench/benchapp/settings/license.key +1 -0
  16. data/bench/benchapp/settings/settings.yml +20 -0
  17. data/bench/benchapp/sources/mock_adapter.rb +55 -0
  18. data/bench/benchapp/sources/queue_mock_adapter.rb +2 -0
  19. data/bench/benchapp/spec/sources/mock_adapter_spec.rb +25 -0
  20. data/bench/benchapp/spec/sources/queue_mock_adapter_spec.rb +25 -0
  21. data/bench/benchapp/spec/spec_helper.rb +42 -0
  22. data/bench/blobapp/Gemfile +31 -0
  23. data/bench/blobapp/Gemfile.lock +103 -0
  24. data/bench/blobapp/Rakefile +25 -0
  25. data/bench/blobapp/application.rb +44 -0
  26. data/bench/blobapp/config.ru +36 -0
  27. data/bench/blobapp/settings/license.key +1 -0
  28. data/bench/blobapp/settings/settings.yml +16 -0
  29. data/bench/blobapp/sources/blob_adapter.rb +71 -0
  30. data/bench/blobapp/spec/sources/blob_adapter_spec.rb +25 -0
  31. data/bench/blobapp/spec/spec_helper.rb +42 -0
  32. data/bench/lib/bench/cli.rb +16 -0
  33. data/bench/lib/bench/logging.rb +13 -0
  34. data/bench/lib/bench/mock_client.rb +41 -0
  35. data/bench/lib/bench/result.rb +50 -0
  36. data/bench/lib/bench/runner.rb +107 -0
  37. data/bench/lib/bench/session.rb +67 -0
  38. data/bench/lib/bench/statistics.rb +56 -0
  39. data/bench/lib/bench/test_data.rb +98 -0
  40. data/bench/lib/bench/timer.rb +10 -0
  41. data/bench/lib/bench/utils.rb +49 -0
  42. data/bench/lib/bench.rb +129 -0
  43. data/bench/lib/testdata/100-data.txt +148 -0
  44. data/bench/lib/testdata/5-data.txt +9 -0
  45. data/bench/lib/testdata/images/icon.ico +0 -0
  46. data/bench/lib/testdata/images/icon.png +0 -0
  47. data/bench/lib/testdata/images/loading-Landscape.png +0 -0
  48. data/bench/lib/testdata/images/loading-LandscapeLeft.png +0 -0
  49. data/bench/lib/testdata/images/loading-LandscapeRight.png +0 -0
  50. data/bench/lib/testdata/images/loading-Portrait.png +0 -0
  51. data/bench/lib/testdata/images/loading-PortraitUpsideDown.png +0 -0
  52. data/bench/lib/testdata/images/loading.png +0 -0
  53. data/bench/lib/testdata/images/loading@2x.png +0 -0
  54. data/bench/run_bench.sh +42 -0
  55. data/bench/run_blob_script.sh +3 -0
  56. data/bench/run_cud_script.sh +3 -0
  57. data/bench/run_query_md_script.sh +3 -0
  58. data/bench/run_query_only_script.sh +3 -0
  59. data/bench/run_query_script.sh +3 -0
  60. data/bench/scripts/blob_cud_script.rb +98 -0
  61. data/bench/scripts/cud_script.rb +92 -0
  62. data/bench/scripts/helpers.rb +101 -0
  63. data/bench/scripts/query_md_script.rb +45 -0
  64. data/bench/scripts/query_only_script.rb +51 -0
  65. data/bench/scripts/query_script.rb +45 -0
  66. data/bench/spec/bench_spec_helper.rb +33 -0
  67. data/bench/spec/logging_spec.rb +15 -0
  68. data/bench/spec/mock_adapter_spec.rb +61 -0
  69. data/bench/spec/mock_client_spec.rb +65 -0
  70. data/bench/spec/result_spec.rb +61 -0
  71. data/bench/spec/utils_spec.rb +36 -0
  72. data/bin/rhoconnect +34 -0
  73. data/bin/rhoconnect-setup +84 -0
  74. data/doc/async-jobs.txt +69 -0
  75. data/doc/authentication.txt +76 -0
  76. data/doc/benchmarks.txt +168 -0
  77. data/doc/blob-sync.txt +130 -0
  78. data/doc/bulk-sync.txt +102 -0
  79. data/doc/client.txt +432 -0
  80. data/doc/command-line.txt +210 -0
  81. data/doc/contributing.txt +60 -0
  82. data/doc/deploying.txt +82 -0
  83. data/doc/install.txt +28 -0
  84. data/doc/introduction.txt +20 -0
  85. data/doc/licensing.txt +18 -0
  86. data/doc/metadata.txt +458 -0
  87. data/doc/migration.txt +182 -0
  88. data/doc/public/css/print.css +29 -0
  89. data/doc/public/css/screen.css +257 -0
  90. data/doc/public/css/style.css +20 -0
  91. data/doc/push.txt +135 -0
  92. data/doc/release.txt +41 -0
  93. data/doc/rest-api.txt +367 -0
  94. data/doc/source-adapters.txt +325 -0
  95. data/doc/stats-middleware.txt +69 -0
  96. data/doc/testing.txt +222 -0
  97. data/doc/tutorial.txt +315 -0
  98. data/doc/web-console.txt +35 -0
  99. data/examples/simple/Rakefile +14 -0
  100. data/examples/simple/application.rb +27 -0
  101. data/examples/simple/config.ru +49 -0
  102. data/examples/simple/settings/license.key +1 -0
  103. data/examples/simple/settings/settings.yml +23 -0
  104. data/examples/simple/sources/sample_adapter.rb +5 -0
  105. data/examples/simple/sources/simple_adapter.rb +5 -0
  106. data/generators/rhoconnect.rb +119 -0
  107. data/generators/templates/application/Gemfile +21 -0
  108. data/generators/templates/application/Rakefile +22 -0
  109. data/generators/templates/application/application.rb +39 -0
  110. data/generators/templates/application/config.ru +36 -0
  111. data/generators/templates/application/settings/license.key +1 -0
  112. data/generators/templates/application/settings/settings.yml +14 -0
  113. data/generators/templates/application/spec/spec_helper.rb +42 -0
  114. data/generators/templates/source/source_adapter.rb +47 -0
  115. data/generators/templates/source/source_spec.rb +25 -0
  116. data/install.sh +408 -0
  117. data/installer/unix-like/rho_connect_install_checkers.rb +140 -0
  118. data/installer/unix-like/rho_connect_install_constants.rb +51 -0
  119. data/installer/unix-like/rho_connect_install_debian.rb +63 -0
  120. data/installer/unix-like/rho_connect_install_dnd.rb +58 -0
  121. data/installer/unix-like/rho_connect_install_get_params.rb +30 -0
  122. data/installer/unix-like/rho_connect_install_installers.rb +142 -0
  123. data/installer/unix-like/rho_connect_install_utilities.rb +85 -0
  124. data/installer/unix-like/rho_connect_install_yum.rb +63 -0
  125. data/installer/unix-like/rhoinstaller.rb +89 -0
  126. data/installer/utils/create_texts.rb +366 -0
  127. data/installer/utils/install_test.rb +140 -0
  128. data/installer/windows/EnvVarUpdate.nsh +328 -0
  129. data/installer/windows/ServiceLib.nsh +369 -0
  130. data/installer/windows/configUi.ini +44 -0
  131. data/installer/windows/icon.ico +0 -0
  132. data/installer/windows/rhosync.nsi +418 -0
  133. data/installer/windows/uninstall.bat +7 -0
  134. data/lib/rhoconnect/api/admin/get_api_token.rb +14 -0
  135. data/lib/rhoconnect/api/admin/get_license_info.rb +8 -0
  136. data/lib/rhoconnect/api/admin/login.rb +6 -0
  137. data/lib/rhoconnect/api/admin/reset.rb +10 -0
  138. data/lib/rhoconnect/api/admin/stats.rb +21 -0
  139. data/lib/rhoconnect/api/application/bulk_data.rb +7 -0
  140. data/lib/rhoconnect/api/application/clientcreate.rb +8 -0
  141. data/lib/rhoconnect/api/application/clientlogin.rb +6 -0
  142. data/lib/rhoconnect/api/application/clientregister.rb +6 -0
  143. data/lib/rhoconnect/api/application/clientreset.rb +6 -0
  144. data/lib/rhoconnect/api/application/query.rb +7 -0
  145. data/lib/rhoconnect/api/application/queue_updates.rb +6 -0
  146. data/lib/rhoconnect/api/application/search.rb +6 -0
  147. data/lib/rhoconnect/api/client/create_client.rb +3 -0
  148. data/lib/rhoconnect/api/client/delete_client.rb +5 -0
  149. data/lib/rhoconnect/api/client/get_client_params.rb +3 -0
  150. data/lib/rhoconnect/api/client/list_client_docs.rb +12 -0
  151. data/lib/rhoconnect/api/client/list_clients.rb +3 -0
  152. data/lib/rhoconnect/api/client/ping.rb +7 -0
  153. data/lib/rhoconnect/api/source/get_adapter.rb +3 -0
  154. data/lib/rhoconnect/api/source/get_db_doc.rb +7 -0
  155. data/lib/rhoconnect/api/source/get_source_params.rb +3 -0
  156. data/lib/rhoconnect/api/source/list_source_docs.rb +10 -0
  157. data/lib/rhoconnect/api/source/list_sources.rb +15 -0
  158. data/lib/rhoconnect/api/source/push_deletes.rb +8 -0
  159. data/lib/rhoconnect/api/source/push_objects.rb +8 -0
  160. data/lib/rhoconnect/api/source/save_adapter.rb +3 -0
  161. data/lib/rhoconnect/api/source/set_db_doc.rb +8 -0
  162. data/lib/rhoconnect/api/source/set_refresh_time.rb +8 -0
  163. data/lib/rhoconnect/api/source/upload_file.rb +4 -0
  164. data/lib/rhoconnect/api/user/create_user.rb +7 -0
  165. data/lib/rhoconnect/api/user/delete_user.rb +9 -0
  166. data/lib/rhoconnect/api/user/list_users.rb +3 -0
  167. data/lib/rhoconnect/api/user/update_user.rb +4 -0
  168. data/lib/rhoconnect/api_token.rb +19 -0
  169. data/lib/rhoconnect/app.rb +76 -0
  170. data/lib/rhoconnect/bulk_data/bulk_data.rb +88 -0
  171. data/lib/rhoconnect/bulk_data/syncdb.index.schema +4 -0
  172. data/lib/rhoconnect/bulk_data/syncdb.schema +41 -0
  173. data/lib/rhoconnect/bulk_data.rb +2 -0
  174. data/lib/rhoconnect/client.rb +96 -0
  175. data/lib/rhoconnect/client_sync.rb +412 -0
  176. data/lib/rhoconnect/console/app/helpers/auth_helper.rb +22 -0
  177. data/lib/rhoconnect/console/app/helpers/extensions.rb +19 -0
  178. data/lib/rhoconnect/console/app/helpers/helpers.rb +57 -0
  179. data/lib/rhoconnect/console/app/public/ThickBox.css +649 -0
  180. data/lib/rhoconnect/console/app/public/home.css +438 -0
  181. data/lib/rhoconnect/console/app/public/images/foot_logo_rhoconnect.png +0 -0
  182. data/lib/rhoconnect/console/app/public/images/header_halo.jpg +0 -0
  183. data/lib/rhoconnect/console/app/public/images/land_separator.gif +0 -0
  184. data/lib/rhoconnect/console/app/public/images/landing_header.jpg +0 -0
  185. data/lib/rhoconnect/console/app/public/images/logo_rhoconnect.png +0 -0
  186. data/lib/rhoconnect/console/app/public/images/rhomobile_rhohub_logo.png +0 -0
  187. data/lib/rhoconnect/console/app/public/images/tabs_separator.png +0 -0
  188. data/lib/rhoconnect/console/app/public/jqplot/excanvas.min.js +35 -0
  189. data/lib/rhoconnect/console/app/public/jqplot/jqplot.barRenderer.min.js +34 -0
  190. data/lib/rhoconnect/console/app/public/jqplot/jqplot.canvasAxisLabelRenderer.js +187 -0
  191. data/lib/rhoconnect/console/app/public/jqplot/jqplot.canvasAxisTickRenderer.js +226 -0
  192. data/lib/rhoconnect/console/app/public/jqplot/jqplot.canvasTextRenderer.js +408 -0
  193. data/lib/rhoconnect/console/app/public/jqplot/jqplot.categoryAxisRenderer.min.js +34 -0
  194. data/lib/rhoconnect/console/app/public/jqplot/jqplot.cursor.js +952 -0
  195. data/lib/rhoconnect/console/app/public/jqplot/jqplot.dateAxisRenderer.js +313 -0
  196. data/lib/rhoconnect/console/app/public/jqplot/jqplot.dateAxisRenderer.min.js +34 -0
  197. data/lib/rhoconnect/console/app/public/jqplot/jqplot.pointLabels.min.js +34 -0
  198. data/lib/rhoconnect/console/app/public/jqplot/jquery-1.4.2.min.js +154 -0
  199. data/lib/rhoconnect/console/app/public/jqplot/jquery.jqplot.min.css +1 -0
  200. data/lib/rhoconnect/console/app/public/jqplot/jquery.jqplot.min.js +34 -0
  201. data/lib/rhoconnect/console/app/public/main.css +7 -0
  202. data/lib/rhoconnect/console/app/public/reset.css +76 -0
  203. data/lib/rhoconnect/console/app/public/style.css +2201 -0
  204. data/lib/rhoconnect/console/app/public/text.txt +0 -0
  205. data/lib/rhoconnect/console/app/routes/adapter.rb +28 -0
  206. data/lib/rhoconnect/console/app/routes/auth.rb +29 -0
  207. data/lib/rhoconnect/console/app/routes/client.rb +31 -0
  208. data/lib/rhoconnect/console/app/routes/docs.rb +145 -0
  209. data/lib/rhoconnect/console/app/routes/heroku.rb +19 -0
  210. data/lib/rhoconnect/console/app/routes/home.rb +63 -0
  211. data/lib/rhoconnect/console/app/routes/timing.rb +242 -0
  212. data/lib/rhoconnect/console/app/routes/user.rb +117 -0
  213. data/lib/rhoconnect/console/app/views/adapter.erb +16 -0
  214. data/lib/rhoconnect/console/app/views/client.erb +30 -0
  215. data/lib/rhoconnect/console/app/views/content.erb +14 -0
  216. data/lib/rhoconnect/console/app/views/doc.erb +8 -0
  217. data/lib/rhoconnect/console/app/views/docdata.erb +28 -0
  218. data/lib/rhoconnect/console/app/views/docs.erb +30 -0
  219. data/lib/rhoconnect/console/app/views/edituser.erb +13 -0
  220. data/lib/rhoconnect/console/app/views/headermenu.erb +40 -0
  221. data/lib/rhoconnect/console/app/views/home.erb +24 -0
  222. data/lib/rhoconnect/console/app/views/index.erb +58 -0
  223. data/lib/rhoconnect/console/app/views/jqplot.erb +52 -0
  224. data/lib/rhoconnect/console/app/views/layout.erb +165 -0
  225. data/lib/rhoconnect/console/app/views/login.erb +26 -0
  226. data/lib/rhoconnect/console/app/views/newuser.erb +17 -0
  227. data/lib/rhoconnect/console/app/views/ping.erb +28 -0
  228. data/lib/rhoconnect/console/app/views/result.erb +11 -0
  229. data/lib/rhoconnect/console/app/views/rightboxlinks.erb +15 -0
  230. data/lib/rhoconnect/console/app/views/select_doc.erb +17 -0
  231. data/lib/rhoconnect/console/app/views/upload_doc.erb +23 -0
  232. data/lib/rhoconnect/console/app/views/user.erb +29 -0
  233. data/lib/rhoconnect/console/app/views/users.erb +12 -0
  234. data/lib/rhoconnect/console/rhoconnect_api.rb +245 -0
  235. data/lib/rhoconnect/console/server.rb +32 -0
  236. data/lib/rhoconnect/console.rb +3 -0
  237. data/lib/rhoconnect/cors.rb +229 -0
  238. data/lib/rhoconnect/credential.rb +9 -0
  239. data/lib/rhoconnect/db_adapter.rb +46 -0
  240. data/lib/rhoconnect/document.rb +49 -0
  241. data/lib/rhoconnect/dynamic_adapter.rb +91 -0
  242. data/lib/rhoconnect/generator.rb +1 -0
  243. data/lib/rhoconnect/jobs/bulk_data_job.rb +203 -0
  244. data/lib/rhoconnect/jobs/ping_job.rb +46 -0
  245. data/lib/rhoconnect/jobs/source_job.rb +16 -0
  246. data/lib/rhoconnect/license.rb +86 -0
  247. data/lib/rhoconnect/lock_ops.rb +11 -0
  248. data/lib/rhoconnect/model.rb +414 -0
  249. data/lib/rhoconnect/ping/android.rb +56 -0
  250. data/lib/rhoconnect/ping/apple.rb +52 -0
  251. data/lib/rhoconnect/ping/blackberry.rb +56 -0
  252. data/lib/rhoconnect/ping.rb +3 -0
  253. data/lib/rhoconnect/read_state.rb +31 -0
  254. data/lib/rhoconnect/rho_indifferent_access.rb +88 -0
  255. data/lib/rhoconnect/server/views/index.erb +13 -0
  256. data/lib/rhoconnect/server.rb +286 -0
  257. data/lib/rhoconnect/source.rb +289 -0
  258. data/lib/rhoconnect/source_adapter.rb +123 -0
  259. data/lib/rhoconnect/source_sync.rb +302 -0
  260. data/lib/rhoconnect/stats/middleware.rb +20 -0
  261. data/lib/rhoconnect/stats/record.rb +108 -0
  262. data/lib/rhoconnect/store.rb +232 -0
  263. data/lib/rhoconnect/tasks.rb +350 -0
  264. data/lib/rhoconnect/test_methods.rb +220 -0
  265. data/lib/rhoconnect/user.rb +95 -0
  266. data/lib/rhoconnect/version.rb +3 -0
  267. data/lib/rhoconnect/x_domain_session_wrapper.rb +53 -0
  268. data/lib/rhoconnect.rb +285 -0
  269. data/rhoconnect.gemspec +67 -0
  270. data/spec/api/admin/api_token_spec.rb +14 -0
  271. data/spec/api/admin/get_api_token_spec.rb +36 -0
  272. data/spec/api/admin/get_license_info_spec.rb +38 -0
  273. data/spec/api/admin/reset_spec.rb +22 -0
  274. data/spec/api/admin/stats_spec.rb +66 -0
  275. data/spec/api/api_helper.rb +21 -0
  276. data/spec/api/application/rhoconnect_api_spec.rb +548 -0
  277. data/spec/api/client/create_client_spec.rb +13 -0
  278. data/spec/api/client/delete_client_spec.rb +13 -0
  279. data/spec/api/client/get_client_params_spec.rb +18 -0
  280. data/spec/api/client/list_client_docs_spec.rb +32 -0
  281. data/spec/api/client/list_clients_spec.rb +22 -0
  282. data/spec/api/client/ping_spec.rb +23 -0
  283. data/spec/api/rhosync_api_spec.rb.orig +606 -0
  284. data/spec/api/source/adapter_spec.rb +29 -0
  285. data/spec/api/source/get_db_doc_spec.rb +21 -0
  286. data/spec/api/source/get_source_params_spec.rb +32 -0
  287. data/spec/api/source/list_source_docs_spec.rb +25 -0
  288. data/spec/api/source/list_sources_spec.rb +26 -0
  289. data/spec/api/source/push_deletes_spec.rb +18 -0
  290. data/spec/api/source/push_objects_spec.rb +27 -0
  291. data/spec/api/source/set_db_doc_spec.rb +19 -0
  292. data/spec/api/source/set_refresh_time_spec.rb +43 -0
  293. data/spec/api/source/upload_file_spec.rb +26 -0
  294. data/spec/api/user/create_user_spec.rb +16 -0
  295. data/spec/api/user/delete_user_spec.rb +36 -0
  296. data/spec/api/user/list_users_spec.rb +30 -0
  297. data/spec/api/user/update_user_spec.rb +31 -0
  298. data/spec/api_token_spec.rb +14 -0
  299. data/spec/app_spec.rb +18 -0
  300. data/spec/apps/emptyapp/application.rb +27 -0
  301. data/spec/apps/emptyapp/settings/license.key +1 -0
  302. data/spec/apps/emptyapp/settings/settings.yml +14 -0
  303. data/spec/apps/rhotestapp/Rakefile +1 -0
  304. data/spec/apps/rhotestapp/application.rb +19 -0
  305. data/spec/apps/rhotestapp/config.ru +1 -0
  306. data/spec/apps/rhotestapp/settings/apple_fake_cert.pem +1 -0
  307. data/spec/apps/rhotestapp/settings/license.key +1 -0
  308. data/spec/apps/rhotestapp/settings/settings.yml +36 -0
  309. data/spec/apps/rhotestapp/sources/base_adapter.rb +9 -0
  310. data/spec/apps/rhotestapp/sources/fixed_schema_adapter.rb +28 -0
  311. data/spec/apps/rhotestapp/sources/sample_adapter.rb +71 -0
  312. data/spec/apps/rhotestapp/sources/simple_adapter.rb +41 -0
  313. data/spec/apps/rhotestapp/sources/sub_adapter.rb +7 -0
  314. data/spec/apps/rhotestapp/vendor/mygem-0.1.0/lib/mygem/mygem.rb +8 -0
  315. data/spec/apps/rhotestapp/vendor/mygem-0.1.0/lib/mygem.rb +1 -0
  316. data/spec/bulk_data/bulk_data_spec.rb +97 -0
  317. data/spec/client_spec.rb +124 -0
  318. data/spec/client_sync_spec.rb +774 -0
  319. data/spec/doc/base.html +72 -0
  320. data/spec/doc/doc_spec.rb +376 -0
  321. data/spec/doc/footer.html +4 -0
  322. data/spec/doc/header.html +30 -0
  323. data/spec/document_spec.rb +31 -0
  324. data/spec/dynamic_adapter_spec.rb +43 -0
  325. data/spec/factories/factories.rb +17 -0
  326. data/spec/generator/generator_spec.rb +58 -0
  327. data/spec/generator/generator_spec_helper.rb +9 -0
  328. data/spec/jobs/bulk_data_job_spec.rb +125 -0
  329. data/spec/jobs/ping_job_spec.rb +102 -0
  330. data/spec/jobs/source_job_spec.rb +29 -0
  331. data/spec/license_spec.rb +66 -0
  332. data/spec/model_spec.rb +273 -0
  333. data/spec/perf/bulk_data_perf_spec.rb +32 -0
  334. data/spec/perf/perf_spec_helper.rb +50 -0
  335. data/spec/perf/store_perf_spec.rb +27 -0
  336. data/spec/ping/android_spec.rb +91 -0
  337. data/spec/ping/apple_spec.rb +70 -0
  338. data/spec/ping/blackberry_spec.rb +62 -0
  339. data/spec/read_state_spec.rb +35 -0
  340. data/spec/rhosync_spec.rb +75 -0
  341. data/spec/server/cors_spec.rb +287 -0
  342. data/spec/server/server_spec.rb +470 -0
  343. data/spec/server/x_domain_session_wrapper_spec.rb +150 -0
  344. data/spec/source_adapter_spec.rb +125 -0
  345. data/spec/source_spec.rb +114 -0
  346. data/spec/source_sync_spec.rb +328 -0
  347. data/spec/spec.opts +4 -0
  348. data/spec/spec_helper.rb +231 -0
  349. data/spec/stats/middleware_spec.rb +53 -0
  350. data/spec/stats/record_spec.rb +92 -0
  351. data/spec/store_spec.rb +251 -0
  352. data/spec/support/shared_examples.rb +168 -0
  353. data/spec/sync_states_spec.rb +72 -0
  354. data/spec/test_methods_spec.rb +134 -0
  355. data/spec/testdata/1000-data.txt +1414 -0
  356. data/spec/testdata/compressed/compress-data.txt +1 -0
  357. data/spec/testdata/upload1.txt +1 -0
  358. data/spec/testdata/upload2.txt +1 -0
  359. data/spec/user_spec.rb +139 -0
  360. data/tasks/redis.rake +206 -0
  361. metadata +706 -0
@@ -0,0 +1,101 @@
1
+ module BenchHelpers
2
+ include Bench::Logging
3
+ include Bench::Utils
4
+
5
+ def client_docname(user_id,client_id,source_name,doctype)
6
+ "client:application:#{user_id}:#{client_id}:#{source_name}:#{doctype}"
7
+ end
8
+
9
+ def source_docname(user_id,source_name,doctype)
10
+ "source:application:#{user_id}:#{source_name}:#{doctype}"
11
+ end
12
+
13
+ def verify_presence_of_keys(expected,actual,session,caller)
14
+ verification_error = 0
15
+ expected.each do |key,object|
16
+ if !actual or !actual.include?(key) or actual[key]['l'] != key
17
+ bench_log "#{session.log_prefix} Verify error at: " + caller
18
+ bench_log "#{session.log_prefix} Unexpected id for object #{key}"
19
+ verification_error += 1
20
+ end
21
+ end
22
+ verification_error
23
+ end
24
+
25
+ def verify_numbers(expected,actual,session,caller)
26
+ if expected != actual
27
+ bench_log "#{session.log_prefix} Verify error at: " + caller
28
+ bench_log "#{session.log_prefix} Expected #{expected}"
29
+ bench_log "#{session.log_prefix} Actual #{actual}"
30
+ 1
31
+ else
32
+ 0
33
+ end
34
+ end
35
+
36
+ def verify_count(session,caller)
37
+ expected = JSON.parse(session.last_result.body)[2]['count']
38
+ result = JSON.parse(session.last_result.body)[5]
39
+ actual = 0
40
+ actual += result['delete'].size if result.include?('delete')
41
+ actual += result['insert'].size if result.include?('insert')
42
+ session.last_result.verification_error += verify_numbers(expected,actual,session,caller)
43
+ end
44
+
45
+ def verify_objects(expected_md,actual,session,marker,caller)
46
+ return if actual.nil?
47
+ actual.each do |key,object|
48
+ if expected_md.include?(key)
49
+ session.last_result.verification_error +=
50
+ compare_and_log(expected_md[key],object,caller)
51
+ else
52
+ bench_log "#{session.log_prefix} Verify error at: " + caller
53
+ bench_log "#{session.log_prefix} Unknown object: #{object.inspect}"
54
+ session.last_result.verification_error += 1
55
+ end
56
+ end
57
+ end
58
+
59
+ def verify_links(session,create_objs,caller)
60
+ links = JSON.parse(session.last_result.body)[5]['links']
61
+ session.last_result.verification_error +=
62
+ verify_presence_of_keys(create_objs,links,session,caller) if links
63
+ end
64
+
65
+ def current_line
66
+ caller(1)[0].to_s
67
+ end
68
+
69
+ def get_all_objects(caller,config,session,expected_md,create_objs=nil,timeout=10)
70
+ session.get "get-cud", "#{config.base_url}/query" do
71
+ {'source_name' => config.adapter_name, 'client_id' => session.client_id, 'p_size' => @datasize}
72
+ end
73
+ sleep rand(timeout)
74
+ token = JSON.parse(session.last_result.body)[1]['token']
75
+ progress_count = JSON.parse(session.last_result.body)[3]['progress_count']
76
+ return progress_count if token == ''
77
+
78
+ verify_count(session,caller+"\n"+current_line)
79
+ verify_objects(expected_md,JSON.parse(session.last_result.body)[5]['insert'],
80
+ session,"get-cud",caller+"\n"+current_line)
81
+ verify_links(session,create_objs,caller+"\n"+current_line) if create_objs
82
+
83
+ while token != '' do
84
+ sleep rand(timeout)
85
+ session.get "ack-cud", "#{config.base_url}/query" do
86
+ { 'source_name' => config.adapter_name,
87
+ 'client_id' => session.client_id,
88
+ 'token' => token}
89
+ end
90
+ session.last_result.verify_code(200)
91
+ verify_count(session,caller+"\n"+current_line)
92
+ verify_objects(expected_md,JSON.parse(session.last_result.body)[5]['insert'],
93
+ session,"ack-cud",caller+"\n"+current_line)
94
+ verify_links(session,create_objs,caller+"\n"+current_line) if create_objs
95
+
96
+ token = JSON.parse(session.last_result.body)[1]['token']
97
+ progress_count = JSON.parse(session.last_result.body)[3]['progress_count']
98
+ end
99
+ progress_count
100
+ end
101
+ end
@@ -0,0 +1,45 @@
1
+ include BenchHelpers
2
+ bench_log "Run sync session, forces source adapter query on every sync request"
3
+
4
+ @datasize = 100
5
+ @expected = Bench.get_test_data(@datasize)
6
+ @all_objects = "[{\"version\":3},{\"token\":\"%s\"},{\"count\":%i},{\"progress_count\":0},{\"total_count\":%i},{\"insert\":""}]"
7
+ @ack_token = "[{\"version\":3},{\"token\":\"\"},{\"count\":0},{\"progress_count\":%i},{\"total_count\":%i},{}]"
8
+
9
+ Bench.config do |config|
10
+ config.concurrency = 2
11
+ config.iterations = 2
12
+ config.user_name = "benchuser"
13
+ config.password = "password"
14
+ config.get_test_server
15
+ config.reset_app
16
+ config.set_server_state("test_db_storage:application:#{config.user_name}",@expected)
17
+ config.reset_refresh_time('MockAdapter',0)
18
+ end
19
+
20
+ Bench.test do |config,session|
21
+ sleep rand(10)
22
+ session.post "clientlogin", "#{config.base_url}/clientlogin", :content_type => :json do
23
+ {:login => config.user_name, :password => config.password}.to_json
24
+ end
25
+ sleep rand(10)
26
+ session.get "clientcreate", "#{config.base_url}/clientcreate"
27
+ client_id = JSON.parse(session.last_result.body)['client']['client_id']
28
+ session.get "get-cud", "#{config.base_url}/query" do
29
+ {'source_name' => 'MockAdapter', 'client_id' => client_id, 'p_size' => @datasize}
30
+ end
31
+ sleep rand(10)
32
+ token = JSON.parse(session.last_result.body)[1]['token']
33
+ session.last_result.verify_body([{:version => 3},{:token => token},
34
+ {:count => @datasize},{:progress_count => 0},{:total_count => @datasize},
35
+ {:insert => @expected}].to_json)
36
+ sleep rand(10)
37
+ session.get "ack-cud", "#{config.base_url}/query" do
38
+ { 'source_name' => 'MockAdapter',
39
+ 'client_id' => client_id,
40
+ 'token' => token}
41
+ end
42
+ session.last_result.verify_code(200)
43
+ session.last_result.verify_body([{:version => 3},{:token => ''},{:count => 0},
44
+ {:progress_count => @datasize},{:total_count => @datasize},{}].to_json)
45
+ end
@@ -0,0 +1,51 @@
1
+ include BenchHelpers
2
+ bench_log "Runs simple login,clientcreate,sync session and validates response"
3
+
4
+ @datasize = 100
5
+ @expected = Bench.get_test_data(@datasize)
6
+ @all_objects = "[{\"version\":3},{\"token\":\"%s\"},{\"count\":%i},{\"progress_count\":0},{\"total_count\":%i},{\"insert\":""}]"
7
+ @ack_token = "[{\"version\":3},{\"token\":\"\"},{\"count\":0},{\"progress_count\":%i},{\"total_count\":%i},{}]"
8
+ @clients = []
9
+ @cookies = {}
10
+
11
+ Bench.config do |config|
12
+ config.concurrency = 5
13
+ config.iterations = 2
14
+ config.user_name = "benchuser"
15
+ config.password = "password"
16
+ config.get_test_server
17
+ config.reset_app
18
+ config.set_server_state("test_db_storage:application:#{config.user_name}",@expected)
19
+ config.reset_refresh_time('MockAdapter')
20
+ res = RestClient.post "#{config.base_url}/clientlogin",
21
+ {:login => config.user_name, :password => config.password}, :content_type => :json
22
+ res.cookies['rhoconnect_session'] = CGI.escape(res.cookies['rhoconnect_session'])
23
+ @cookies = res.cookies
24
+ (config.concurrency*config.iterations).times do |i|
25
+ create = RestClient.get "#{config.base_url}/clientcreate", {:cookies => @cookies}
26
+ puts "Created client ##{i}..."
27
+ @clients << JSON.parse(create.body)['client']['client_id']
28
+ end
29
+ end
30
+
31
+ Bench.test do |config,session|
32
+ client_id = @clients[session.thread_id*config.iterations+session.iteration]
33
+ session.cookies = @cookies
34
+ sleep rand(10)
35
+ session.get "get-cud", "#{config.base_url}/query" do
36
+ {'source_name' => 'MockAdapter', 'client_id' => client_id, 'p_size' => @datasize}
37
+ end
38
+ token = JSON.parse(session.last_result.body)[1]['token']
39
+ session.last_result.verify_body([{:version => 3},{:token => token},
40
+ {:count => @datasize},{:progress_count => 0},{:total_count => @datasize},
41
+ {:insert => @expected}].to_json)
42
+ sleep rand(10)
43
+ session.get "ack-cud", "#{config.base_url}/query" do
44
+ { 'source_name' => 'MockAdapter',
45
+ 'client_id' => client_id,
46
+ 'token' => token}
47
+ end
48
+ session.last_result.verify_code(200)
49
+ session.last_result.verify_body([{:version => 3},{:token => ''},{:count => 0},
50
+ {:progress_count => @datasize},{:total_count => @datasize},{}].to_json)
51
+ end
@@ -0,0 +1,45 @@
1
+ include BenchHelpers
2
+ bench_log "Runs simple login,clientcreate,sync session and validates response"
3
+
4
+ @datasize = 100
5
+ @expected = Bench.get_test_data(@datasize)
6
+ @all_objects = "[{\"version\":3},{\"token\":\"%s\"},{\"count\":%i},{\"progress_count\":0},{\"total_count\":%i},{\"insert\":""}]"
7
+ @ack_token = "[{\"version\":3},{\"token\":\"\"},{\"count\":0},{\"progress_count\":%i},{\"total_count\":%i},{}]"
8
+
9
+ Bench.config do |config|
10
+ config.concurrency = 5
11
+ config.iterations = 2
12
+ config.user_name = "benchuser"
13
+ config.password = "password"
14
+ config.get_test_server
15
+ config.reset_app
16
+ config.set_server_state("test_db_storage:application:#{config.user_name}",@expected)
17
+ config.reset_refresh_time('MockAdapter')
18
+ end
19
+
20
+ Bench.test do |config,session|
21
+ sleep rand(10)
22
+ session.post "clientlogin", "#{config.base_url}/clientlogin", :content_type => :json do
23
+ {:login => config.user_name, :password => config.password}.to_json
24
+ end
25
+ sleep rand(10)
26
+ session.get "clientcreate", "#{config.base_url}/clientcreate"
27
+ client_id = JSON.parse(session.last_result.body)['client']['client_id']
28
+ session.get "get-cud", "#{config.base_url}/query" do
29
+ {'source_name' => 'MockAdapter', 'client_id' => client_id, 'p_size' => @datasize}
30
+ end
31
+ sleep rand(10)
32
+ token = JSON.parse(session.last_result.body)[1]['token']
33
+ session.last_result.verify_body([{:version => 3},{:token => token},
34
+ {:count => @datasize},{:progress_count => 0},{:total_count => @datasize},
35
+ {:insert => @expected}].to_json)
36
+ sleep rand(10)
37
+ session.get "ack-cud", "#{config.base_url}/query" do
38
+ { 'source_name' => 'MockAdapter',
39
+ 'client_id' => client_id,
40
+ 'token' => token}
41
+ end
42
+ session.last_result.verify_code(200)
43
+ session.last_result.verify_body([{:version => 3},{:token => ''},{:count => 0},
44
+ {:progress_count => @datasize},{:total_count => @datasize},{}].to_json)
45
+ end
@@ -0,0 +1,33 @@
1
+ require 'rubygems'
2
+ require 'rspec'
3
+ $:.unshift File.join(File.dirname(__FILE__),'..')
4
+ $:.unshift File.join(File.dirname(__FILE__),'..','lib')
5
+ require 'bench/logging'
6
+ require 'bench/mock_client'
7
+ require 'bench/utils'
8
+ require 'bench/result'
9
+ require File.join(File.dirname(__FILE__), '..', '..', 'spec', 'support', 'shared_examples')
10
+
11
+ include Bench
12
+
13
+ def set_state(state)
14
+ state.each do |dockey,data|
15
+ if data.is_a?(Hash) or data.is_a?(Array)
16
+ Store.put_data(dockey,data)
17
+ else
18
+ Store.put_value(dockey,data)
19
+ end
20
+ end
21
+ end
22
+
23
+ def verify_result(result)
24
+ result.each do |dockey,expected|
25
+ if expected.is_a?(Hash)
26
+ Store.get_data(dockey).should == expected
27
+ elsif expected.is_a?(Array)
28
+ Store.get_data(dockey,Array).should == expected
29
+ else
30
+ Store.get_value(dockey).should == expected
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,15 @@
1
+ $:.unshift File.join(File.dirname(__FILE__))
2
+ require 'bench_spec_helper'
3
+
4
+ describe "Logging" do
5
+
6
+ before(:each) do
7
+ @mc = MockClient.new(1,2,123)
8
+ end
9
+
10
+ it "should get prefix" do
11
+ @mc.log_prefix.should == "[T:001|I:002]"
12
+ end
13
+
14
+ end
15
+
@@ -0,0 +1,61 @@
1
+ $:.unshift File.join(File.dirname(__FILE__))
2
+ require 'bench_spec_helper'
3
+ require 'benchapp/sources/mock_adapter'
4
+
5
+ describe "MockAdapter" do
6
+ # it_should_behave_like "BenchSpecHelper"
7
+ it_behaves_like "BenchSpecHelper" do
8
+ before(:each) do
9
+ @s_fields = {
10
+ :source_id => 1,
11
+ :name => 'SampleAdapter',
12
+ :url => 'http://example.com',
13
+ :login => 'testuser',
14
+ :password => 'testpass',
15
+ }
16
+ @s_params = {
17
+ :user_id => 'mock_user_id',
18
+ :app_id => 'mock_app_id'
19
+ }
20
+ @s = Source.create(@s_fields,@s_params)
21
+ @ma = MockAdapter.new(@s)
22
+ end
23
+
24
+ it "should return db name" do
25
+ @ma.db_name.should == "test_db_storage:mock_app_id:mock_user_id"
26
+ end
27
+
28
+ it "should return db lock name" do
29
+ @ma.lock_name.should == "lock:test_db_storage:mock_app_id:mock_user_id"
30
+ end
31
+
32
+ it "should login" do
33
+ @ma.login.should == true
34
+ end
35
+
36
+ it "should query data from db" do
37
+ set_state(@ma.db_name => @data)
38
+ @ma.query.should == @data
39
+ end
40
+
41
+ it "should create object in the db" do
42
+ @product1.merge!('mock_id'=>'1')
43
+ @ma.create(@product1).should == '1'
44
+ verify_result(@ma.db_name => {'1' => @product1})
45
+ end
46
+
47
+ it "should update object in db" do
48
+ set_state(@ma.db_name => @data)
49
+ @ma.update('id' => '3','price' => '99.99')
50
+ @product3['price'] = '99.99'
51
+ verify_result(@ma.db_name => @data)
52
+ end
53
+
54
+ it "should delete object in db" do
55
+ set_state(@ma.db_name => @data)
56
+ del_object = {}.merge!(@product2).merge!('id'=>'2')
57
+ @ma.delete(del_object)
58
+ verify_result(@ma.db_name => {'1' => @product1, '3' => @product3})
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,65 @@
1
+ $:.unshift File.join(File.dirname(__FILE__))
2
+ require 'bench_spec_helper'
3
+
4
+ describe "MockClient" do
5
+ # it_should_behave_like "BenchSpecHelper"
6
+ it_behaves_like "BenchSpecHelper" do
7
+ before(:each) do
8
+ @mc = MockClient.new(1,2,123)
9
+ end
10
+
11
+ it "should return document type" do
12
+ @mc.doc_type.should == "123:mock:cd"
13
+ end
14
+
15
+ it "should insert objects into the client document" do
16
+ @mc.insert(@data)
17
+ verify_result(@mc.doc_type => @data)
18
+ end
19
+
20
+ it "should delete objects from the client document" do
21
+ set_state(@mc.doc_type => @data)
22
+ @mc.delete('1' => @product1,'3' => @product3)
23
+ verify_result(@mc.doc_type => {'2' => @product2})
24
+ end
25
+
26
+ it "should verify state of the client document" do
27
+ set_state(@mc.doc_type => @data)
28
+ @mc.verify(@data).should == true
29
+ @mc.verify('1' => @product1,'3' => @product3).should == false
30
+ end
31
+
32
+ it "should parse server message and insert objects into the client document" do
33
+ message = [{:version => 3},{:token=>'123'},{:count=>3},{:progress_count=>0},{:total_count=>3},{:insert=>@data}].to_json
34
+ @mc.parse message
35
+ verify_result(@mc.doc_type => @data)
36
+ end
37
+
38
+ it "should parse server message and delete objects for the client document" do
39
+ set_state(@mc.doc_type => @data)
40
+ message = [{:version => 3},{:token=>'123'},{:count=>3},{:progress_count=>0},{:total_count=>3},{:delete=>{'2'=>@product2}}].to_json
41
+ @mc.parse message
42
+ verify_result(@mc.doc_type => {'1' => @product1,'3' => @product3})
43
+ end
44
+
45
+ it "should parse server message and insert/delete objects to/from client document" do
46
+ set_state(@mc.doc_type => {'1' => @product1,'2' => @product2})
47
+ message = [{:version => 3},{:token=>'123'},{:count=>3},{:progress_count=>0},{:total_count=>3},
48
+ {:insert=>{'3'=>@product3}},{:delete=>{'2'=>@product2}}].to_json
49
+ @mc.parse message
50
+ verify_result(@mc.doc_type => {'1' => @product1,'3' => @product3})
51
+ end
52
+
53
+ it "should raise exception on wrong message format" do
54
+ message = [{:version => 3},{:token=>'123'},{:count=>3},{:progress_count=>0}].to_json
55
+ lambda { @mc.parse message }.should raise_error(Exception,
56
+ '[T:001|I:002] Wrong message format. Message: "[{\"version\":3},{\"token\":\"123\"},{\"count\":3},{\"progress_count\":0}]"')
57
+ end
58
+
59
+ it "should raise exception on wrong protocol version" do
60
+ message = [{:version => 1},{:token=>'123'},{:count=>3},{:progress_count=>0},{:total_count=>0},{}].to_json
61
+ lambda { @mc.parse message }.should raise_error(Exception,
62
+ '[T:001|I:002] Wrong protocol version. Message: "[{\"version\":1},{\"token\":\"123\"},{\"count\":3},{\"progress_count\":0},{\"total_count\":0},{}]"')
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,61 @@
1
+ $:.unshift File.join(File.dirname(__FILE__))
2
+ require 'bench_spec_helper'
3
+ require 'rest_client'
4
+
5
+ describe "ResultSpec" do
6
+ # it_should_behave_like "BenchSpecHelper"
7
+
8
+ include Utils
9
+ it_behaves_like "BenchSpecHelper" do
10
+ before(:each) do
11
+ @s1 = [{"foo" => {"bar" => "cake"}}]
12
+ @s2 = [{"foo" => {"bar" => "cake1"}},{"hello" => "world"}]
13
+ @result = Result.new("marker",:get,"some/url",0,1)
14
+ client = mock("RestClient")
15
+ client.stub!(:headers).and_return({'header1'=>'headervalue1'})
16
+ client.stub!(:cookies).and_return({'session1'=>'sessval1'})
17
+ client.stub!(:code).and_return(200)
18
+ client.stub!(:to_s).and_return(@s1.to_json)
19
+ @result.last_response = client
20
+ end
21
+
22
+ describe "test @last_response wrapper" do
23
+
24
+ it "shold return 'code'" do
25
+ @result.code.should == 200
26
+ end
27
+
28
+ it "shold return 'body'" do
29
+ JSON.parse(@result.body).should == @s1
30
+ end
31
+
32
+ it "shold return 'cookies'" do
33
+ @result.cookies.should == {'session1'=>'sessval1'}
34
+ end
35
+
36
+ it "shhould return 'headers'" do
37
+ @result.headers.should == {'header1'=>'headervalue1'}
38
+ end
39
+
40
+ end
41
+
42
+ it "should compare two array/hash structures" do
43
+ compare(:expected,@s1,:actual,@s2).should == [{:expected=>"cake",
44
+ :path=>[0, "foo", "bar"], :actual=>"cake1"},
45
+ {:expected=>nil, :path=>[1], :actual=>{"hello"=>"world"}}]
46
+ end
47
+
48
+ it "should verify body" do
49
+ @result.should_receive(:bench_log).exactly(8).times
50
+ @result.verify_body(@s2.to_json)
51
+ @result.verification_error.should == 1
52
+ end
53
+
54
+ it "should verify code" do
55
+ @result.should_receive(:bench_log).exactly(4).times
56
+ @result.verify_code(500)
57
+ @result.verification_error.should == 1
58
+ end
59
+ end
60
+
61
+ end
@@ -0,0 +1,36 @@
1
+ $:.unshift File.join(File.dirname(__FILE__))
2
+ require 'bench_spec_helper'
3
+
4
+ describe "UtilsSpec" do
5
+ # it_should_behave_like "BenchSpecHelper"
6
+ include Utils
7
+ include Logging
8
+
9
+ it_behaves_like "BenchSpecHelper" do
10
+ it "should compare two identical hashes" do
11
+ h1 = {'key1' => {'key2' => 'value2'}}
12
+ h2 = {'key1' => {'key2' => 'value2'}}
13
+ compare(:expected,h1,:actual,h2).should == []
14
+ end
15
+
16
+ it "should compare two different hashes" do
17
+ h1 = {'key1' => {'key2' => 'value2'}}
18
+ h2 = {'key1' => {'key2' => 'value3'}}
19
+ compare(:expected,h1,:actual,h2).should ==
20
+ [{:actual=>"value3", :path=>["key1", "key2"], :expected=>"value2"}]
21
+ end
22
+
23
+ it "should compare_and_log two identical hashes" do
24
+ h1 = {'key1' => {'key2' => 'value2'}}
25
+ h2 = {'key1' => {'key2' => 'value2'}}
26
+ Bench::Utils.should_not_receive(:bench_log)
27
+ compare_and_log(h1,h2,'the caller').should == 0
28
+ end
29
+
30
+ it "should compare_and_log two different hashes" do
31
+ h1 = {'key1' => {'key2' => 'value2'}}
32
+ h2 = {'key1' => {'key2' => 'value3'}}
33
+ compare_and_log(h1,h2,'the caller').should == 1
34
+ end
35
+ end
36
+ end
data/bin/rhoconnect ADDED
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'templater'
5
+ require File.join(File.dirname(__FILE__), '..','generators','rhoconnect')
6
+ $:.unshift File.join(File.dirname(__FILE__),'..','lib')
7
+ require File.join(File.dirname(__FILE__), '..','lib','rhoconnect')
8
+
9
+ # Stub this method to force 1.8 compatibility (come on templater!)
10
+ class Encoding
11
+ def find
12
+ "utf-8"
13
+ end
14
+
15
+ def dummy?
16
+ false
17
+ end
18
+ end
19
+
20
+ class String
21
+ def force_encoding(enc)
22
+ return self
23
+ end
24
+ def encoding
25
+ if RUBY_VERSION =~ /1\.8/ and Encoding.responds_to?('new')
26
+ Encoding.new
27
+ else
28
+ Encoding.default_external
29
+ end
30
+ end
31
+ end
32
+
33
+
34
+ Rhoconnect.run_cli(Dir.pwd, 'rhoconnect', Rhoconnect::VERSION, ARGV)
@@ -0,0 +1,84 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ puts "This script is outdated. Please review the rhoconnect documentation for up-to-date install information."
4
+
5
+ # # 1. install packages
6
+ # yes | apt-get update
7
+ # yes | apt-get install build-essential libopenssl-ruby
8
+ # yes | apt-get install libcurl4-openssl-dev
9
+ # yes | apt-get install apache2-prefork-dev apache2-mpm-prefork
10
+ # yes | apt-get install rubygems
11
+ # gem install rhosync SystemTimer --no-ri --no-rdoc
12
+ # gem install passenger --no-ri --no-rdoc
13
+ # yes | /var/lib/gems/1.8/bin/passenger-install-apache2-module
14
+ #
15
+ # # 2. load passenger
16
+ # echo "
17
+ # LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-3.0.7/ext/apache2/mod_passenger.so
18
+ # PassengerRoot /var/lib/gems/1.8/gems/passenger-3.0.7
19
+ # PassengerRuby /usr/bin/ruby1.8
20
+ # " > /etc/apache2/mods-available/passenger.load
21
+ #
22
+ # a2enmod passenger
23
+ # /etc/init.d/apache2 restart
24
+ #
25
+ # # 3. create rhosync app
26
+ # cd /var/www/
27
+ # /var/lib/gems/1.8/bin/rhosync app rhosyncapp1
28
+ # cd rhosyncapp1/
29
+ # mkdir public
30
+ # chown -R www-data:www-data /var/www/rhosyncapp1
31
+ # touch /etc/apache2/sites-available/rhosyncapp1
32
+ # echo "
33
+ # <VirtualHost *:80>
34
+ # ServerName $1
35
+ # DocumentRoot /var/www/rhosyncapp1/public
36
+ # <Directory /var/www/rhosyncapp1/public>
37
+ # AllowOverride all
38
+ # Options -MultiViews
39
+ # </Directory>
40
+ # </VirtualHost>
41
+ # " > /etc/apache2/sites-available/rhosyncapp1
42
+ #
43
+ # # 4. enable rhosync app
44
+ # a2ensite rhosyncapp1
45
+ # /etc/init.d/apache2 reload
46
+ #
47
+ # # 5. install redis and init service
48
+ # cd /root/
49
+ # wget http://redis.googlecode.com/files/redis-2.2.5.tar.gz
50
+ # tar -xzf redis-2.2.5.tar.gz
51
+ # cd redis-2.2.5/src/
52
+ # make; make install
53
+ # mkdir /usr/local/etc/redis
54
+ # mkdir /usr/local/redis
55
+ #
56
+ #
57
+ # wget https://gist.github.com/raw/947446/5c4b6325f892e9da477715e4935f081497957cd7/redis
58
+ # wget https://gist.github.com/raw/947485/b179e16045be76a554e2073f9c8d3dcfd073a11d/redis.conf
59
+ # adduser --system --no-create-home --disabled-login --disabled-password --group redis
60
+ # mv redis /etc/init.d/redis
61
+ # chmod +x /etc/init.d/redis
62
+ # mv redis.conf /usr/local/etc/redis/
63
+ # chown -R redis:redis /usr/local/etc/redis
64
+ # chown -R redis:redis /usr/local/redis
65
+ #
66
+ # touch /var/log/redis.log
67
+ # chown redis:redis /var/log/redis.log
68
+ # update-rc.d -f redis defaults
69
+ #
70
+ # /etc/init.d/redis start
71
+ #
72
+ # cd /root/
73
+ # rm -rf redis-*
74
+ #
75
+ # # 6. setup resque
76
+ # wget https://gist.github.com/raw/947510/78a36272f92aa0c67a120a36fd69ea600159676a/resque
77
+ # mv resque /etc/init.d/resque
78
+ # chmod +x /etc/init.d/resque
79
+ #
80
+ # touch /var/log/resque.log
81
+ # chown www-data:www-data /var/log/resque.log
82
+ # update-rc.d -f resque defaults
83
+ #
84
+ # /etc/init.d/resque start