rhoconnect 3.4.5 → 4.0.0.beta.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (337) hide show
  1. data/CHANGELOG.md +57 -3
  2. data/Gemfile +9 -7
  3. data/Gemfile.lock +37 -37
  4. data/Rakefile +18 -7
  5. data/bench/benchapp/Gemfile +1 -1
  6. data/bench/benchapp/config.ru +0 -3
  7. data/bench/benchapp/controllers/ruby/application.rb +17 -0
  8. data/bench/benchapp/controllers/ruby/application_controller.rb +17 -0
  9. data/bench/benchapp/controllers/ruby/mock_adapter_controller.rb +8 -0
  10. data/bench/benchapp/controllers/ruby/queue_mock_adapter_controller.rb +8 -0
  11. data/bench/benchapp/{sources → models/ruby}/mock_adapter.rb +1 -1
  12. data/bench/benchapp/{sources → models/ruby}/queue_mock_adapter.rb +0 -0
  13. data/bench/benchapp/spec/{sources → models/ruby}/mock_adapter_spec.rb +1 -1
  14. data/bench/benchapp/spec/{sources → models/ruby}/queue_mock_adapter_spec.rb +1 -1
  15. data/bench/benchapp/spec/spec_helper.rb +2 -2
  16. data/bench/blobapp/Gemfile +1 -1
  17. data/bench/blobapp/config.ru +0 -3
  18. data/bench/blobapp/controllers/ruby/application_controller.rb +17 -0
  19. data/bench/blobapp/controllers/ruby/blob_adapter_controller.rb +8 -0
  20. data/bench/blobapp/{sources → models/ruby}/blob_adapter.rb +9 -2
  21. data/bench/blobapp/spec/{sources → models/ruby}/blob_adapter_spec.rb +1 -1
  22. data/bench/blobapp/spec/spec_helper.rb +1 -1
  23. data/bench/lib/bench/cli.rb +1 -1
  24. data/bench/scripts/blob_cud_script.rb +1 -1
  25. data/bench/scripts/query_md_script.rb +1 -1
  26. data/bench/scripts/query_only_script.rb +1 -1
  27. data/bench/scripts/query_script.rb +1 -1
  28. data/bench/scripts/test_query_script.rb +7 -1
  29. data/bench/spec/mock_adapter_spec.rb +1 -1
  30. data/bench/spec/result_spec.rb +3 -3
  31. data/bin/rhoconnect +5 -3
  32. data/commands/dtach/dtach_install.rb +2 -2
  33. data/commands/execute.rb +8 -3
  34. data/commands/generators/app.rb +3 -3
  35. data/commands/generators/controller.rb +6 -0
  36. data/commands/generators/model.rb +6 -0
  37. data/commands/generators/source.rb +3 -3
  38. data/commands/generators/update.rb +1 -1
  39. data/commands/redis/redis_about.rb +2 -2
  40. data/commands/redis/redis_download.rb +1 -1
  41. data/commands/redis/redis_install.rb +4 -3
  42. data/commands/redis/redis_restart.rb +4 -4
  43. data/commands/redis/redis_start.rb +5 -4
  44. data/commands/redis/redis_startbg.rb +5 -4
  45. data/commands/redis/redis_status.rb +13 -0
  46. data/commands/redis/redis_stop.rb +3 -3
  47. data/commands/rhoconnect/config.rb +28 -16
  48. data/commands/rhoconnect/flushdb.rb +1 -2
  49. data/commands/rhoconnect/get_token.rb +15 -11
  50. data/commands/rhoconnect/restart.rb +13 -5
  51. data/commands/rhoconnect/set_admin_password.rb +8 -8
  52. data/commands/rhoconnect/start.rb +74 -16
  53. data/commands/rhoconnect/startbg.rb +1 -1
  54. data/commands/rhoconnect/startdebug.rb +1 -1
  55. data/commands/rhoconnect/stop.rb +13 -1
  56. data/commands/rhoconnect/web.rb +5 -5
  57. data/commands/rhoconnect_console/console.rb +7 -5
  58. data/commands/{rhoconnect → rhoconnect_spec}/spec.rb +0 -0
  59. data/commands/rhoconnect_war/war.rb +9 -9
  60. data/commands/utilities/blank_app.ru +56 -0
  61. data/commands/utilities/redis_runner.rb +54 -19
  62. data/doc/authentication.txt +80 -6
  63. data/doc/blob-sync.txt +104 -97
  64. data/doc/bulk-sync.txt +1 -1
  65. data/doc/client-java.txt +3 -3
  66. data/doc/client-objc.txt +2 -2
  67. data/doc/client.txt +4 -4
  68. data/doc/command-line.txt +105 -200
  69. data/doc/data-partitioning.txt +40 -0
  70. data/doc/deploying.txt +249 -77
  71. data/doc/extending-rhoconnect-server.txt +40 -57
  72. data/doc/heroku-addon.txt +2 -0
  73. data/doc/install.txt +45 -95
  74. data/doc/introduction.txt +1 -1
  75. data/doc/java-plugin.txt +365 -190
  76. data/doc/metadata.txt +1 -1
  77. data/doc/migration.txt +108 -142
  78. data/doc/preparing-production.txt +1 -1
  79. data/doc/push-backend-setup.txt +2 -0
  80. data/doc/push-client-setup-android.txt +78 -0
  81. data/doc/push-client-setup-bb.txt +81 -0
  82. data/doc/push-client-setup-ios.txt +70 -0
  83. data/doc/push-client-setup-rps.txt +200 -0
  84. data/doc/push-client-setup.txt +63 -66
  85. data/doc/push-server-setup.txt +67 -40
  86. data/doc/push-testing.txt +29 -0
  87. data/doc/push.txt +21 -6
  88. data/doc/rest-api.txt +128 -55
  89. data/doc/rhoconnect-redis-stack.txt +120 -0
  90. data/doc/settings.txt +4 -12
  91. data/doc/source-adapters-intro.txt +28 -0
  92. data/doc/source-adapters.txt +235 -272
  93. data/doc/stats-middleware.txt +9 -29
  94. data/doc/supported-platforms.txt +21 -30
  95. data/doc/testing.txt +40 -42
  96. data/doc/tutorial.txt +72 -57
  97. data/examples/simple/Gemfile +1 -1
  98. data/examples/simple/application.rb +4 -5
  99. data/examples/simple/my_server.rb +2 -2
  100. data/examples/simple/settings/settings.yml +1 -1
  101. data/generators/rhoconnect.rb +151 -50
  102. data/generators/templates/application/Gemfile +1 -1
  103. data/generators/templates/application/Rakefile +3 -3
  104. data/generators/templates/application/config.ru +1 -4
  105. data/generators/templates/application/controllers/application_controller.rb +17 -0
  106. data/generators/templates/application/controllers/js/application_controller.js +14 -0
  107. data/generators/templates/application/controllers/ruby/application_controller.rb +17 -0
  108. data/generators/templates/application/package.json +8 -0
  109. data/generators/templates/application/rcgemfile +2 -5
  110. data/generators/templates/application/settings/settings.yml +3 -3
  111. data/generators/templates/application/spec/application_controller_spec.rb +23 -0
  112. data/generators/templates/application/spec/js_spec.rb +25 -0
  113. data/generators/templates/application/spec/spec_helper.rb +21 -7
  114. data/generators/templates/source/controllers/js/controller.js +7 -0
  115. data/generators/templates/source/controllers/ruby/controller.rb +8 -0
  116. data/generators/templates/source/controllers/ruby/controller_spec.rb +27 -0
  117. data/generators/templates/source/models/js/model.js +46 -0
  118. data/generators/templates/source/{source_adapter.rb → models/ruby/model.rb} +15 -10
  119. data/generators/templates/source/{source_spec.rb → models/ruby/model_spec.rb} +1 -1
  120. data/install.sh +5 -5
  121. data/installer/unix-like/create_texts.rb +2 -2
  122. data/installer/unix-like/rho_connect_install_constants.rb +2 -2
  123. data/installer/unix-like/rho_connect_install_utilities.rb +1 -1
  124. data/installer/utils/constants.rb +4 -4
  125. data/js-adapters/ballroom.js +216 -0
  126. data/js-adapters/node.rb +52 -0
  127. data/js-adapters/node_channel.rb +181 -0
  128. data/js-adapters/request.js +27 -0
  129. data/js-adapters/response.js +57 -0
  130. data/js-adapters/rhoconnect_helpers.js +60 -0
  131. data/js-adapters/router.js +60 -0
  132. data/js-adapters/server.js +5 -0
  133. data/lib/rhoconnect/api/app/ans_login.rb +3 -3
  134. data/lib/rhoconnect/api/app/bulk_data.rb +10 -10
  135. data/lib/rhoconnect/api/app/fast_delete.rb +11 -10
  136. data/lib/rhoconnect/api/app/fast_insert.rb +11 -10
  137. data/lib/rhoconnect/api/app/fast_update.rb +11 -10
  138. data/lib/rhoconnect/api/app/login.rb +5 -5
  139. data/lib/rhoconnect/api/app/push_deletes.rb +12 -11
  140. data/lib/rhoconnect/api/app/push_objects.rb +12 -11
  141. data/lib/rhoconnect/api/app/query.rb +8 -7
  142. data/lib/rhoconnect/api/app/queue_updates.rb +98 -94
  143. data/lib/rhoconnect/api/app/search.rb +8 -7
  144. data/lib/rhoconnect/api/client/client_get_db_doc.rb +5 -5
  145. data/lib/rhoconnect/api/client/client_set_db_doc.rb +8 -8
  146. data/lib/rhoconnect/api/client/create.rb +7 -7
  147. data/lib/rhoconnect/api/client/get_client_params.rb +4 -4
  148. data/lib/rhoconnect/api/client/list_client_docs.rb +17 -17
  149. data/lib/rhoconnect/api/client/register.rb +12 -12
  150. data/lib/rhoconnect/api/client/reset.rb +5 -5
  151. data/lib/rhoconnect/api/readstate/set_refresh_time.rb +9 -9
  152. data/lib/rhoconnect/api/source/get_source_params.rb +4 -4
  153. data/lib/rhoconnect/api/source/list_sources.rb +16 -16
  154. data/lib/rhoconnect/api/source/update_source_params.rb +6 -6
  155. data/lib/rhoconnect/api/store/get_db_doc.rb +4 -4
  156. data/lib/rhoconnect/api/store/set_db_doc.rb +7 -7
  157. data/lib/rhoconnect/api/system/get_adapter.rb +4 -4
  158. data/lib/rhoconnect/api/system/get_license_info.rb +8 -8
  159. data/lib/rhoconnect/api/system/login.rb +15 -15
  160. data/lib/rhoconnect/api/system/reset.rb +11 -11
  161. data/lib/rhoconnect/api/system/save_adapter.rb +4 -4
  162. data/lib/rhoconnect/api/system/stats.rb +22 -22
  163. data/lib/rhoconnect/api/user/create_user.rb +7 -7
  164. data/lib/rhoconnect/api/user/delete_client.rb +6 -6
  165. data/lib/rhoconnect/api/user/delete_user.rb +11 -10
  166. data/lib/rhoconnect/api/user/list_clients.rb +4 -4
  167. data/lib/rhoconnect/api/user/list_source_docs.rb +10 -10
  168. data/lib/rhoconnect/api/user/list_users.rb +3 -3
  169. data/lib/rhoconnect/api/user/ping.rb +3 -3
  170. data/lib/rhoconnect/api/user/show_user.rb +3 -3
  171. data/lib/rhoconnect/api/user/update_user.rb +5 -5
  172. data/lib/rhoconnect/api/user/user_get_db_doc.rb +5 -5
  173. data/lib/rhoconnect/api/user/user_set_db_doc.rb +10 -10
  174. data/lib/rhoconnect/api_token.rb +5 -6
  175. data/lib/rhoconnect/app.rb +6 -46
  176. data/lib/rhoconnect/application/init.rb +5 -2
  177. data/lib/rhoconnect/async.rb +76 -39
  178. data/lib/rhoconnect/bulk_data/bulk_data.rb +6 -4
  179. data/lib/rhoconnect/client.rb +59 -9
  180. data/lib/rhoconnect/condition/admin_required.rb +27 -0
  181. data/lib/rhoconnect/condition/client_required.rb +50 -0
  182. data/lib/rhoconnect/condition/login_required.rb +22 -0
  183. data/lib/rhoconnect/condition/source_required.rb +49 -0
  184. data/lib/rhoconnect/condition/verbs.rb +17 -0
  185. data/lib/rhoconnect/condition/verify_success.rb +19 -0
  186. data/lib/rhoconnect/controller/app_base.rb +74 -0
  187. data/lib/rhoconnect/controller/base.rb +68 -0
  188. data/lib/rhoconnect/controller/clients_controller.rb +79 -0
  189. data/lib/rhoconnect/controller/dynamic_adapter_controller.rb +93 -0
  190. data/lib/rhoconnect/controller/js_base.rb +124 -0
  191. data/lib/rhoconnect/controller/read_state_controller.rb +22 -0
  192. data/lib/rhoconnect/controller/source_adapter_base.rb +14 -0
  193. data/lib/rhoconnect/controller/sources_controller.rb +44 -0
  194. data/lib/rhoconnect/controller/store_controller.rb +25 -0
  195. data/lib/rhoconnect/controller/system_controller.rb +67 -0
  196. data/lib/rhoconnect/controller/users_controller.rb +99 -0
  197. data/lib/rhoconnect/db_adapter.rb +1 -3
  198. data/lib/rhoconnect/document.rb +159 -50
  199. data/lib/rhoconnect/handler/authenticate/execute_methods.rb +77 -0
  200. data/lib/rhoconnect/handler/authenticate/runner.rb +49 -0
  201. data/lib/rhoconnect/handler/authenticate.rb +3 -0
  202. data/lib/rhoconnect/handler/bulk_data.rb +28 -0
  203. data/lib/rhoconnect/handler/changes/engine.rb +271 -0
  204. data/lib/rhoconnect/handler/changes/execute_methods.rb +88 -0
  205. data/lib/rhoconnect/handler/changes/pass_through_runner.rb +11 -0
  206. data/lib/rhoconnect/handler/changes/runner.rb +53 -0
  207. data/lib/rhoconnect/handler/changes.rb +31 -0
  208. data/lib/rhoconnect/handler/helpers/auth_method.rb +29 -0
  209. data/lib/rhoconnect/handler/helpers/binding.rb +18 -0
  210. data/lib/rhoconnect/handler/helpers/bulk_data.rb +53 -0
  211. data/lib/rhoconnect/handler/helpers/source_job.rb +14 -0
  212. data/lib/rhoconnect/handler/helpers.rb +4 -0
  213. data/lib/rhoconnect/handler/plugin_callbacks/execute_methods.rb +99 -0
  214. data/lib/rhoconnect/handler/plugin_callbacks/runner.rb +28 -0
  215. data/lib/rhoconnect/handler/plugin_callbacks.rb +67 -0
  216. data/lib/rhoconnect/handler/query/engine.rb +93 -0
  217. data/lib/rhoconnect/handler/query/execute_methods.rb +21 -0
  218. data/lib/rhoconnect/handler/query/pass_through_runner.rb +35 -0
  219. data/lib/rhoconnect/handler/query/runner.rb +270 -0
  220. data/lib/rhoconnect/handler/query.rb +19 -0
  221. data/lib/rhoconnect/handler/search/engine.rb +60 -0
  222. data/lib/rhoconnect/handler/search/execute_methods.rb +32 -0
  223. data/lib/rhoconnect/handler/search/pass_through_runner.rb +18 -0
  224. data/lib/rhoconnect/handler/search/runner.rb +104 -0
  225. data/lib/rhoconnect/handler/search.rb +26 -0
  226. data/lib/rhoconnect/handler/sync.rb +29 -0
  227. data/lib/rhoconnect/jobs/source_job.rb +13 -4
  228. data/lib/rhoconnect/js_adapter.rb +79 -0
  229. data/lib/rhoconnect/license.rb +10 -2
  230. data/lib/rhoconnect/middleware/current_user.rb +14 -1
  231. data/lib/rhoconnect/middleware/helpers.rb +10 -93
  232. data/lib/rhoconnect/middleware/x_domain_session_wrapper.rb +1 -1
  233. data/lib/rhoconnect/model/base.rb +229 -0
  234. data/lib/rhoconnect/model/dynamic_adapter_model.rb +90 -0
  235. data/lib/rhoconnect/model/js_base.rb +121 -0
  236. data/lib/rhoconnect/ping/android.rb +1 -1
  237. data/lib/rhoconnect/predefined_adapters/bench_adapter.rb +7 -4
  238. data/lib/rhoconnect/read_state.rb +3 -3
  239. data/lib/rhoconnect/server.rb +159 -190
  240. data/lib/rhoconnect/source.rb +100 -11
  241. data/lib/rhoconnect/stats/record.rb +10 -10
  242. data/lib/rhoconnect/store.rb +905 -591
  243. data/lib/rhoconnect/{model.rb → store_orm.rb} +53 -115
  244. data/lib/rhoconnect/tasks.rb +18 -4
  245. data/lib/rhoconnect/test_methods.rb +30 -17
  246. data/lib/rhoconnect/user.rb +35 -17
  247. data/lib/rhoconnect/utilities.rb +1 -1
  248. data/lib/rhoconnect/version.rb +2 -2
  249. data/lib/rhoconnect/web-console/server.rb +29 -14
  250. data/lib/rhoconnect/web-console/views/home.js +10 -10
  251. data/lib/rhoconnect/web-console/views/new_ping.js +1 -1
  252. data/lib/rhoconnect.rb +120 -51
  253. data/rhoconnect.gemspec +4 -3
  254. data/spec/api/api_helper.rb +1 -6
  255. data/spec/api/app/fast_delete_spec.rb +4 -4
  256. data/spec/api/app/fast_insert_spec.rb +4 -4
  257. data/spec/api/app/fast_update_spec.rb +8 -8
  258. data/spec/api/app/push_deletes_spec.rb +2 -2
  259. data/spec/api/app/push_objects_spec.rb +5 -5
  260. data/spec/api/client/client_get_db_doc_spec.rb +6 -4
  261. data/spec/api/client/client_set_db_doc_spec.rb +3 -2
  262. data/spec/api/client/get_client_params_spec.rb +14 -0
  263. data/spec/api/client/list_client_docs_spec.rb +30 -20
  264. data/spec/api/client/reset_spec.rb +36 -0
  265. data/spec/api/source/get_source_params_spec.rb +23 -17
  266. data/spec/api/system/get_license_info_spec.rb +0 -20
  267. data/spec/api/system/login_spec.rb +8 -0
  268. data/spec/api/system/reset_spec.rb +0 -1
  269. data/spec/api/system/stats_spec.rb +5 -5
  270. data/spec/api/user/create_user_spec.rb +14 -6
  271. data/spec/api/user/delete_user_spec.rb +20 -18
  272. data/spec/api/user/list_users_spec.rb +5 -6
  273. data/spec/api/user/update_user_spec.rb +5 -4
  274. data/spec/apps/rhotestapp/config.ru +16 -1
  275. data/spec/apps/rhotestapp/controllers/js/js_sample_controller.js +23 -0
  276. data/spec/apps/rhotestapp/controllers/js/sample2_controller.js +32 -0
  277. data/spec/apps/rhotestapp/controllers/ruby/application_controller.rb +21 -0
  278. data/spec/apps/rhotestapp/controllers/ruby/sample_adapter_controller.rb +8 -0
  279. data/spec/apps/rhotestapp/models/js/js_sample.js +55 -0
  280. data/spec/apps/rhotestapp/models/js/sample2.js +25 -0
  281. data/spec/apps/rhotestapp/{sources → models/ruby}/base_adapter.rb +0 -0
  282. data/spec/apps/rhotestapp/{sources → models/ruby}/fixed_schema_adapter.rb +0 -0
  283. data/spec/apps/rhotestapp/{sources → models/ruby}/other_adapter.rb +0 -0
  284. data/spec/apps/rhotestapp/{sources → models/ruby}/sample_adapter.rb +0 -0
  285. data/spec/apps/rhotestapp/{sources → models/ruby}/simple_adapter.rb +2 -2
  286. data/spec/apps/rhotestapp/{sources → models/ruby}/sub_adapter.rb +0 -0
  287. data/spec/apps/rhotestapp/settings/settings.yml +0 -1
  288. data/spec/bulk_data/bulk_data_spec.rb +20 -5
  289. data/spec/cli/cli_spec.rb +83 -0
  290. data/spec/client_spec.rb +20 -17
  291. data/spec/client_sync_spec.rb +244 -406
  292. data/spec/controllers/js_base_spec.rb +89 -0
  293. data/spec/doc/doc_spec.rb +18 -18
  294. data/spec/document_spec.rb +29 -13
  295. data/spec/dynamic_adapter_spec.rb +6 -6
  296. data/spec/generator/generator_spec.rb +7 -4
  297. data/spec/jobs/bulk_data_job_spec.rb +14 -10
  298. data/spec/jobs/source_job_spec.rb +8 -8
  299. data/spec/license_spec.rb +5 -2
  300. data/spec/models/js_model_spec.rb +39 -0
  301. data/spec/node_spec.rb +42 -0
  302. data/spec/perf/store_perf_spec.rb +67 -12
  303. data/spec/ping/android_spec.rb +1 -1
  304. data/spec/read_state_spec.rb +1 -1
  305. data/spec/rhoconnect_spec.rb +1 -1
  306. data/spec/server/cors_spec.rb +14 -18
  307. data/spec/server/server_spec.rb +265 -88
  308. data/spec/server/stats_spec.rb +1 -1
  309. data/spec/source_adapter_spec.rb +54 -27
  310. data/spec/source_spec.rb +8 -3
  311. data/spec/source_sync_spec.rb +538 -468
  312. data/spec/spec_helper.rb +35 -4
  313. data/spec/stats/record_spec.rb +10 -10
  314. data/spec/{model_spec.rb → store_orm_spec.rb} +56 -54
  315. data/spec/store_spec.rb +159 -179
  316. data/spec/support/shared_examples.rb +36 -27
  317. data/spec/sync_states_spec.rb +40 -33
  318. data/spec/test_methods_spec.rb +18 -14
  319. data/spec/user_spec.rb +17 -30
  320. metadata +156 -52
  321. data/bench/benchapp/application.rb +0 -39
  322. data/bench/blobapp/application.rb +0 -44
  323. data/commands/rhoconnect/clean_start.rb +0 -9
  324. data/commands/rhoconnect/create_user.rb +0 -18
  325. data/commands/rhoconnect/delete_device.rb +0 -9
  326. data/commands/rhoconnect/delete_user.rb +0 -8
  327. data/commands/rhoconnect/reset.rb +0 -16
  328. data/commands/rhoconnect/reset_refresh.rb +0 -11
  329. data/generators/templates/application/application.rb +0 -43
  330. data/lib/rhoconnect/client_sync.rb +0 -434
  331. data/lib/rhoconnect/dynamic_adapter.rb +0 -91
  332. data/lib/rhoconnect/middleware/admin_user.rb +0 -23
  333. data/lib/rhoconnect/middleware/current_request.rb +0 -16
  334. data/lib/rhoconnect/middleware/login_required.rb +0 -22
  335. data/lib/rhoconnect/source_adapter.rb +0 -132
  336. data/lib/rhoconnect/source_sync.rb +0 -464
  337. data/spec/apps/rhotestapp/application.rb +0 -23
