rhoconnect 3.4.5 → 4.0.0.beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +57 -3
- data/Gemfile +9 -7
- data/Gemfile.lock +37 -37
- data/Rakefile +18 -7
- data/bench/benchapp/Gemfile +1 -1
- data/bench/benchapp/config.ru +0 -3
- data/bench/benchapp/controllers/ruby/application.rb +17 -0
- data/bench/benchapp/controllers/ruby/application_controller.rb +17 -0
- data/bench/benchapp/controllers/ruby/mock_adapter_controller.rb +8 -0
- data/bench/benchapp/controllers/ruby/queue_mock_adapter_controller.rb +8 -0
- data/bench/benchapp/{sources → models/ruby}/mock_adapter.rb +1 -1
- data/bench/benchapp/{sources → models/ruby}/queue_mock_adapter.rb +0 -0
- data/bench/benchapp/spec/{sources → models/ruby}/mock_adapter_spec.rb +1 -1
- data/bench/benchapp/spec/{sources → models/ruby}/queue_mock_adapter_spec.rb +1 -1
- data/bench/benchapp/spec/spec_helper.rb +2 -2
- data/bench/blobapp/Gemfile +1 -1
- data/bench/blobapp/config.ru +0 -3
- data/bench/blobapp/controllers/ruby/application_controller.rb +17 -0
- data/bench/blobapp/controllers/ruby/blob_adapter_controller.rb +8 -0
- data/bench/blobapp/{sources → models/ruby}/blob_adapter.rb +9 -2
- data/bench/blobapp/spec/{sources → models/ruby}/blob_adapter_spec.rb +1 -1
- data/bench/blobapp/spec/spec_helper.rb +1 -1
- data/bench/lib/bench/cli.rb +1 -1
- data/bench/scripts/blob_cud_script.rb +1 -1
- data/bench/scripts/query_md_script.rb +1 -1
- data/bench/scripts/query_only_script.rb +1 -1
- data/bench/scripts/query_script.rb +1 -1
- data/bench/scripts/test_query_script.rb +7 -1
- data/bench/spec/mock_adapter_spec.rb +1 -1
- data/bench/spec/result_spec.rb +3 -3
- data/bin/rhoconnect +5 -3
- data/commands/dtach/dtach_install.rb +2 -2
- data/commands/execute.rb +8 -3
- data/commands/generators/app.rb +3 -3
- data/commands/generators/controller.rb +6 -0
- data/commands/generators/model.rb +6 -0
- data/commands/generators/source.rb +3 -3
- data/commands/generators/update.rb +1 -1
- data/commands/redis/redis_about.rb +2 -2
- data/commands/redis/redis_download.rb +1 -1
- data/commands/redis/redis_install.rb +4 -3
- data/commands/redis/redis_restart.rb +4 -4
- data/commands/redis/redis_start.rb +5 -4
- data/commands/redis/redis_startbg.rb +5 -4
- data/commands/redis/redis_status.rb +13 -0
- data/commands/redis/redis_stop.rb +3 -3
- data/commands/rhoconnect/config.rb +28 -16
- data/commands/rhoconnect/flushdb.rb +1 -2
- data/commands/rhoconnect/get_token.rb +15 -11
- data/commands/rhoconnect/restart.rb +13 -5
- data/commands/rhoconnect/set_admin_password.rb +8 -8
- data/commands/rhoconnect/start.rb +74 -16
- data/commands/rhoconnect/startbg.rb +1 -1
- data/commands/rhoconnect/startdebug.rb +1 -1
- data/commands/rhoconnect/stop.rb +13 -1
- data/commands/rhoconnect/web.rb +5 -5
- data/commands/rhoconnect_console/console.rb +7 -5
- data/commands/{rhoconnect → rhoconnect_spec}/spec.rb +0 -0
- data/commands/rhoconnect_war/war.rb +9 -9
- data/commands/utilities/blank_app.ru +56 -0
- data/commands/utilities/redis_runner.rb +54 -19
- data/doc/authentication.txt +80 -6
- data/doc/blob-sync.txt +104 -97
- data/doc/bulk-sync.txt +1 -1
- data/doc/client-java.txt +3 -3
- data/doc/client-objc.txt +2 -2
- data/doc/client.txt +4 -4
- data/doc/command-line.txt +105 -200
- data/doc/data-partitioning.txt +40 -0
- data/doc/deploying.txt +249 -77
- data/doc/extending-rhoconnect-server.txt +40 -57
- data/doc/heroku-addon.txt +2 -0
- data/doc/install.txt +45 -95
- data/doc/introduction.txt +1 -1
- data/doc/java-plugin.txt +365 -190
- data/doc/metadata.txt +1 -1
- data/doc/migration.txt +108 -142
- data/doc/preparing-production.txt +1 -1
- data/doc/push-backend-setup.txt +2 -0
- data/doc/push-client-setup-android.txt +78 -0
- data/doc/push-client-setup-bb.txt +81 -0
- data/doc/push-client-setup-ios.txt +70 -0
- data/doc/push-client-setup-rps.txt +200 -0
- data/doc/push-client-setup.txt +63 -66
- data/doc/push-server-setup.txt +67 -40
- data/doc/push-testing.txt +29 -0
- data/doc/push.txt +21 -6
- data/doc/rest-api.txt +128 -55
- data/doc/rhoconnect-redis-stack.txt +120 -0
- data/doc/settings.txt +4 -12
- data/doc/source-adapters-intro.txt +28 -0
- data/doc/source-adapters.txt +235 -272
- data/doc/stats-middleware.txt +9 -29
- data/doc/supported-platforms.txt +21 -30
- data/doc/testing.txt +40 -42
- data/doc/tutorial.txt +72 -57
- data/examples/simple/Gemfile +1 -1
- data/examples/simple/application.rb +4 -5
- data/examples/simple/my_server.rb +2 -2
- data/examples/simple/settings/settings.yml +1 -1
- data/generators/rhoconnect.rb +151 -50
- data/generators/templates/application/Gemfile +1 -1
- data/generators/templates/application/Rakefile +3 -3
- data/generators/templates/application/config.ru +1 -4
- data/generators/templates/application/controllers/application_controller.rb +17 -0
- data/generators/templates/application/controllers/js/application_controller.js +14 -0
- data/generators/templates/application/controllers/ruby/application_controller.rb +17 -0
- data/generators/templates/application/package.json +8 -0
- data/generators/templates/application/rcgemfile +2 -5
- data/generators/templates/application/settings/settings.yml +3 -3
- data/generators/templates/application/spec/application_controller_spec.rb +23 -0
- data/generators/templates/application/spec/js_spec.rb +25 -0
- data/generators/templates/application/spec/spec_helper.rb +21 -7
- data/generators/templates/source/controllers/js/controller.js +7 -0
- data/generators/templates/source/controllers/ruby/controller.rb +8 -0
- data/generators/templates/source/controllers/ruby/controller_spec.rb +27 -0
- data/generators/templates/source/models/js/model.js +46 -0
- data/generators/templates/source/{source_adapter.rb → models/ruby/model.rb} +15 -10
- data/generators/templates/source/{source_spec.rb → models/ruby/model_spec.rb} +1 -1
- data/install.sh +5 -5
- data/installer/unix-like/create_texts.rb +2 -2
- data/installer/unix-like/rho_connect_install_constants.rb +2 -2
- data/installer/unix-like/rho_connect_install_utilities.rb +1 -1
- data/installer/utils/constants.rb +4 -4
- data/js-adapters/ballroom.js +216 -0
- data/js-adapters/node.rb +52 -0
- data/js-adapters/node_channel.rb +181 -0
- data/js-adapters/request.js +27 -0
- data/js-adapters/response.js +57 -0
- data/js-adapters/rhoconnect_helpers.js +60 -0
- data/js-adapters/router.js +60 -0
- data/js-adapters/server.js +5 -0
- data/lib/rhoconnect/api/app/ans_login.rb +3 -3
- data/lib/rhoconnect/api/app/bulk_data.rb +10 -10
- data/lib/rhoconnect/api/app/fast_delete.rb +11 -10
- data/lib/rhoconnect/api/app/fast_insert.rb +11 -10
- data/lib/rhoconnect/api/app/fast_update.rb +11 -10
- data/lib/rhoconnect/api/app/login.rb +5 -5
- data/lib/rhoconnect/api/app/push_deletes.rb +12 -11
- data/lib/rhoconnect/api/app/push_objects.rb +12 -11
- data/lib/rhoconnect/api/app/query.rb +8 -7
- data/lib/rhoconnect/api/app/queue_updates.rb +98 -94
- data/lib/rhoconnect/api/app/search.rb +8 -7
- data/lib/rhoconnect/api/client/client_get_db_doc.rb +5 -5
- data/lib/rhoconnect/api/client/client_set_db_doc.rb +8 -8
- data/lib/rhoconnect/api/client/create.rb +7 -7
- data/lib/rhoconnect/api/client/get_client_params.rb +4 -4
- data/lib/rhoconnect/api/client/list_client_docs.rb +17 -17
- data/lib/rhoconnect/api/client/register.rb +12 -12
- data/lib/rhoconnect/api/client/reset.rb +5 -5
- data/lib/rhoconnect/api/readstate/set_refresh_time.rb +9 -9
- data/lib/rhoconnect/api/source/get_source_params.rb +4 -4
- data/lib/rhoconnect/api/source/list_sources.rb +16 -16
- data/lib/rhoconnect/api/source/update_source_params.rb +6 -6
- data/lib/rhoconnect/api/store/get_db_doc.rb +4 -4
- data/lib/rhoconnect/api/store/set_db_doc.rb +7 -7
- data/lib/rhoconnect/api/system/get_adapter.rb +4 -4
- data/lib/rhoconnect/api/system/get_license_info.rb +8 -8
- data/lib/rhoconnect/api/system/login.rb +15 -15
- data/lib/rhoconnect/api/system/reset.rb +11 -11
- data/lib/rhoconnect/api/system/save_adapter.rb +4 -4
- data/lib/rhoconnect/api/system/stats.rb +22 -22
- data/lib/rhoconnect/api/user/create_user.rb +7 -7
- data/lib/rhoconnect/api/user/delete_client.rb +6 -6
- data/lib/rhoconnect/api/user/delete_user.rb +11 -10
- data/lib/rhoconnect/api/user/list_clients.rb +4 -4
- data/lib/rhoconnect/api/user/list_source_docs.rb +10 -10
- data/lib/rhoconnect/api/user/list_users.rb +3 -3
- data/lib/rhoconnect/api/user/ping.rb +3 -3
- data/lib/rhoconnect/api/user/show_user.rb +3 -3
- data/lib/rhoconnect/api/user/update_user.rb +5 -5
- data/lib/rhoconnect/api/user/user_get_db_doc.rb +5 -5
- data/lib/rhoconnect/api/user/user_set_db_doc.rb +10 -10
- data/lib/rhoconnect/api_token.rb +5 -6
- data/lib/rhoconnect/app.rb +6 -46
- data/lib/rhoconnect/application/init.rb +5 -2
- data/lib/rhoconnect/async.rb +76 -39
- data/lib/rhoconnect/bulk_data/bulk_data.rb +6 -4
- data/lib/rhoconnect/client.rb +59 -9
- data/lib/rhoconnect/condition/admin_required.rb +27 -0
- data/lib/rhoconnect/condition/client_required.rb +50 -0
- data/lib/rhoconnect/condition/login_required.rb +22 -0
- data/lib/rhoconnect/condition/source_required.rb +49 -0
- data/lib/rhoconnect/condition/verbs.rb +17 -0
- data/lib/rhoconnect/condition/verify_success.rb +19 -0
- data/lib/rhoconnect/controller/app_base.rb +74 -0
- data/lib/rhoconnect/controller/base.rb +68 -0
- data/lib/rhoconnect/controller/clients_controller.rb +79 -0
- data/lib/rhoconnect/controller/dynamic_adapter_controller.rb +93 -0
- data/lib/rhoconnect/controller/js_base.rb +124 -0
- data/lib/rhoconnect/controller/read_state_controller.rb +22 -0
- data/lib/rhoconnect/controller/source_adapter_base.rb +14 -0
- data/lib/rhoconnect/controller/sources_controller.rb +44 -0
- data/lib/rhoconnect/controller/store_controller.rb +25 -0
- data/lib/rhoconnect/controller/system_controller.rb +67 -0
- data/lib/rhoconnect/controller/users_controller.rb +99 -0
- data/lib/rhoconnect/db_adapter.rb +1 -3
- data/lib/rhoconnect/document.rb +159 -50
- data/lib/rhoconnect/handler/authenticate/execute_methods.rb +77 -0
- data/lib/rhoconnect/handler/authenticate/runner.rb +49 -0
- data/lib/rhoconnect/handler/authenticate.rb +3 -0
- data/lib/rhoconnect/handler/bulk_data.rb +28 -0
- data/lib/rhoconnect/handler/changes/engine.rb +271 -0
- data/lib/rhoconnect/handler/changes/execute_methods.rb +88 -0
- data/lib/rhoconnect/handler/changes/pass_through_runner.rb +11 -0
- data/lib/rhoconnect/handler/changes/runner.rb +53 -0
- data/lib/rhoconnect/handler/changes.rb +31 -0
- data/lib/rhoconnect/handler/helpers/auth_method.rb +29 -0
- data/lib/rhoconnect/handler/helpers/binding.rb +18 -0
- data/lib/rhoconnect/handler/helpers/bulk_data.rb +53 -0
- data/lib/rhoconnect/handler/helpers/source_job.rb +14 -0
- data/lib/rhoconnect/handler/helpers.rb +4 -0
- data/lib/rhoconnect/handler/plugin_callbacks/execute_methods.rb +99 -0
- data/lib/rhoconnect/handler/plugin_callbacks/runner.rb +28 -0
- data/lib/rhoconnect/handler/plugin_callbacks.rb +67 -0
- data/lib/rhoconnect/handler/query/engine.rb +93 -0
- data/lib/rhoconnect/handler/query/execute_methods.rb +21 -0
- data/lib/rhoconnect/handler/query/pass_through_runner.rb +35 -0
- data/lib/rhoconnect/handler/query/runner.rb +270 -0
- data/lib/rhoconnect/handler/query.rb +19 -0
- data/lib/rhoconnect/handler/search/engine.rb +60 -0
- data/lib/rhoconnect/handler/search/execute_methods.rb +32 -0
- data/lib/rhoconnect/handler/search/pass_through_runner.rb +18 -0
- data/lib/rhoconnect/handler/search/runner.rb +104 -0
- data/lib/rhoconnect/handler/search.rb +26 -0
- data/lib/rhoconnect/handler/sync.rb +29 -0
- data/lib/rhoconnect/jobs/source_job.rb +13 -4
- data/lib/rhoconnect/js_adapter.rb +79 -0
- data/lib/rhoconnect/license.rb +10 -2
- data/lib/rhoconnect/middleware/current_user.rb +14 -1
- data/lib/rhoconnect/middleware/helpers.rb +10 -93
- data/lib/rhoconnect/middleware/x_domain_session_wrapper.rb +1 -1
- data/lib/rhoconnect/model/base.rb +229 -0
- data/lib/rhoconnect/model/dynamic_adapter_model.rb +90 -0
- data/lib/rhoconnect/model/js_base.rb +121 -0
- data/lib/rhoconnect/ping/android.rb +1 -1
- data/lib/rhoconnect/predefined_adapters/bench_adapter.rb +7 -4
- data/lib/rhoconnect/read_state.rb +3 -3
- data/lib/rhoconnect/server.rb +159 -190
- data/lib/rhoconnect/source.rb +100 -11
- data/lib/rhoconnect/stats/record.rb +10 -10
- data/lib/rhoconnect/store.rb +905 -591
- data/lib/rhoconnect/{model.rb → store_orm.rb} +53 -115
- data/lib/rhoconnect/tasks.rb +18 -4
- data/lib/rhoconnect/test_methods.rb +30 -17
- data/lib/rhoconnect/user.rb +35 -17
- data/lib/rhoconnect/utilities.rb +1 -1
- data/lib/rhoconnect/version.rb +2 -2
- data/lib/rhoconnect/web-console/server.rb +29 -14
- data/lib/rhoconnect/web-console/views/home.js +10 -10
- data/lib/rhoconnect/web-console/views/new_ping.js +1 -1
- data/lib/rhoconnect.rb +120 -51
- data/rhoconnect.gemspec +4 -3
- data/spec/api/api_helper.rb +1 -6
- data/spec/api/app/fast_delete_spec.rb +4 -4
- data/spec/api/app/fast_insert_spec.rb +4 -4
- data/spec/api/app/fast_update_spec.rb +8 -8
- data/spec/api/app/push_deletes_spec.rb +2 -2
- data/spec/api/app/push_objects_spec.rb +5 -5
- data/spec/api/client/client_get_db_doc_spec.rb +6 -4
- data/spec/api/client/client_set_db_doc_spec.rb +3 -2
- data/spec/api/client/get_client_params_spec.rb +14 -0
- data/spec/api/client/list_client_docs_spec.rb +30 -20
- data/spec/api/client/reset_spec.rb +36 -0
- data/spec/api/source/get_source_params_spec.rb +23 -17
- data/spec/api/system/get_license_info_spec.rb +0 -20
- data/spec/api/system/login_spec.rb +8 -0
- data/spec/api/system/reset_spec.rb +0 -1
- data/spec/api/system/stats_spec.rb +5 -5
- data/spec/api/user/create_user_spec.rb +14 -6
- data/spec/api/user/delete_user_spec.rb +20 -18
- data/spec/api/user/list_users_spec.rb +5 -6
- data/spec/api/user/update_user_spec.rb +5 -4
- data/spec/apps/rhotestapp/config.ru +16 -1
- data/spec/apps/rhotestapp/controllers/js/js_sample_controller.js +23 -0
- data/spec/apps/rhotestapp/controllers/js/sample2_controller.js +32 -0
- data/spec/apps/rhotestapp/controllers/ruby/application_controller.rb +21 -0
- data/spec/apps/rhotestapp/controllers/ruby/sample_adapter_controller.rb +8 -0
- data/spec/apps/rhotestapp/models/js/js_sample.js +55 -0
- data/spec/apps/rhotestapp/models/js/sample2.js +25 -0
- data/spec/apps/rhotestapp/{sources → models/ruby}/base_adapter.rb +0 -0
- data/spec/apps/rhotestapp/{sources → models/ruby}/fixed_schema_adapter.rb +0 -0
- data/spec/apps/rhotestapp/{sources → models/ruby}/other_adapter.rb +0 -0
- data/spec/apps/rhotestapp/{sources → models/ruby}/sample_adapter.rb +0 -0
- data/spec/apps/rhotestapp/{sources → models/ruby}/simple_adapter.rb +2 -2
- data/spec/apps/rhotestapp/{sources → models/ruby}/sub_adapter.rb +0 -0
- data/spec/apps/rhotestapp/settings/settings.yml +0 -1
- data/spec/bulk_data/bulk_data_spec.rb +20 -5
- data/spec/cli/cli_spec.rb +83 -0
- data/spec/client_spec.rb +20 -17
- data/spec/client_sync_spec.rb +244 -406
- data/spec/controllers/js_base_spec.rb +89 -0
- data/spec/doc/doc_spec.rb +18 -18
- data/spec/document_spec.rb +29 -13
- data/spec/dynamic_adapter_spec.rb +6 -6
- data/spec/generator/generator_spec.rb +7 -4
- data/spec/jobs/bulk_data_job_spec.rb +14 -10
- data/spec/jobs/source_job_spec.rb +8 -8
- data/spec/license_spec.rb +5 -2
- data/spec/models/js_model_spec.rb +39 -0
- data/spec/node_spec.rb +42 -0
- data/spec/perf/store_perf_spec.rb +67 -12
- data/spec/ping/android_spec.rb +1 -1
- data/spec/read_state_spec.rb +1 -1
- data/spec/rhoconnect_spec.rb +1 -1
- data/spec/server/cors_spec.rb +14 -18
- data/spec/server/server_spec.rb +265 -88
- data/spec/server/stats_spec.rb +1 -1
- data/spec/source_adapter_spec.rb +54 -27
- data/spec/source_spec.rb +8 -3
- data/spec/source_sync_spec.rb +538 -468
- data/spec/spec_helper.rb +35 -4
- data/spec/stats/record_spec.rb +10 -10
- data/spec/{model_spec.rb → store_orm_spec.rb} +56 -54
- data/spec/store_spec.rb +159 -179
- data/spec/support/shared_examples.rb +36 -27
- data/spec/sync_states_spec.rb +40 -33
- data/spec/test_methods_spec.rb +18 -14
- data/spec/user_spec.rb +17 -30
- metadata +156 -52
- data/bench/benchapp/application.rb +0 -39
- data/bench/blobapp/application.rb +0 -44
- data/commands/rhoconnect/clean_start.rb +0 -9
- data/commands/rhoconnect/create_user.rb +0 -18
- data/commands/rhoconnect/delete_device.rb +0 -9
- data/commands/rhoconnect/delete_user.rb +0 -8
- data/commands/rhoconnect/reset.rb +0 -16
- data/commands/rhoconnect/reset_refresh.rb +0 -11
- data/generators/templates/application/application.rb +0 -43
- data/lib/rhoconnect/client_sync.rb +0 -434
- data/lib/rhoconnect/dynamic_adapter.rb +0 -91
- data/lib/rhoconnect/middleware/admin_user.rb +0 -23
- data/lib/rhoconnect/middleware/current_request.rb +0 -16
- data/lib/rhoconnect/middleware/login_required.rb +0 -22
- data/lib/rhoconnect/source_adapter.rb +0 -132
- data/lib/rhoconnect/source_sync.rb +0 -464
- data/spec/apps/rhotestapp/application.rb +0 -23
data/doc/deploying.txt
CHANGED
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
## Deploying On-Premise
|
|
4
4
|
The [sinatra book](http://sinatra-book.gittr.com/) has some great [deployment documentation](http://sinatra-book.gittr.com/#deployment) that you should review before running your RhoConnect application in production.
|
|
5
5
|
|
|
6
|
-
We recommend using the [phusion passenger](http://modrails.com/index.html) stack for deploying an on-premise RhoConnect application. Please refer to the [section on rack applications](http://modrails.com/documentation/Users%20guide%20Apache.html#_deploying_a_rack_based_ruby_application) for information on deploying a RhoConnect sinatra application.
|
|
7
|
-
|
|
8
6
|
## Deploying packaged RhoConnect software on Linux servers
|
|
9
7
|
|
|
10
8
|
You can create RhoConnect production environment on Linux servers by installing software packages
|
|
@@ -12,16 +10,16 @@ for Ubuntu and CentOS respectively. At this moment supported formats are Debian
|
|
|
12
10
|
|
|
13
11
|
Every package provides the following components:
|
|
14
12
|
|
|
15
|
-
* Ruby 1.9.3-
|
|
16
|
-
|
|
17
|
-
* Nginx HTTP server, release 1.
|
|
13
|
+
* Ruby 1.9.3-p392
|
|
14
|
+
|
|
15
|
+
* Nginx HTTP server, release 1.3.x
|
|
16
|
+
|
|
17
|
+
* Thin application server, release 1.5.x
|
|
18
18
|
|
|
19
|
-
*
|
|
19
|
+
* Redis data store, release 2.6.x
|
|
20
20
|
|
|
21
|
-
*
|
|
21
|
+
* Latest RhoConnect gem with all required dependencies
|
|
22
22
|
|
|
23
|
-
* Latest RhoConnect gem with all required dependencies
|
|
24
|
-
|
|
25
23
|
In addition, RPM package provides latest sqlite3 headers and binaries, because standard Cent OS (5.x) libraries for sqlite3 outdated.
|
|
26
24
|
|
|
27
25
|
### Getting the Packages
|
|
@@ -33,6 +31,9 @@ Add the following line to the end of your <b>/etc/apt/sources.list</b>:
|
|
|
33
31
|
|
|
34
32
|
:::text
|
|
35
33
|
deb http://rhoconnect.s3.amazonaws.com/packages/deb rhoconnect main
|
|
34
|
+
|
|
35
|
+
**NOTE: If you want to get the package with cool new features from the Beta repository, then define
|
|
36
|
+
repo url as `http://rhoconnect.s3.amazonaws.com/beta-packages/deb`**
|
|
36
37
|
|
|
37
38
|
Once the repo is added apt-get needs to be updated:
|
|
38
39
|
|
|
@@ -45,26 +46,31 @@ Once that is done, it is time to install RhoConnect:
|
|
|
45
46
|
$ sudo apt-get install rhoconnect
|
|
46
47
|
|
|
47
48
|
#### Steps for RedHat-Based Linux Users
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
repository.
|
|
49
|
+
Prerequisites: target Linux server should include CentOS Development tools.
|
|
50
|
+
To install them, use the this command
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
:::term
|
|
53
|
+
$ yum groupinstall 'Development Tools'
|
|
54
|
+
|
|
55
|
+
It will install for you such tools as GNU GCC C/C++ compiler, make and others.
|
|
53
56
|
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
Vanilla CentOS distribution does not include some packages required by RhoConnect installer. To resolve dependencies you
|
|
58
|
+
might wanted to use [Extra Packages for Enterprise Linux (EPEL) ](http://fedoraproject.org/wiki/EPEL)
|
|
59
|
+
repository.
|
|
56
60
|
|
|
57
|
-
For CentOS
|
|
61
|
+
For example, to enable EPEL repository for CentOS 5.x release execute these commands:
|
|
58
62
|
|
|
59
63
|
:::term
|
|
60
|
-
|
|
64
|
+
$ wget http://mirror.us.leaseweb.net/epel/5/i386/epel-release-5-4.noarch.rpm
|
|
65
|
+
$ rpm -i epel-release-5-4.noarch.rpm
|
|
66
|
+
$ yum update
|
|
61
67
|
|
|
62
|
-
|
|
68
|
+
For CentOS 6.x release:
|
|
63
69
|
|
|
64
70
|
:::term
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
71
|
+
$ wget http://ftp.osuosl.org/pub/fedora-epel/6/i386/epel-release-6-8.noarch.rpm
|
|
72
|
+
$ rpm -i epel-release-6-8.noarch.rpm
|
|
73
|
+
$ yum update
|
|
68
74
|
|
|
69
75
|
Now you can create a file named <b>rhoconnect.repo</b> in the <b>/etc/yum.repos.d/</b> directory:
|
|
70
76
|
|
|
@@ -80,6 +86,8 @@ Copy and paste these contents into the file.
|
|
|
80
86
|
enabled=1
|
|
81
87
|
gpgcheck=0
|
|
82
88
|
|
|
89
|
+
**NOTE: If you want to get the package with cool new features from the Beta repository, then define baseurl as
|
|
90
|
+
`baseurl=http://rhoconnect.s3.amazonaws.com/beta-packages/rpm`**
|
|
83
91
|
|
|
84
92
|
Once that is done, it is time to install RhoConnect:
|
|
85
93
|
|
|
@@ -88,12 +96,12 @@ Once that is done, it is time to install RhoConnect:
|
|
|
88
96
|
|
|
89
97
|
### Final Steps (After the installer is finished)
|
|
90
98
|
Installer also created and configured RhoConnect <b>rhoapp</b> application in <b>/opt/nginx/html</b> directory.
|
|
91
|
-
To test it you need to as a root user start redis,
|
|
99
|
+
To test it you need to as a root user start redis, thin, and nginx servers:
|
|
92
100
|
|
|
93
101
|
:::term
|
|
94
102
|
$ sudo /etc/init.d/redis start
|
|
95
|
-
$ sudo /etc/init.d/nginx start
|
|
96
103
|
$ sudo /etc/init.d/thin start
|
|
104
|
+
$ sudo /etc/init.d/nginx start
|
|
97
105
|
|
|
98
106
|
And verify that it's up and running by visiting application web console in your browser:
|
|
99
107
|
|
|
@@ -106,7 +114,7 @@ Installer compiled and configured Nginx as reverse proxy web server (/opt/nginx)
|
|
|
106
114
|
|
|
107
115
|
* Nginx logrotate settings (`/etc/logrotate.d/nginx`)
|
|
108
116
|
|
|
109
|
-
* Nginx configuration file (`/opt/nginx/conf/nginx.conf`)
|
|
117
|
+
* Nginx configuration file (`/opt/nginx/conf/nginx.conf`)
|
|
110
118
|
|
|
111
119
|
* virtual host template for rhoconnect application (`/opt/nginx/conf/conf.d/rhoconnect.conf`)
|
|
112
120
|
|
|
@@ -120,7 +128,7 @@ Default setup of Nginx server is to deal with back-end servers (called "upstream
|
|
|
120
128
|
|
|
121
129
|
:::text
|
|
122
130
|
# /opt/nginx/conf/conf.d/rhoconnect.conf file
|
|
123
|
-
|
|
131
|
+
|
|
124
132
|
upstream thin_cluster {
|
|
125
133
|
least_conn;
|
|
126
134
|
server unix:/tmp/thin.0.sock;
|
|
@@ -129,11 +137,11 @@ Default setup of Nginx server is to deal with back-end servers (called "upstream
|
|
|
129
137
|
#server unix:/tmp/thin.2.sock;
|
|
130
138
|
#server unix:/tmp/thin.3.sock;
|
|
131
139
|
}
|
|
132
|
-
|
|
140
|
+
|
|
133
141
|
server {
|
|
134
142
|
listen 80;
|
|
135
143
|
# Be sure to point to 'public' folder of your application!
|
|
136
|
-
root /opt/nginx/html/rhoapp/public;
|
|
144
|
+
root /opt/nginx/html/rhoapp/public;
|
|
137
145
|
# ...
|
|
138
146
|
|
|
139
147
|
}
|
|
@@ -160,7 +168,7 @@ Configuration file is generated by this command:
|
|
|
160
168
|
:::term
|
|
161
169
|
$ thin config -C /etc/thin/rhoapp.yml -c /opt/nginx/html/rhoapp/ --socket /tmp/thin.sock --servers 2 --log /var/log/thin/thin.log --pid /var/run/thin/thin.pid -e production
|
|
162
170
|
|
|
163
|
-
### Development and deployment of RhoConnect applications
|
|
171
|
+
### Development and deployment of RhoConnect applications
|
|
164
172
|
|
|
165
173
|
Packaged software does not setup automatically path to installed ruby bins and gems, so you need do it manually. Add necessary bins to the path(s) of the users who will be using this software. You may also wish to add these items
|
|
166
174
|
to your bash scripts (i.e. `~/.profile` on Ubuntu; `~/.bash_profile` on CentOS) to automatically add them upon login.
|
|
@@ -168,6 +176,8 @@ to your bash scripts (i.e. `~/.profile` on Ubuntu; `~/.bash_profile` on CentOS)
|
|
|
168
176
|
:::text
|
|
169
177
|
export PATH=/opt/rhoconnect/bin:$PATH
|
|
170
178
|
|
|
179
|
+
#### Deploying a rhoconnect app
|
|
180
|
+
|
|
171
181
|
To deploy and develop your rhoconnect app on nginx and thin servers
|
|
172
182
|
|
|
173
183
|
a) Copy your rhoconnect project (lets name it as `your_rhoconnect_app`) to default location to `/opt/nginx/html` directory
|
|
@@ -179,33 +189,33 @@ b) Set up for it `nginx` owner
|
|
|
179
189
|
$ sudo chown -R nginx:nginx your_rhoconnect_app/
|
|
180
190
|
|
|
181
191
|
c) Make sure that your app is bundled properly
|
|
182
|
-
|
|
192
|
+
|
|
183
193
|
:::term
|
|
184
194
|
$ cd your_rhoconnect_app
|
|
185
195
|
$ sudo /opt/rhoconnect/bin/bundle install
|
|
186
196
|
|
|
187
|
-
d) Configure Nginx virtual host for your rhoconnect application. For that edit the file
|
|
197
|
+
d) Configure Nginx virtual host for your rhoconnect application. For that edit the file
|
|
188
198
|
`/opt/nginx/conf/conf.d/rhoconnect.conf`, so that it reflects your specifications (root directive)
|
|
189
199
|
|
|
190
200
|
:::text
|
|
191
201
|
# ...
|
|
192
202
|
server {
|
|
193
203
|
listen 80;
|
|
194
|
-
# Be sure your app have 'public' folder and root directive
|
|
204
|
+
# Be sure your app have 'public' folder and root directive
|
|
195
205
|
# point to it!
|
|
196
206
|
root /opt/nginx/html/your_rhoconnect_app/public;
|
|
197
207
|
# ...
|
|
198
208
|
}
|
|
199
209
|
|
|
200
|
-
e) Edit Thin `/etc/thin/rhoapp.yml` configuration file directly
|
|
210
|
+
e) Edit Thin `/etc/thin/rhoapp.yml` configuration file directly
|
|
201
211
|
|
|
202
212
|
:::yaml
|
|
203
213
|
---
|
|
204
214
|
chdir: /opt/nginx/html/your_rhoconnect_app
|
|
205
215
|
# ...
|
|
206
|
-
|
|
216
|
+
|
|
207
217
|
or as root user generate a new one
|
|
208
|
-
|
|
218
|
+
|
|
209
219
|
:::term
|
|
210
220
|
$ env PATH=/opt/rhoconnect/bin:$PATH thin config -C /etc/thin/your_rhoconnect_app.yml \
|
|
211
221
|
-c /opt/nginx/html/your_rhoconnect_app/ \
|
|
@@ -213,25 +223,155 @@ e) Edit Thin `/etc/thin/rhoapp.yml` configuration file directly
|
|
|
213
223
|
--user nginx --group nginx \
|
|
214
224
|
--pid /var/run/thin/thin.pid -e production
|
|
215
225
|
|
|
216
|
-
f) As root user restart
|
|
217
|
-
|
|
226
|
+
f) As root user restart Thin, and Nginx servers
|
|
227
|
+
|
|
218
228
|
:::term
|
|
219
|
-
/etc/init.d/nginx restart
|
|
220
229
|
/etc/init.d/thin restart
|
|
230
|
+
/etc/init.d/nginx restart
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
#### Deploying multiple rhoconnect apps
|
|
234
|
+
|
|
235
|
+
**NOTE: Deploying multiple rhoconnect apps on nginx has not yet been tested. Perform these steps only if you are experienced with nginx.**
|
|
236
|
+
|
|
237
|
+
To deploy and develop two rhoconnect applications on nginx and thin servers,
|
|
238
|
+
refer to the nginx documentation on [nginx server blocks](http://wiki.nginx.org/ServerBlockExample) to see how to configure an nginx sever for multiple host names.
|
|
239
|
+
|
|
240
|
+
For each rhoconnect app, you need to set up its own redis instance. Refer to [the redis quick start documentation](http://redis.io/topics/quickstart).
|
|
241
|
+
|
|
242
|
+
If you have questions on setting this up, contact your system administrator.
|
|
243
|
+
|
|
244
|
+
#### Monitoring and Logging
|
|
221
245
|
|
|
222
246
|
For monitoring and troubleshooting purposes visit web console of your app and look at log files in `/opt/nginx/logs`.
|
|
223
247
|
|
|
224
|
-
Also you can use RhoConnect `/opt/nginx/html/rhoapp` application as a template and modify it as you wanted.
|
|
248
|
+
Also you can use RhoConnect `/opt/nginx/html/rhoapp` application as a template and modify it as you wanted.
|
|
225
249
|
|
|
226
|
-
**NOTE: You should pay attentions to situations, if you have already Ruby installed on system level. Avoid usage of system gems in your application. It might lead to unpredictable results, if ruby versions are different. Either set up path to rhoconnect binaries for root user,
|
|
250
|
+
**NOTE: You should pay attentions to situations, if you have already Ruby installed on system level. Avoid usage of system gems in your application. It might lead to unpredictable results, if ruby versions are different. Either set up path to rhoconnect binaries for root user,
|
|
227
251
|
or install required gems as `sudo /opt/rhoconnect/bin/gem install gem_name`**
|
|
228
252
|
|
|
253
|
+
## Nginx configuration for SSL with self-signed certificate
|
|
254
|
+
|
|
255
|
+
### About Self-Signed Certificates
|
|
256
|
+
A SSL certificate is a way to encrypt a site's information and create a more secure connection.
|
|
257
|
+
This chapter will take you through generating a self-signed certificate to use with Nginx.
|
|
258
|
+
|
|
259
|
+
### Create a Directory for the Certificate
|
|
260
|
+
The SSL certificate has 2 main parts: the certificate itself and the public key. To make all of the relevant files easy to access, you should create a directory to store them in:
|
|
261
|
+
|
|
262
|
+
:::term
|
|
263
|
+
$ sudo mkdir /opt/nginx/ssl
|
|
264
|
+
|
|
265
|
+
We will perform the next few steps within the directory:
|
|
266
|
+
|
|
267
|
+
:::term
|
|
268
|
+
$ cd /opt/nginx/ssl
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
### Create the Server Key and Certificate Signing Request
|
|
272
|
+
Start by creating the private server key. During this process, you will be asked to enter a specific passphrase. Be sure to note this phrase carefully, if you forget it or lose it, you will not be able to access the certificate.
|
|
273
|
+
|
|
274
|
+
:::term
|
|
275
|
+
$ openssl genrsa -des3 -out server.key 1024
|
|
276
|
+
Generating RSA private key, 1024 bit long modulus
|
|
277
|
+
..........++++++
|
|
278
|
+
..................++++++
|
|
279
|
+
e is 65537 (0x10001)
|
|
280
|
+
Enter pass phrase for server.key:
|
|
281
|
+
Verifying - Enter pass phrase for server.key:
|
|
282
|
+
|
|
283
|
+
Follow up by creating a certificate signing request:
|
|
284
|
+
|
|
285
|
+
:::term
|
|
286
|
+
$ openssl req -new -key server.key -out server.csr
|
|
287
|
+
|
|
288
|
+
This command will prompt terminal to display a lists of fields that need to be filled in.
|
|
289
|
+
The most important line is "Common Name". Enter your official domain name here or,
|
|
290
|
+
if you don't have one yet, your site's IP address. Leave the challenge password and optional company name blank.
|
|
291
|
+
:::term
|
|
292
|
+
Enter pass phrase for server.key:
|
|
293
|
+
You are about to be asked to enter information that will be incorporated
|
|
294
|
+
into your certificate request.
|
|
295
|
+
What you are about to enter is what is called a Distinguished Name or a DN.
|
|
296
|
+
There are quite a few fields but you can leave some blank
|
|
297
|
+
For some fields there will be a default value,
|
|
298
|
+
If you enter '.', the field will be left blank.
|
|
299
|
+
-----
|
|
300
|
+
Country Name (2 letter code) [AU]:YOUR_COUNTRY
|
|
301
|
+
State or Province Name (full name) [Some-State]:YOUR_STATE
|
|
302
|
+
Locality Name (eg, city) []:YOUR_CITY
|
|
303
|
+
Organization Name (eg, company) [Internet Widgits Pty Ltd]:YOUR_COMPANY
|
|
304
|
+
Organizational Unit Name (eg, section) []:YOUR_UNIT
|
|
305
|
+
Common Name (eg, YOUR name) []:YOUR_DOMAINNAME_HERE
|
|
306
|
+
Email Address []:YOUR_EMAIL
|
|
307
|
+
|
|
308
|
+
Please enter the following 'extra' attributes
|
|
309
|
+
to be sent with your certificate request
|
|
310
|
+
A challenge password []:
|
|
311
|
+
An optional company name []:
|
|
312
|
+
|
|
313
|
+
### Remove the Passphrase
|
|
314
|
+
We are almost finished creating the certificate. However, it would serve us to remove the passphrase. Although having the passphrase in place does provide heightened security, the issue starts when one tries to reload nginx. In the event that nginx crashes or needs to reboot, you will always have to re-enter your passphrase to get your entire web server back online.
|
|
315
|
+
|
|
316
|
+
Use these commands to remove the password:
|
|
317
|
+
:::term
|
|
318
|
+
$ cp server.key server.key.org
|
|
319
|
+
$ openssl rsa -in server.key.org -out server.key
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
### Sign your SSL Certificate
|
|
323
|
+
Your certificate is all but done, and you just have to sign it.
|
|
324
|
+
|
|
325
|
+
Keep in mind that you can specify how long the certificate should remain valid by changing the 365 to the number of days you prefer. As it stands this certificate will expire after one year.
|
|
326
|
+
:::term
|
|
327
|
+
$ openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
|
|
328
|
+
Signature ok
|
|
329
|
+
subject= ...
|
|
330
|
+
Getting Private key
|
|
331
|
+
|
|
332
|
+
### Set Up the Certificate
|
|
333
|
+
Now we have all of the required components of the finished certificate.
|
|
334
|
+
The next thing to do is to set up the virtual host to serve your domain from HTTS connection.
|
|
335
|
+
|
|
336
|
+
Update existing Nginx `/opt/nginx/conf/conf.d/https_rhoconnect.conf` configuration file by including the newly signed certificate and private key:
|
|
337
|
+
:::term
|
|
338
|
+
upstream thin_cluster {
|
|
339
|
+
# ...
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
# HTTPS server
|
|
343
|
+
server {
|
|
344
|
+
listen 443;
|
|
345
|
+
server_name YOUR_DOMAINNAME_HERE;
|
|
346
|
+
root /opt/nginx/html/#{app_name}/public;
|
|
347
|
+
|
|
348
|
+
location / {
|
|
349
|
+
# ...
|
|
350
|
+
proxy_pass http://thin_cluster;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
ssl on;
|
|
354
|
+
ssl_certificate /opt/nginx/ssl/server.crt;
|
|
355
|
+
ssl_certificate_key /opt/nginx/ssl/server.key;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
### Activate the Virtual Host
|
|
360
|
+
Restart nginx:
|
|
361
|
+
:::term
|
|
362
|
+
$ /etc/init.d/nginx restart
|
|
363
|
+
|
|
364
|
+
Now we're ready to access the above host using:
|
|
365
|
+
:::term
|
|
366
|
+
https://YOUR_DOMAINNAME_HERE
|
|
367
|
+
|
|
368
|
+
|
|
229
369
|
## Deploying RhoConnect Redis and Push packages on Linux servers
|
|
230
370
|
|
|
231
371
|
### RhoConnect Redis
|
|
232
372
|
|
|
233
|
-
RhoConnect Redis is a packaged Redis server for RhoConnect development and production environment on Linux servers.
|
|
234
|
-
<b>rhoconnect-redis</b> package might be useful if you want to deploy Redis on separate server.
|
|
373
|
+
RhoConnect Redis is a packaged Redis server for RhoConnect development and production environment on Linux servers.
|
|
374
|
+
<b>rhoconnect-redis</b> package might be useful if you want to deploy Redis on separate server.
|
|
235
375
|
|
|
236
376
|
The package compiles from sources latest stable Redis release (2.4.15) and installs it to `/opt/rhoconnect` directory with the following settings:
|
|
237
377
|
|
|
@@ -285,13 +425,20 @@ You can start a redis server using the following command.
|
|
|
285
425
|
$ sudo /etc/init.d/redis start
|
|
286
426
|
|
|
287
427
|
### RhoConnect Push Service
|
|
288
|
-
You can create a RhoConnect Push production environment on Linux servers by installing prepackaged software for
|
|
428
|
+
You can create a RhoConnect Push production environment on Linux servers by installing prepackaged software for
|
|
429
|
+
Ubuntu (12.x) and CentOS (5.x/6.x). In a few clicks, you will have installed on your Linux server.
|
|
289
430
|
|
|
290
431
|
* Node.js with Npm package manager
|
|
291
432
|
|
|
292
433
|
* RhoConnect Push service
|
|
293
434
|
|
|
294
|
-
* Upstart script to start, stop, and control Push service
|
|
435
|
+
* Upstart script to start, stop, and control Push service (for Ubuntu and CentOS 6.x)
|
|
436
|
+
|
|
437
|
+
* `/etc/init.d/rhoconnect-push` init script to start, stop, and restart Push service (CentOS 5.x)
|
|
438
|
+
|
|
439
|
+
Prerequisites:
|
|
440
|
+
|
|
441
|
+
* Python 2.6 or 2.7
|
|
295
442
|
|
|
296
443
|
#### Steps for Debian-Based Linux Users
|
|
297
444
|
Add the following line to the end of your /etc/apt/sources.list.
|
|
@@ -306,7 +453,16 @@ Then update the repo list and install RhoConnect Push.
|
|
|
306
453
|
$ sudo apt-get install rhoconnect-push
|
|
307
454
|
|
|
308
455
|
#### Steps for RedHat-Based Linux Users
|
|
309
|
-
|
|
456
|
+
Node.js requires python 2.6 which is not available for CentOS 5 stock version.
|
|
457
|
+
For this flavor of linux you need to manually install EPEL repo and install python26 RPM out of it:
|
|
458
|
+
|
|
459
|
+
:::term
|
|
460
|
+
$ wget http://mirror.chpc.utah.edu/pub/epel/5/i386/epel-release-5-4.noarch.rpm
|
|
461
|
+
$ rpm -i epel-release-5-4.noarch.rpm
|
|
462
|
+
$ yum install python26
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
Now create a file named rhoconnect-repo.repo in the /etc/yum.repos.d/ directory.
|
|
310
466
|
|
|
311
467
|
:::term
|
|
312
468
|
$ sudo nano /etc/yum.repos.d/rhoconnect-repo.repo
|
|
@@ -332,55 +488,71 @@ and deploy it into the J2EE App Server.
|
|
|
332
488
|
(see the corresponding 'rake' task for creating the WAR containers).
|
|
333
489
|
Deploying the WAR container varies per J2EE App Server, for JBoss it is necessary
|
|
334
490
|
to place the WAR file into the server's deploy directory.
|
|
335
|
-
|
|
336
|
-
## Deploying on Heroku Cedar
|
|
337
491
|
|
|
338
|
-
####
|
|
492
|
+
#### Deploying warbler package on Apache Tomcat web server
|
|
493
|
+
To successfully deploy warbler package on Tomcat you need to make rhoconnect app be the default app. There are a few ways to reach
|
|
494
|
+
this goal and we describe only a couple of them.
|
|
339
495
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
* Rhoconnect gem version >= 3.2.0
|
|
496
|
+
##### Method 1
|
|
343
497
|
|
|
344
|
-
|
|
345
|
-
Create your Rhoconnect app and make sure that it's up and running in your development environment using thin:
|
|
498
|
+
1) Stop Tomcat `shutdown.sh`
|
|
346
499
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
500
|
+
2) Delete the `ROOT` directory under `$CATALINA_BASE/webapps`
|
|
501
|
+
|
|
502
|
+
3) Name your war file as `ROOT.war` (capitals mandatory)
|
|
503
|
+
|
|
504
|
+
4) Drop the `ROOT.war` file directly in the `$CATALINA_BASE/webapps` directory
|
|
505
|
+
|
|
506
|
+
5) Start Tomcat `startup.sh`
|
|
507
|
+
|
|
508
|
+
##### Method 2
|
|
509
|
+
|
|
510
|
+
1) Stop Tomcat
|
|
511
|
+
|
|
512
|
+
2) Copy your war file in `$CATALINA_BASE/webapps`, under its original name
|
|
513
|
+
|
|
514
|
+
3) Turn off autoDeploy and deployOnStartup in your Host element in the server.xml file.
|
|
515
|
+
|
|
516
|
+
4) Explicitly define your application context in server.xml, specifying both path (must be empty!) and docBase.
|
|
350
517
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
518
|
+
:::xml
|
|
519
|
+
<Host name="localhost" appBase="webapps"
|
|
520
|
+
unpackWARs="true" autoDeploy="false" deployOnStartup="false">
|
|
521
|
+
<!-- ... -->
|
|
522
|
+
<Context docBase="your-app.war" path=""/>
|
|
523
|
+
<!-- ... -->
|
|
524
|
+
</Host>
|
|
525
|
+
|
|
526
|
+
5) Start Tomcat
|
|
527
|
+
|
|
528
|
+
## Deploying on Heroku
|
|
354
529
|
|
|
355
|
-
|
|
356
|
-
web: bundle exec thin start -p $PORT
|
|
530
|
+
#### Prerequisites
|
|
357
531
|
|
|
358
|
-
|
|
532
|
+
* [Heroku account](https://api.heroku.com/login) and [Heroku Toolbelt](https://toolbelt.heroku.com/)
|
|
359
533
|
|
|
360
|
-
|
|
361
|
-
web: bundle exec thin start -p $PORT
|
|
362
|
-
worker: bundle exec rake resque:work
|
|
534
|
+
* Rhoconnect version >= 3.4
|
|
363
535
|
|
|
364
|
-
|
|
536
|
+
#### Create Rhoconnect application
|
|
537
|
+
Create your Rhoconnect app and make sure that it's up and running in your development environment using thin:
|
|
365
538
|
|
|
366
|
-
|
|
367
|
-
$
|
|
368
|
-
$
|
|
539
|
+
:::term
|
|
540
|
+
$ cd your_rhoconnect_app
|
|
541
|
+
$ bundle exec thin start
|
|
369
542
|
|
|
370
543
|
|
|
371
544
|
#### Deploy to Heroku
|
|
372
|
-
|
|
373
|
-
Heroku server has no development libraries required to build that gem.
|
|
545
|
+
Heroku uses git as its deployment interface. To create and deploy your application on Heroku, use the the following steps:
|
|
374
546
|
|
|
375
547
|
:::term
|
|
376
548
|
$ git init
|
|
377
549
|
$ git add .
|
|
378
|
-
$ git commit -m '
|
|
379
|
-
$ heroku create
|
|
550
|
+
$ git commit -m 'initial commit'
|
|
551
|
+
$ heroku create
|
|
380
552
|
$ heroku addons:add redistogo:nano
|
|
381
553
|
$ git push heroku master
|
|
382
554
|
$ heroku open
|
|
383
|
-
|
|
555
|
+
|
|
384
556
|
#### Monitoring app on Heroku
|
|
385
557
|
Use `heroku ps` to determine the number of processes that are executing.
|
|
386
558
|
Use `heroku logs` to view an aggregated list of log messages from all process types.
|
|
@@ -388,15 +560,15 @@ Use `heroku logs` to view an aggregated list of log messages from all process ty
|
|
|
388
560
|
:::term
|
|
389
561
|
$ heroku ps
|
|
390
562
|
$ heroku logs
|
|
391
|
-
|
|
563
|
+
|
|
392
564
|
#### Get connected with Rhodes client
|
|
393
|
-
If you have a rhodes client and
|
|
565
|
+
If you have a rhodes client and want to sync it with your rhoconnect app on Heroku, then set the proper `syncserver` URL in `rhoconfig.txt`:
|
|
394
566
|
|
|
395
567
|
:::term
|
|
396
|
-
syncserver = '
|
|
568
|
+
syncserver = 'https://<your-heroku-app-here>.herokuapp.com/application'
|
|
569
|
+
|
|
397
570
|
|
|
398
571
|
|
|
399
572
|
|
|
400
573
|
|
|
401
574
|
|
|
402
|
-
|
|
@@ -1,79 +1,62 @@
|
|
|
1
|
-
Extending
|
|
1
|
+
Extending RhoConnect Application with custom routes
|
|
2
2
|
===
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
You can provide custom routes support in your Rhoconnect application while you still fully utilize the powerful features provided by the default Rhoconnect server implementation. To do this, create a custom server class inherited from `Rhoconnect::Server` and define all of your custom routes in this extended server class.
|
|
8
|
-
|
|
9
|
-
The following example illustrates how to add a sample `my_custom_route' to the existing Rhoconnect application.
|
|
10
|
-
|
|
11
|
-
1) create `my_server.rb` class in your Rhoconnect application's root directory:
|
|
12
|
-
|
|
13
|
-
:::ruby
|
|
14
|
-
class MyServer < Rhoconnect::Server
|
|
15
|
-
get '/my_custom_route' do
|
|
16
|
-
if current_user
|
|
17
|
-
send_file 'public/my_file.png'
|
|
18
|
-
end
|
|
19
|
-
nil
|
|
20
|
-
end
|
|
21
|
-
end
|
|
4
|
+
You can provide custom routes support in your RhoConnect application and utilize all the powerful features of the typical Sinatra app. To do this, simply define your routes in the corresponding controller class. Endpoint URL for your routes will be relative to the controller's root.
|
|
22
5
|
|
|
23
|
-
The
|
|
24
|
-
and returns a static PNG file (which can be later used in BLOB syncs)
|
|
6
|
+
The following example illustrates how to add a sample `my_custom_route' to the Product Controller:
|
|
25
7
|
|
|
8
|
+
:::ruby
|
|
9
|
+
class Product < Rhoconnect::Controller::Base
|
|
10
|
+
get '/my_custom_route', :login_required => true do
|
|
11
|
+
send_file 'public/my_file.png'
|
|
12
|
+
end
|
|
13
|
+
end
|
|
26
14
|
|
|
27
|
-
|
|
15
|
+
This route will have the following URL : GET '/app/v4/Product/my_custom_route'
|
|
28
16
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
run Rack::URLMap.new \
|
|
32
|
-
"/" => MyServer.new,
|
|
33
|
-
"/resque" => Resque::Server.new, # If you don't want resque frontend, disable it here
|
|
34
|
-
"/console" => RhoconnectConsole::Server.new # If you don't want rhoconnect frontend, disable it here
|
|
35
|
-
|
|
17
|
+
The above custom route implementation will respond to client's GET request, verifies the current_user (which will be extracted from the RHoConnect session cookie and checked for validity by the `:login_required` condition)
|
|
18
|
+
and returns a static PNG file (which can be later used in BLOB syncs)
|
|
36
19
|
|
|
37
20
|
Using the New Custom route in BLOB syncs
|
|
38
21
|
---
|
|
39
22
|
|
|
40
|
-
After you create the new custom routes
|
|
23
|
+
After you create the new custom routes you can reference and use them from standard Rhodes applications.
|
|
41
24
|
For example, suppose you have a Rhodes app with a Product model. To use a custom route in BLOB syncs, define the following property in the Rhodes Product model (file: `app/Product/product.rb`):
|
|
42
25
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
26
|
+
:::ruby
|
|
27
|
+
# The model has already been created by the framework, and extends Rhom::RhomObject
|
|
28
|
+
# You can add more methods here
|
|
29
|
+
class Product
|
|
30
|
+
include Rhom::PropertyBag
|
|
48
31
|
|
|
49
|
-
|
|
50
|
-
|
|
32
|
+
# Uncomment the following line to enable sync with Product.
|
|
33
|
+
enable :sync
|
|
51
34
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
35
|
+
#add model specific code here
|
|
36
|
+
property :my_custom_blob_field, :blob, :overwrite
|
|
37
|
+
end
|
|
38
|
+
|
|
56
39
|
To see the static image, modify the `app/Product/show.erb` file for the Product model in your Rhodes application:
|
|
57
40
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
41
|
+
:::html
|
|
42
|
+
<li>
|
|
43
|
+
<div class="itemLabel">My Static Field Image</div>
|
|
44
|
+
<div class="itemValue"><img src="<%=Rho::RhoApplication::get_blob_path(@product.my_custom_field)%>"></img></div>
|
|
62
45
|
</li>
|
|
63
|
-
|
|
64
|
-
Then, modify your
|
|
46
|
+
|
|
47
|
+
Then, modify your RhoConnect source adapter model (in `rhoconnect_app/models/ruby/product.rb`) to provide BLOB's url for the `my_custom_blob_field`:
|
|
65
48
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
49
|
+
:::ruby
|
|
50
|
+
def query(params=nil)
|
|
51
|
+
parsed = JSON.parse(RestClient.get("#{@base}.json").body)
|
|
69
52
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
53
|
+
@result={}
|
|
54
|
+
parsed.each do |item|
|
|
55
|
+
item["product"]["my_custom_field-rhoblob"] = "http://localhost:9292/app/v4/Product/my_custom_route"
|
|
56
|
+
@result[item["product"]["id"].to_s] = item["product"]
|
|
57
|
+
end if parsed
|
|
58
|
+
end
|
|
76
59
|
|
|
77
|
-
This way, your `my_custom_field` would be getting the BLOB image data from the custom route defined in your
|
|
60
|
+
This way, your `my_custom_field` would be getting the BLOB image data from the custom route defined in your RhoConnect Source Adapter Controller.
|
|
78
61
|
|
|
79
62
|
For more information on BLOB syncs, see [this section](http://docs.rhomobile.com/rhoconnect/blob-sync).
|
data/doc/heroku-addon.txt
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# RhoConnect Heroku Addon
|
|
2
|
+
|
|
1
3
|
RhoConnect is a data synchronization server and client library that keeps enterprise app data current and available on users’ mobile devices.
|
|
2
4
|
|
|
3
5
|
The information is stored locally on a user’s device, and is available even when disconnected and offline.
|