data/doc/command-line.txt CHANGED
@@ -39,10 +39,10 @@ For example:
39
39
  [ADDED] storeserver/Rakefile
40
40
  [ADDED] storeserver/Gemfile
41
41
  [ADDED] storeserver/spec/spec_helper.rb
42
-
42
+
43
43
  Here's a basic rundown of each of the files that were just generated:
44
-
45
-
44
+
45
+
46
46
  * **config.ru** - This is a rackup file which will load your application. RhoConnect uses the excellent [sinatra](http://www.sinatrarb.com/) web framework to run the application.
47
47
  * **settings/settings.yml** - This contains settings such as your redis connection, which source adapters exist and their parameters. You can also put custom settings here.
48
48
  * **settings/license.key** - The RhoConnect [license](/rhoconnect/licensing) associated with your application. The default license allows up to 10 devices to synchronize with the application.
@@ -67,35 +67,42 @@ rhoconnect, type `rhoconnect` or `rhoconnect help`.
67
67
  :::term
68
68
  $ rhoconnect help
69
69
  Tasks:
70
- rhoconnect app NAME # Generates a new rhoconnect application.
70
+ rhoconnect app NAME # Generate a new rhoconnect application
71
71
  rhoconnect attach # Attach to rhoconnect console
72
- rhoconnect clean-start # Clean rhoconnect, get token, and create new user
73
- rhoconnect create-user # Creates and subscribes user for application in rhoconnect
74
- rhoconnect delete-device # Deletes a device from rhoconnect
75
- rhoconnect delete-user # Deletes a user from rhoconnect
72
+ rhoconnect console [environment] # Run rhoconnect console
76
73
  rhoconnect dtach-about # About dtach
77
- rhoconnect dtach-install # Install dtach 0.8 from source
74
+ rhoconnect dtach-install # Install dtach program from sources
78
75
  rhoconnect flushdb # Flush data store - WARNING: THIS REMOVES ALL DATA IN RHOCONNECT
79
- rhoconnect get-token # Fetches current api token from rhoconnect
76
+ rhoconnect get-token # Fetch current api token from rhoconnect
80
77
  rhoconnect help [TASK] # Describe available tasks or one specific task
81
78
  rhoconnect redis-about # About redis
82
79
  rhoconnect redis-attach # Attach to redis dtach socket
83
- rhoconnect redis-download # Download redis package
84
- rhoconnect redis-install # Install the latest version of Redis from Github (requires git, duh)
85
- rhoconnect redis-restart # Restart redis
86
- rhoconnect redis-start # Start redis
87
- rhoconnect redis-stop # Stop redis
88
- rhoconnect reset # Reset the rhoconnect database (you will need to run rhoconnect:get_token afterwards)
89
- rhoconnect reset-refresh # Reset source refresh time
90
- rhoconnect restart # Alias for `rhoconnect stop; rhoconnect start`
80
+ rhoconnect redis-download # Download redis release 2.6.11
81
+ rhoconnect redis-install # Install the latest verison of Redis from Github (requires git, duh)
82
+ rhoconnect redis-restart # Restart redis on localhost
83
+ rhoconnect redis-start # Start redis on localhost
84
+ rhoconnect redis-status # Show status of redis servers
85
+ rhoconnect redis-stop # Stop redis running on localhost
86
+ rhoconnect restart [options] # Alias for `rhoconnect stop; rhoconnect start`
91
87
  rhoconnect secret # Generate a cryptographically secure secret session key
92
- rhoconnect set-admin-password # Sets the admin password
93
- rhoconnect source NAME # Generates a new source adapter.
94
- rhoconnect spec # Run source adapter specs
95
- rhoconnect start # Start rhoconnect server
88
+ rhoconnect set-admin-password # Set the admin password
89
+ rhoconnect source NAME # Generate a new source adapter
90
+ rhoconnect start [options] # Start rhoconnect server
96
91
  rhoconnect stop # Stop rhoconnect server
97
- rhoconnect war # Build executable WAR file to be used in Java App Servers
98
- rhoconnect web # Launch the web console in a browser - uses :syncserver: in settings.yml
92
+ rhoconnect update # Update an existing application to the latest rhoconnect release
93
+ rhoconnect version # Display rhoconnect version
94
+ rhoconnect web # Launch the web console in a browser
95
+
96
+ **NOTE: The `rhoconnect war` command is available only if you switch to jruby, such as using the command `rvm use jruby`.**
97
+
98
+ `rhoconnect start` and `rhoconnect restart` have the following options.
99
+
100
+ -p, [--port=N] # Use port (default: 9292)
101
+ -r, [--redis=REDIS] # Redis server settings: (default: localhost:6379)
102
+ -P, [--push-server=PUSH_SERVER] # Push server settings (default: http://someappname@localhost:8675/)
103
+ -t, [--api-token=API_TOKEN] # API token (default: my-rhoconnect-token)
104
+ -f, [--config=CONFIG] # /path/to/rhoconnect/settings.yml file
105
+ -l, [--licenseflie=LICENSEFLIE] # /path/to/license.key file
99
106
 
100
107
  ### Installing DTach (Mac OS / Linux only)
101
108
 
@@ -115,6 +122,26 @@ Next, you will need to setup and start a [redis](http://redis.io/) server:
115
122
 
116
123
  The server will show that it is running on the console.
117
124
 
125
+ ### Redis Horizontal Scaling
126
+
127
+ Starting from v4.0, RhoConnect supports multiple Redis instances per app.
128
+ To enable this feature, edit your app `settings/settings.yml` file and replace the `:redis:` configuration
129
+ with an array of redis servers you are going to use:
130
+
131
+ :::yaml
132
+ # ...
133
+ :production:
134
+ :licensefile: settings/license.key
135
+ :syncserver: http://localhost:9292/api/application/
136
+ :push_server: http://appname:secret@localhost:8675/
137
+ # One or more redis servers
138
+ :redis:
139
+ - localhost:6379
140
+ - localhost:6380
141
+ - localhost:6381
142
+ - localhost:6382
143
+ # ...
144
+
118
145
  ### Start the Application
119
146
 
120
147
  Open a new console window (since the redis server is running in the previous console window). Then change directories to your rhoconnect application and start the application.
@@ -123,25 +150,56 @@ Open a new console window (since the redis server is running in the previous con
123
150
  $ cd storeserver
124
151
  $ rhoconnect start
125
152
 
126
- If everything went well, you should see the following in your console:
153
+ #### Starting RhoConnect without a Source Adapter Application
154
+
155
+ You can also start RhoConnect in a directory that does not contain a RhoConnect source adapter application. This is useful for RhoConnect plugin developers, who do not write a RhoConnect source adapter application: they can start a RhoConnect server from an empty directory.
156
+
157
+ :::term
158
+ $ cd (an empty directory)
159
+ $ rhoconnect start
160
+
161
+ When you start RhoConnect in a directory that does not contain a rhoconnect source adapter application, a hidden settings file, .rhoconnect.yml, is created in your user home directory. Here is a partial sample listing.
162
+
163
+ :development: &70196107903780
164
+ :syncserver: http://localhost:9393
165
+ :redis: localhost:6379
166
+ :push_server: http://someappname@localhost:8675/
167
+ :api_token: my-rhoconnect-token
168
+ :secret: !binary |-
169
+ ...
170
+ :test: *70196107903780
171
+ :production: *70196107903780
172
+
173
+ Once .rhoconnect.yml has been created in your user home directory, you can manually modify it for the next time you start RhoConnect. For example, you could change the port upon which the syncserver runs.
174
+
175
+ Running RhoConnect this way uses the default license key in the RhoConnect gem. You can use other license keys by using the `-l` option in the `rhoconnect start` command.
176
+
177
+ #### Opening the Web Console
178
+
179
+ If everything went well when you started RhoConnect, you should see the following in your console:
180
+
181
+ [03:52:15 PM 2013-03-12] Rhoconnect Server v4.0.0 started...
127
182
 
128
- [05:47:10 PM 2011-04-19] Rhoconnect Server v3.0.0 started...
129
-
130
183
  To open the web console, navigate to [http://localhost:9292/](http://localhost:9292) in your browser or run:
131
184
 
132
185
  :::term
133
186
  $ rhoconnect web
134
-
187
+
135
188
  ### Creating executable WAR containers (JRuby environment only)
136
189
 
137
190
  It is possible to create Java WAR containers for your Rhoconnect application that can be deployed into the
138
- Java App Servers (for example, JBoss). To create the executable WAR container, execute the following command in your app's root directory:
139
-
191
+ Java App Servers (for example, Tomcat, JBoss). To create the executable WAR container, execute the following command in your app's root directory:
192
+
140
193
  :::term
141
194
  $ cd storeserver
142
195
  $ rhoconnect war
143
-
144
- This will build the WAR file named <your_app>.war that can be deployed into the Java App Server.
196
+
197
+ This will build the WAR file named `storeserver.war` that can be deployed into the Java App Server. Also warbler package includes
198
+ an application launcher script, so you can run it standalone on port 8080 in java environment:
199
+ :::term
200
+ $ java -jar storeserver.war
201
+
202
+ To open the web console, navigate to [http://localhost:8080/](http://localhost:8080) in your browser.
145
203
 
146
204
  ### Common Tasks
147
205
 
@@ -149,195 +207,42 @@ RhoConnect applications come with many useful rhoconnect tasks for administrativ
149
207
 
150
208
  * `rhoconnect dtach-install` - (Mac OS / Linux only) This will install [dtach](http://dtach.sourceforge.net/) to /usr/local/bin.
151
209
 
152
- * `rhoconnect redis-install` - This will install to the system. On Mac OS / Linux, it will attempt to install in '/usr/local/bin' (on windows, C:\redis-<version>), unless you have specified a REDIS_HOME to use instead.
210
+ * `rhoconnect redis-install` - This will install to the system. On Mac OS / Linux, it will attempt to install in '/usr/local/bin' (on windows, C:\redis-<version>), unless you have specified a REDIS_HOME to use instead.
153
211
  If you cannot install redis on Linux due to insufficient user permissions, then follows these [instructions](/rhoconnect/install).
154
-
212
+
155
213
  * `rhoconnect set-admin-password` - Set the RhoConnect administrator password. The default password is blank ''.
156
214
 
157
215
  * `rhoconnect get-token` - Get a RhoConnect API token to use for calling the RhoConnect REST API.
158
-
216
+
159
217
  **NOTE: On Mac OS / Linux, you need to install dtach (i.e. by running `rhoconnect dtach-install`) to run the following tasks: **
160
218
 
161
- * `rhoconnect redis-start` - This will launch a redis server in a new console.
162
-
163
- * `rhoconnect redis-stop` - Stop the currently-running redis server.
219
+ * `rhoconnect redis-start` - Start redis on localhost.
220
+
221
+ * `rhoconnect redis-stop` - Stop redis running on localhost.
164
222
 
165
- * `rhoconnect redis:attach` - (Mac OS / Linux only) Attach to a currently-running redis server.
223
+ * `rhoconnect redis-status` - Show status of redis servers.
224
+
225
+ * `rhoconnect redis-attach` - (Mac OS / Linux only) Attach to a currently-running redis server.
166
226
 
167
227
  * `rhoconnect start` - Start the RhoConnect application in a new console. This requires a running redis server.
168
228
 
169
229
  * `rhoconnect stop` - Stop the currently-running RhoConnect application.
170
-
171
- * `rhoconnect attach` - (Mac OS / Linux only) Attach to a currently-running RhoConnect application.
172
230
 
173
- * `rhoconnect clean-start` - Useful for development, resets and bootstraps the RhoConnect application with a test user.
231
+ * `rhoconnect attach` - (Mac OS / Linux only) Attach to a currently-running RhoConnect application.
174
232
 
175
233
  Some other useful development tasks:
176
234
 
177
- * `rhoconnect reset` - Reset the RhoConnect application to the initial state. This WILL DELETE ALL DATA IN REDIS! So be sure you don't run this in production!
178
-
179
235
  * `rhoconnect spec` - Run all source adapter specs in spec/sources/.
180
-
236
+
181
237
  * `rhoconnect web` - Open the RhoConnect web console in a browser.
182
238
 
183
239
  ## Generate Source
184
240
 
185
241
  Connecting to a backend service with RhoConnect requires that you write a small amount of code for the query, create, update and delete operations of your particular enterprise backend. The collection of the code for these operations is called a source. You can create source for your RhoConnect application two ways:
186
-
187
- * [RhoConnect source adapter](/rhoconnect/source-adapters): generate a Ruby code source adapter from RhoStudio or from the command line, similar to how you generate a RhoConnect app. This source adapter contains code for the query, create, update and delete operations.
188
-
189
- * [RhoConnect plugin](/rhoconnect/plugin-intro): write the source code (the query, create, update and delete operations) into your backend application, and plug a RhoConnect plugin in the application. The plugin is written in the language that matchs your backend application, such as Java or .NET.
190
-
191
- ## Rake Tasks (Rhoconnect v.3.1 and lower)
192
- <span class="label label-important">As of version 4.0 of rhoconnect, rake tasks will be deprecated!!</span>
193
-
194
- Each RhoConnect (v.3.1 and lower) application uses [rake](https://github.com/jimweirich/rake) to manage development tasks such as starting/stopping the app, starting resque workers, and running specs.
195
242
 
196
- To run a RhoConnect rake task, simply type `rake the-task-to-run` in your RhoConnect application's root directory.
243
+ * [RhoConnect source adapter](/rhoconnect/source-adapters): generate a Ruby code source adapter from RhoStudio or from the command line, similar to how you generate a RhoConnect app. This source adapter contains code for the query, create, update and delete operations.
197
244
 
198
- Here is a complete list of the rake tasks available in a RhoConnect v.3.1 and lower application:
245
+ * [RhoConnect plugin](/rhoconnect/plugin-intro): write the source code (the query, create, update and delete operations) into your backend application, and plug a RhoConnect plugin in the application. The plugin is written in the language that matchs your backend application, such as Java or .NET.
199
246
 
200
- :::term
201
- $ cd storeserver
202
- $ rake -T
203
- (in ~/storeserver)
204
- rake dtach:about # About dtach
205
- rake dtach:install # Install dtach 0.8 from source
206
- rake redis:about # About redis
207
- rake redis:attach # Attach to redis dtach socket
208
- rake redis:download # Download package
209
- rake redis:install # Install the latest version of Redis from Github (requires git, duh)
210
- rake redis:restart # Restart redis
211
- rake redis:start # Start redis
212
- rake redis:stop # Stop redis
213
- rake resque:work # Start a Resque worker
214
- rake resque:workers # Start multiple Resque workers.
215
- rake rhoconnect:attach # Attach to rhoconnect console
216
- rake rhoconnect:clean_start # Clean rhoconnect, get token, and create new user
217
- rake rhoconnect:create_user # Creates and subscribes user for application in rhoconnect
218
- rake rhoconnect:delete_device # Deletes a device from rhoconnect
219
- rake rhoconnect:delete_user # Deletes a user from rhoconnect
220
- rake rhoconnect:flushdb # Flush data store - WARNING: THIS REMOVES ALL DATA IN RHOCONNECT
221
- rake rhoconnect:get_token # Fetches current api token from rhoconnect
222
- rake rhoconnect:reset # Reset the rhoconnect database (you will need to run rhoconnect:get_token afterwards)
223
- rake rhoconnect:reset_refresh # Reset source refresh time
224
- rake rhoconnect:restart # Alias for `rake rhoconnect:stop; rake rhoconnect:start`
225
- rake rhoconnect:set_admin_password # Sets the admin password
226
- rake rhoconnect:spec # Run source adapter specs
227
- rake rhoconnect:start # Start rhoconnect server
228
- rake rhoconnect:stop # Stop rhoconnect server
229
- rake rhoconnect:war # Build executable WAR file to be used in Java App Servers
230
- rake rhoconnect:web # Launch the web console in a browser - uses :syncserver: in settings.yml
231
-
232
- Below is provided a list of rake tasks and their corresponding RhoConnect v.3.2+ command.
233
-
234
- <table border="1", cellpadding="5", width="100%">
235
- <tr>
236
- <th>rake Command</th>
237
- <th>rhoconnect command</th>
238
- </tr>
239
- <tr>
240
- <td>rake -T</td>
241
- <td>rhoconnect help</td>
242
- </tr>
243
- <tr>
244
- <td>rake rhoconnect:attach</td>
245
- <td>rhoconnect attach</td>
246
- </tr>
247
- <tr>
248
- <td>rake rhoconnect:clean_start</td>
249
- <td>rhoconnect clean-start</td>
250
- </tr>
251
- <tr>
252
- <td>rake rhoconnect:reate_user</td>
253
- <td>rhoconnect create-user</td>
254
- </tr>
255
- <tr>
256
- <td>rake rhoconnect:delete_device</td>
257
- <td>rhoconnect delete-device</td>
258
- </tr>
259
- <tr>
260
- <td>rake rhoconnect:delete_user</td>
261
- <td>rhoconnect delete-user</td>
262
- </tr>
263
- <tr>
264
- <td>rake rhoconnect:flushdb</td>
265
- <td>rhoconnect flushdb</td>
266
- </tr>
267
- <tr>
268
- <td>rake rhoconnect:get_token</td>
269
- <td>rhoconnect get-token</td>
270
- </tr>
271
- <tr>
272
- <td>rake rhoconnect:reset</td>
273
- <td>rhoconnect reset</td>
274
- </tr>
275
- <tr>
276
- <td>rake rhoconnect:reset_refresh</td>
277
- <td>rhoconnect reset-refresh</td>
278
- </tr>
279
- <tr>
280
- <td>rake rhoconnect:restart</td>
281
- <td>rhoconnect restart</td>
282
- </tr>
283
- <tr>
284
- <td>rake rhoconnect:set_admin_password</td>
285
- <td>rhoconnect set-admin-password</td>
286
- </tr>
287
- <tr>
288
- <td>rake rhoconnect:spec</td>
289
- <td>rhoconnect spec</td>
290
- </tr>
291
- <tr>
292
- <td>rake rhoconnect:start</td>
293
- <td>rhoconnect start</td>
294
- </tr>
295
- <tr>
296
- <td>rake rhoconnect:stop</td>
297
- <td>rhoconnect stop</td>
298
- </tr>
299
- <tr>
300
- <td>rake rhoconnect:war</td>
301
- <td>rhoconnect war</td>
302
- </tr>
303
- <tr>
304
- <td>rake rhoconnect:web</td>
305
- <td>rhoconnect web</td>
306
- </tr>
307
- <tr>
308
- <td>rake dtach:about</td>
309
- <td>rhoconnect dtach-about</td>
310
- </tr>
311
- <tr>
312
- <td>rake dtach:install</td>
313
- <td>rhoconnect dtach-install</td>
314
- </tr>
315
- <tr>
316
- <td>rake redis:about</td>
317
- <td>rhoconnect redis-about</td>
318
- </tr>
319
- <tr>
320
- <td>rake redis:attach</td>
321
- <td>rhoconnect redis-attach</td>
322
- </tr>
323
- <tr>
324
- <td>rake redis:download</td>
325
- <td>rhoconnect redis-download</td>
326
- </tr>
327
- <tr>
328
- <td>rake redis:install</td>
329
- <td>rhoconnect redis-install</td>
330
- </tr>
331
- <tr>
332
- <td>rake redis:restart</td>
333
- <td>rhoconnect redis-restart</td>
334
- </tr>
335
- <tr>
336
- <td>rake redis:start</td>
337
- <td>rhoconnect redis-start</td>
338
- </tr>
339
- <tr>
340
- <td>rake redis:stop</td>
341
- <td>rhoconnect redis-stop</td>
342
- </tr>
343
- </table>
247
+ ## Rake Tasks (Removed)
248
+ <span class="label label-important">As of version 4.0, the rhoconnect rake tasks have been removed. You can use `rhoconnect --help` to see the list of available rhoconnect commands.</span>
@@ -0,0 +1,40 @@
1
+ Data Partitioning & Pass-Through
2
+ ===
3
+
4
+ ## Data Partitioning
5
+
6
+ Data is stored in RhoConnect using [redis sets](http://redis.io/commands#set). The `@result` hash from the `query` method is stored in redis and referred to as the Master Document or MD.
7
+
8
+ The MD is referenced in RhoConnect by a corresponding partition. Source adapters can partition data in two ways: user and app. As you might have guessed, user partitioning stores a copy of the source adapter MD for each user (one copy shared across all devices for a given user).
9
+
10
+ Likewise, app partitioning stores one copy of the source adapter MD for the entire application (all users and devices share the same data). App partitioning can be particularly useful if you have source adapter models which retrieve large amounts of data that is fixed from user to user, for example a global product catalog. Using app partitioning wherever possible ***greatly reduces*** the amount of data in redis.
11
+
12
+ ### User Partition
13
+ User partitioning is the default mode for source adapters, however you can explicitly define it in `settings/settings.yml` with:
14
+
15
+ :::yaml
16
+ :sources:
17
+ Product:
18
+ :poll_interval: 300
19
+ :partition_type: user
20
+
21
+ ### App Partition
22
+ Enable app partitioning the same way:
23
+
24
+ :::yaml
25
+ :sources:
26
+ Product:
27
+ :poll_interval: 300
28
+ :partition_type: app
29
+
30
+ Now you have a single copy of the `Product` source adapter dataset for all users.
31
+
32
+ ## Pass Through
33
+ RhoConnect provides a simple way to keep data out of redis. If you have sensitive data that you do not want saved in redis, add the `pass_through` option in settings/settings.yml for each source:
34
+
35
+ :::yaml
36
+ :sources:
37
+ Product:
38
+ :pass_through: true
39
+
40
+ **NOTE: When running query or search the entire data set will be returned from your backend service. **