rhoconnect 3.3.6 → 3.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +40 -4
- data/Gemfile +2 -2
- data/Gemfile.lock +27 -25
- data/bench/benchapp/Gemfile +7 -27
- data/bench/benchapp/config.ru +9 -31
- data/bench/blobapp/Gemfile +7 -27
- data/bench/blobapp/config.ru +9 -29
- data/bench/lib/bench.rb +8 -1
- data/bench/lib/bench/test_data.rb +4 -1
- data/bench/scripts/blob_cud_script.rb +4 -0
- data/bench/scripts/cud_script.rb +7 -1
- data/bench/scripts/helpers.rb +1 -1
- data/bench/scripts/test_query_script.rb +20 -7
- data/bench/spec/bench_spec_helper.rb +3 -1
- data/bin/rhoconnect +22 -12
- data/commands/{commands/dtach_commands → dtach}/dtach_about.rb +0 -0
- data/commands/{commands/dtach_commands → dtach}/dtach_install.rb +0 -0
- data/commands/{commands/redis_commands → dtach}/redis_attach.rb +0 -0
- data/commands/execute.rb +14 -15
- data/commands/generators/update.rb +26 -0
- data/commands/{commands/redis_commands → redis}/redis_about.rb +0 -0
- data/commands/redis/redis_download.rb +13 -0
- data/commands/redis/redis_install.rb +26 -0
- data/commands/{commands/redis_commands → redis}/redis_make.rb +0 -0
- data/commands/{commands/redis_commands → redis}/redis_restart.rb +3 -2
- data/commands/{commands/redis_commands → redis}/redis_start.rb +0 -0
- data/commands/{commands/redis_commands → redis}/redis_startbg.rb +0 -0
- data/commands/{commands/redis_commands → redis}/redis_stop.rb +3 -2
- data/commands/{commands/rhoconnect → rhoconnect}/clean_start.rb +0 -0
- data/commands/{commands/rhoconnect → rhoconnect}/config.rb +7 -2
- data/commands/{commands/rhoconnect → rhoconnect}/create_user.rb +0 -0
- data/commands/{commands/rhoconnect → rhoconnect}/delete_device.rb +0 -0
- data/commands/{commands/rhoconnect → rhoconnect}/delete_user.rb +0 -0
- data/commands/{commands/rhoconnect → rhoconnect}/flushdb.rb +4 -4
- data/commands/{commands/rhoconnect → rhoconnect}/get_token.rb +0 -0
- data/commands/{commands/rhoconnect → rhoconnect}/reset.rb +0 -0
- data/commands/{commands/rhoconnect → rhoconnect}/reset_refresh.rb +0 -0
- data/commands/{commands/rhoconnect → rhoconnect}/restart.rb +0 -0
- data/commands/{commands/rhoconnect → rhoconnect}/secret.rb +0 -0
- data/commands/{commands/rhoconnect → rhoconnect}/set_admin_password.rb +0 -0
- data/commands/{commands/rhoconnect → rhoconnect}/spec.rb +0 -0
- data/commands/rhoconnect/start.rb +27 -0
- data/commands/{commands/rhoconnect → rhoconnect}/startbg.rb +0 -0
- data/commands/{commands/rhoconnect → rhoconnect}/startdebug.rb +2 -2
- data/commands/{commands/rhoconnect → rhoconnect}/stop.rb +3 -4
- data/commands/{commands/rhoconnect → rhoconnect}/version.rb +0 -0
- data/commands/{commands/rhoconnect → rhoconnect}/web.rb +0 -0
- data/commands/rhoconnect_attach/attach.rb +10 -0
- data/commands/rhoconnect_console/console.rb +16 -0
- data/commands/{commands/rhoconnect → rhoconnect_console}/console_helper.rb +0 -0
- data/commands/{commands/rhoconnect → rhoconnect_war}/war.rb +0 -0
- data/commands/{commands/redis_commands → utilities}/redis_runner.rb +22 -19
- data/commands/utilities/utilities.rb +6 -0
- data/doc/benchmarks.txt +2 -2
- data/doc/bulk-sync.txt +12 -1
- data/doc/client-java.txt +3 -3
- data/doc/client-objc.txt +1 -1
- data/doc/client.txt +5 -5
- data/doc/command-line.txt +80 -135
- data/doc/deploying.txt +119 -12
- data/doc/extending-rhoconnect-server.txt +1 -1
- data/doc/heroku-addon.txt +119 -23
- data/doc/install.txt +101 -39
- data/doc/java-plugin.txt +2 -2
- data/doc/licensing.txt +1 -1
- data/doc/plugin-intro.txt +3 -1
- data/doc/preparing-production.txt +4 -4
- data/doc/public/cli.txt +2 -2
- data/doc/push-backend-setup.txt +11 -1
- data/doc/push-client-setup.txt +72 -2
- data/doc/push-server-setup.txt +129 -8
- data/doc/rails-plugin.txt +245 -40
- data/doc/rest-api.txt +10 -6
- data/doc/rhoconnect-calculator.txt +237 -0
- data/doc/rhoconnect-redis-stack.txt +35 -0
- data/doc/session-and-configuration.txt +24 -0
- data/doc/settings.txt +51 -41
- data/doc/source-adapters.txt +45 -45
- data/doc/stats-middleware.txt +2 -2
- data/doc/supported-platforms.txt +6 -6
- data/doc/testing.txt +2 -2
- data/doc/tutorial.txt +63 -63
- data/examples/simple/Gemfile +7 -35
- data/examples/simple/config.ru +8 -26
- data/examples/simple/sources/product.rb +6 -6
- data/generators/rhoconnect.rb +5 -0
- data/generators/templates/application/Gemfile +7 -37
- data/generators/templates/application/Rakefile +8 -0
- data/generators/templates/application/config.ru +12 -31
- data/generators/templates/application/rcgemfile +44 -0
- data/generators/templates/application/settings/settings.yml +7 -5
- data/install.sh +4 -4
- data/installer/unix-like/create_texts.rb +7 -2
- data/installer/unix-like/rho_connect_install_constants.rb +2 -2
- data/installer/unix-like/rho_connect_install_installers.rb +1 -16
- data/lib/rhoconnect.rb +51 -38
- data/lib/rhoconnect/api/app/query.rb +4 -1
- data/lib/rhoconnect/api/app/search.rb +4 -1
- data/lib/rhoconnect/api/client/list_client_docs.rb +3 -1
- data/lib/rhoconnect/api/user/ping.rb +1 -5
- data/lib/rhoconnect/application/init.rb +43 -0
- data/lib/rhoconnect/async.rb +11 -6
- data/lib/rhoconnect/client_sync.rb +30 -37
- data/lib/rhoconnect/document.rb +4 -0
- data/lib/rhoconnect/graph_helper.rb +74 -56
- data/lib/rhoconnect/middleware/helpers.rb +4 -0
- data/lib/rhoconnect/ping.rb +1 -0
- data/lib/rhoconnect/ping/gcm.rb +58 -0
- data/lib/rhoconnect/predefined_adapters/bench_adapter.rb +7 -1
- data/lib/rhoconnect/source.rb +70 -56
- data/lib/rhoconnect/source_sync.rb +33 -5
- data/lib/rhoconnect/store.rb +358 -110
- data/lib/rhoconnect/user.rb +8 -0
- data/lib/rhoconnect/utilities.rb +16 -14
- data/lib/rhoconnect/version.rb +1 -1
- data/lib/rhoconnect/web-console/models/client.js +1 -1
- data/lib/rhoconnect/web-console/public/UNVR67bold.ttf +0 -0
- data/lib/rhoconnect/web-console/public/bootstrap.css +6 -0
- data/lib/rhoconnect/web-console/public/logo.png +0 -0
- data/lib/rhoconnect/web-console/server.rb +13 -11
- data/lib/rhoconnect/web-console/templates/index.erb +5 -5
- data/lib/rhoconnect/web-console/templates/jqplot.erb +1 -0
- data/lib/rhoconnect/web-console/views/doc.js +0 -4
- data/lib/rhoconnect/web-console/views/home.js +2 -1
- data/lib/rhoconnect/web-console/views/new_ping.js +11 -6
- data/lib/rhoconnect/web-console/views/stats.js +9 -5
- data/rhoconnect.gemspec +6 -4
- data/spec/api/app/fast_update_spec.rb +2 -2
- data/spec/api/source/get_source_params_spec.rb +1 -0
- data/spec/apps/rhotestapp/settings/settings.yml +5 -5
- data/spec/client_sync_spec.rb +3 -14
- data/spec/perf/perf_spec_helper.rb +11 -7
- data/spec/perf/store_perf_spec.rb +88 -11
- data/spec/ping/gcm_spec.rb +99 -0
- data/spec/server/server_spec.rb +7 -0
- data/spec/server/stats_spec.rb +9 -2
- data/spec/source_sync_spec.rb +29 -0
- data/spec/spec_helper.rb +40 -38
- data/spec/stats/record_spec.rb +18 -9
- data/spec/store_spec.rb +128 -19
- data/spec/testdata/10000-data.txt +0 -0
- data/spec/testdata/5-data.txt +0 -0
- data/spec/testdata/5000-data.txt +0 -0
- data/tasks/jasmine.rake +1 -0
- data/tasks/redis.rake +16 -13
- metadata +71 -39
- data/commands/commands/redis_commands/redis_download.rb +0 -33
- data/commands/commands/redis_commands/redis_install.rb +0 -26
- data/commands/commands/rhoconnect/attach.rb +0 -8
- data/commands/commands/rhoconnect/console.rb +0 -15
- data/commands/commands/rhoconnect/start.rb +0 -18
- data/commands/utilities/dtach_installed.rb +0 -10
data/doc/benchmarks.txt
CHANGED
@@ -146,7 +146,7 @@ sudo chown -R www-data:www-data blobapp/
|
|
146
146
|
|
147
147
|
Edit <b>Nginx</b> configuration file, set server_name and root properties to public DNS server name
|
148
148
|
and bench application public folder respectively. After restarting server make sure that bench application is
|
149
|
-
running by visiting its web
|
149
|
+
running by visiting its web console, i.e. :
|
150
150
|
<pre>
|
151
151
|
http://server_dns_public_name/console/
|
152
152
|
</pre>
|
@@ -164,7 +164,7 @@ Edit rhoconnect/bench/benchapp/settings/settings.yml and set redis and syncserve
|
|
164
164
|
|
165
165
|
Do the same for blobapp settings.yml file.
|
166
166
|
|
167
|
-
Then from rhoconnect/
|
167
|
+
Then from rhoconnect/bench directory execute run_cud_script.sh and run_blob_script.sh scripts respectively.
|
168
168
|
|
169
169
|
## Multi-core Amazon EC2 server environments
|
170
170
|
|
data/doc/bulk-sync.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Bulk Sync
|
2
2
|
===
|
3
|
-
During the initial sync process in your
|
3
|
+
During the initial sync process in your application, you may need to deliver a large number of objects. This may result in many megabytes of data being sent to the device. In this case, incremental synchronization may take a while to complete since it uses JSON as the wire format. To significantly speed up this process you may use RhoConnect's "bulk sync" feature.
|
4
4
|
|
5
5
|
## Bulk Sync Process
|
6
6
|
|
@@ -14,6 +14,8 @@ If and when the Rhodes application issues a request to get bulk data, the RhoCon
|
|
14
14
|
|
15
15
|
* The Rhodes application will poll RhoConnect for the bulk sync job to finish. Once the job is finished, the files are generated and Rhodes will download and install them to the device.
|
16
16
|
|
17
|
+
* After bulk database is installed, Rhodes application will analyze sources for references to remote blob objects. Each remote blob object will be downloaded to device, and if download is successful, remote references will be updated to local ones.
|
18
|
+
|
17
19
|
**NOTE: Be cautious using this in your application - any previous set of objects on the device will be replaced with the latest set from the backend service.**
|
18
20
|
|
19
21
|
Once the bulk data sync process is complete for a source, you may continue to synchronize sources using the default incremental sync process. However, the default sync process may be disabled for a source by setting its `sync_type` to 'bulk_sync_only'. This will save space in your redis database if you don't plan on using incremental sync for this source.
|
@@ -145,3 +147,12 @@ An example schema method is as follows:
|
|
145
147
|
|
146
148
|
**NOTE: Key `version` is mandatory and should be always defined in schema method. You need update `version` value only in the case of schema changes.**
|
147
149
|
|
150
|
+
## Select which models to bulk sync.
|
151
|
+
|
152
|
+
Bulk sync process will only sync sources which sync type is not ‘none’. You may exclude model data from bulk sync with following code in your Rhodes application:
|
153
|
+
|
154
|
+
:::ruby
|
155
|
+
Rho::RHO.get_user_db().update_into_table('sources',{'sync_type'=>'none'}, {'name'=> "MySourceName" })
|
156
|
+
|
157
|
+
Set sync type to 'incremental' or 'bulk' when you want to get model data with bulk sync.
|
158
|
+
|
data/doc/client-java.txt
CHANGED
@@ -71,13 +71,13 @@ These can be build from <rhodes>/rhoconnect-client directory with next command
|
|
71
71
|
// Handle login event
|
72
72
|
}
|
73
73
|
|
74
|
-
Note: RhoConnect callbacks (like passed to RhoConnectClient.loginWithUserAsync
|
74
|
+
Note: RhoConnect callbacks (like passed to RhoConnectClient.loginWithUserAsync method in example above) may and most possibly will be called from another thread. It is up to application developer to care about synchronizing or forwarding call to an appropriate thread like GUI thread or Service thread.
|
75
75
|
|
76
76
|
## Object Model
|
77
77
|
|
78
78
|
### Intro
|
79
79
|
|
80
|
-
RhoConnect Client Android Java API resides at com.rhomobile.rhoconnect
|
80
|
+
RhoConnect Client Android Java API resides at com.rhomobile.rhoconnect package. It contains two main classes: RhoConnectClient and RhomModel. The package also contains two classes which represent results of call to the API. These are RhoConnectNotify and RhoConnectObjectNotify.
|
81
81
|
Also several utility classes from com.rhomobile.rhodes package can be used. These are RhoConf, RhoLogConf, Logger.
|
82
82
|
|
83
83
|
### RhoConnectClient
|
@@ -85,7 +85,7 @@ Also several utility classes from com.rhomobile.rhodes package can be used. Thes
|
|
85
85
|
:::cplusplus
|
86
86
|
package com.rhomobile.rhoconnect;
|
87
87
|
public class RhoConnectClient{
|
88
|
-
/// Call this method before create and use the client. It sets up directory structure and makes
|
88
|
+
/// Call this method before create and use the client. It sets up directory structure and makes necessary native library initialization.
|
89
89
|
public static native void nativeInit();
|
90
90
|
/// Creates instance of RhoConnectClient singlethon (yes, it's only one instance of RhoConnectClient allowed).
|
91
91
|
public RhoConnectClient();
|
data/doc/client-objc.txt
CHANGED
@@ -562,7 +562,7 @@ Instance method. Returns a RhoConnectNotify object after running a sync on all t
|
|
562
562
|
|
563
563
|
### <a id="is_syncing">is_syncing
|
564
564
|
|
565
|
-
Instance method. Returns TRUE if
|
565
|
+
Instance method. Returns TRUE if synchronization is in progress
|
566
566
|
|
567
567
|
:::cplusplus
|
568
568
|
- (BOOL) is_syncing;
|
data/doc/client.txt
CHANGED
@@ -63,7 +63,7 @@ Rhoconnect Client is a library to add sync data capability to your applications.
|
|
63
63
|
- (RhoConnectNotify*) loginWithUser: (NSString*) user pwd:(NSString*) pwd;
|
64
64
|
|
65
65
|
//login to rhoconnect server and keep login session in database and call selector when finish
|
66
|
-
// target is
|
66
|
+
// target is object where to call selector, selector calls in thread which make login call
|
67
67
|
- (void) loginWithUser: (NSString*) user pwd:(NSString*) pwd callback:(SEL) callback target:(id)target;
|
68
68
|
|
69
69
|
//set sync notification callback
|
@@ -232,7 +232,7 @@ To create schema model tables edit database schema file:
|
|
232
232
|
|
233
233
|
* Copy file <rhoconnect-client>/shared/db/res/db/syncdb.schema to your project folder
|
234
234
|
|
235
|
-
* Edit file syncdb.schema : add create table
|
235
|
+
* Edit file syncdb.schema : add create table statement for each schema model. Note that mandatory object column should be in each table:
|
236
236
|
|
237
237
|
"object" varchar(255) PRIMARY KEY
|
238
238
|
|
@@ -464,13 +464,13 @@ These can be build from <rhodes>/rhoconnect-client directory with next command
|
|
464
464
|
// Handle login event
|
465
465
|
}
|
466
466
|
|
467
|
-
Note: RhoConnect callbacks (like passed to RhoConnectClient.loginWithUserAsync
|
467
|
+
Note: RhoConnect callbacks (like passed to RhoConnectClient.loginWithUserAsync method in example above) may and most possibly will be called from another thread. It is up to application developer to care about synchronizing or forwarding call to an appropriate thread like GUI thread or Service thread.
|
468
468
|
|
469
469
|
### Object Model
|
470
470
|
|
471
471
|
#### Intro
|
472
472
|
|
473
|
-
RhoConnect Client Android Java API resides at com.rhomobile.rhoconnect
|
473
|
+
RhoConnect Client Android Java API resides at com.rhomobile.rhoconnect package. It contains two main classes: RhoConnectClient and RhomModel. The package also contains two classes which represent results of call to the API. These are RhoConnectNotify and RhoConnectObjectNotify.
|
474
474
|
Also several utility classes from com.rhomobile.rhodes package can be used. These are RhoConf, RhoLogConf, Logger.
|
475
475
|
|
476
476
|
#### RhoConnectClient
|
@@ -478,7 +478,7 @@ Also several utility classes from com.rhomobile.rhodes package can be used. Thes
|
|
478
478
|
:::cplusplus
|
479
479
|
package com.rhomobile.rhoconnect;
|
480
480
|
public class RhoConnectClient{
|
481
|
-
/// Call this method before create and use the client. It sets up directory structure and makes
|
481
|
+
/// Call this method before create and use the client. It sets up directory structure and makes necessary native library initialization.
|
482
482
|
public static native void nativeInit();
|
483
483
|
/// Creates instance of RhoConnectClient singlethon (yes, it's only one instance of RhoConnectClient allowed).
|
484
484
|
public RhoConnectClient();
|
data/doc/command-line.txt
CHANGED
@@ -57,39 +57,72 @@ After generating the application, you might be asked to change directories to yo
|
|
57
57
|
$ cd storeserver
|
58
58
|
$ bundle install
|
59
59
|
|
60
|
-
##
|
61
|
-
<span class="label label-important">As of version 4.0 of rhoconnect rake tasks will be deprecated!!</span>
|
60
|
+
## Rhoconnect Command Line Interface
|
62
61
|
|
63
|
-
|
62
|
+
In rhoconnect versions 3.2 and higher, a ruby utility called [thor](https://github.com/wycats/thor) routes all rake-like tasks through a custom command-line interface. All tasks are used via the rhoconnect gem's command line interface.
|
64
63
|
|
65
|
-
To
|
64
|
+
To issue commands this way, type `rhoconnect` followed by the task you wish to perform. To see a list of all the tasks you can issue with
|
65
|
+
rhoconnect, type `rhoconnect` or `rhoconnect help`.
|
66
|
+
|
67
|
+
:::term
|
68
|
+
$ rhoconnect help
|
69
|
+
Tasks:
|
70
|
+
rhoconnect app NAME # Generates a new rhoconnect application.
|
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
|
76
|
+
rhoconnect dtach-about # About dtach
|
77
|
+
rhoconnect dtach-install # Install dtach 0.8 from source
|
78
|
+
rhoconnect flushdb # Flush data store - WARNING: THIS REMOVES ALL DATA IN RHOCONNECT
|
79
|
+
rhoconnect get-token # Fetches current api token from rhoconnect
|
80
|
+
rhoconnect help [TASK] # Describe available tasks or one specific task
|
81
|
+
rhoconnect redis-about # About redis
|
82
|
+
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`
|
91
|
+
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
|
96
|
+
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
|
66
99
|
|
67
100
|
### Installing DTach (Mac OS / Linux only)
|
68
101
|
|
69
|
-
If you're using MacOS / Linux, install [dtach](http://dtach.sourceforge.net/) on your path before running any of the
|
102
|
+
If you're using MacOS / Linux, install [dtach](http://dtach.sourceforge.net/) on your path before running any of the rhoconnect tasks. [DTach](http://dtach.sourceforge.net/) is a simple utility which runs processes in a detached state so you can re-attach your console later.
|
70
103
|
|
71
104
|
:::term
|
72
105
|
$ cd storeserver
|
73
|
-
$
|
106
|
+
$ rhoconnect dtach-install
|
74
107
|
|
75
108
|
### Setup Redis
|
76
109
|
|
77
110
|
Next, you will need to setup and start a [redis](http://redis.io/) server:
|
78
111
|
|
79
112
|
:::term
|
80
|
-
$
|
81
|
-
$
|
113
|
+
$ rhoconnect redis-install
|
114
|
+
$ rhoconnect redis-start
|
82
115
|
|
83
116
|
The server will show that it is running on the console.
|
84
117
|
|
85
118
|
### Start the Application
|
86
119
|
|
87
|
-
Open a new console window (since the redis server is running in the previous console window). Then change directories to your rhoconnect
|
120
|
+
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.
|
88
121
|
|
89
122
|
:::term
|
90
123
|
$ cd storeserver
|
91
|
-
$
|
92
|
-
|
124
|
+
$ rhoconnect start
|
125
|
+
|
93
126
|
If everything went well, you should see the following in your console:
|
94
127
|
|
95
128
|
[05:47:10 PM 2011-04-19] Rhoconnect Server v3.0.0 started...
|
@@ -97,7 +130,7 @@ If everything went well, you should see the following in your console:
|
|
97
130
|
To open the web console, navigate to [http://localhost:9292/](http://localhost:9292) in your browser or run:
|
98
131
|
|
99
132
|
:::term
|
100
|
-
$
|
133
|
+
$ rhoconnect web
|
101
134
|
|
102
135
|
### Creating executable WAR containers (JRuby environment only)
|
103
136
|
|
@@ -106,49 +139,63 @@ Java App Servers (for example, JBoss). To create the executable WAR container, e
|
|
106
139
|
|
107
140
|
:::term
|
108
141
|
$ cd storeserver
|
109
|
-
$
|
142
|
+
$ rhoconnect war
|
110
143
|
|
111
144
|
This will build the WAR file named <your_app>.war that can be deployed into the Java App Server.
|
112
145
|
|
113
|
-
|
114
146
|
### Common Tasks
|
115
147
|
|
116
|
-
RhoConnect applications come with many useful
|
148
|
+
RhoConnect applications come with many useful rhoconnect tasks for administrative and development workflows. Some common ones are:
|
117
149
|
|
118
|
-
* `
|
150
|
+
* `rhoconnect dtach-install` - (Mac OS / Linux only) This will install [dtach](http://dtach.sourceforge.net/) to /usr/local/bin.
|
119
151
|
|
120
|
-
* `
|
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.
|
121
153
|
If you cannot install redis on Linux due to insufficient user permissions, then follows these [instructions](/rhoconnect/install).
|
122
154
|
|
123
|
-
* `
|
155
|
+
* `rhoconnect set-admin-password` - Set the RhoConnect administrator password. The default password is blank ''.
|
124
156
|
|
125
|
-
* `
|
157
|
+
* `rhoconnect get-token` - Get a RhoConnect API token to use for calling the RhoConnect REST API.
|
126
158
|
|
127
|
-
**NOTE: On Mac OS / Linux, you need to install dtach (i.e. by running `
|
159
|
+
**NOTE: On Mac OS / Linux, you need to install dtach (i.e. by running `rhoconnect dtach-install`) to run the following tasks: **
|
128
160
|
|
129
|
-
* `
|
161
|
+
* `rhoconnect redis-start` - This will launch a redis server in a new console.
|
130
162
|
|
131
|
-
* `
|
163
|
+
* `rhoconnect redis-stop` - Stop the currently-running redis server.
|
132
164
|
|
133
|
-
* `
|
165
|
+
* `rhoconnect redis:attach` - (Mac OS / Linux only) Attach to a currently-running redis server.
|
134
166
|
|
135
|
-
* `
|
167
|
+
* `rhoconnect start` - Start the RhoConnect application in a new console. This requires a running redis server.
|
136
168
|
|
137
|
-
* `
|
169
|
+
* `rhoconnect stop` - Stop the currently-running RhoConnect application.
|
138
170
|
|
139
|
-
* `
|
171
|
+
* `rhoconnect attach` - (Mac OS / Linux only) Attach to a currently-running RhoConnect application.
|
140
172
|
|
141
|
-
* `
|
173
|
+
* `rhoconnect clean-start` - Useful for development, resets and bootstraps the RhoConnect application with a test user.
|
142
174
|
|
143
175
|
Some other useful development tasks:
|
144
176
|
|
145
|
-
* `
|
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!
|
146
178
|
|
147
|
-
* `
|
179
|
+
* `rhoconnect spec` - Run all source adapter specs in spec/sources/.
|
148
180
|
|
149
|
-
* `
|
181
|
+
* `rhoconnect web` - Open the RhoConnect web console in a browser.
|
182
|
+
|
183
|
+
## Generate Source
|
184
|
+
|
185
|
+
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
|
+
|
196
|
+
To run a RhoConnect rake task, simply type `rake the-task-to-run` in your RhoConnect application's root directory.
|
150
197
|
|
151
|
-
Here is a complete list of the rake tasks available in a RhoConnect application:
|
198
|
+
Here is a complete list of the rake tasks available in a RhoConnect v.3.1 and lower application:
|
152
199
|
|
153
200
|
:::term
|
154
201
|
$ cd storeserver
|
@@ -159,7 +206,7 @@ Here is a complete list of the rake tasks available in a RhoConnect application:
|
|
159
206
|
rake redis:about # About redis
|
160
207
|
rake redis:attach # Attach to redis dtach socket
|
161
208
|
rake redis:download # Download package
|
162
|
-
rake redis:install # Install the latest
|
209
|
+
rake redis:install # Install the latest version of Redis from Github (requires git, duh)
|
163
210
|
rake redis:restart # Restart redis
|
164
211
|
rake redis:start # Start redis
|
165
212
|
rake redis:stop # Stop redis
|
@@ -182,96 +229,7 @@ Here is a complete list of the rake tasks available in a RhoConnect application:
|
|
182
229
|
rake rhoconnect:war # Build executable WAR file to be used in Java App Servers
|
183
230
|
rake rhoconnect:web # Launch the web console in a browser - uses :syncserver: in settings.yml
|
184
231
|
|
185
|
-
|
186
|
-
In rhoconnect versions 3.2 and higher the rake utility has been replaced using a ruby utility called [thor](https://github.com/wycats/thor).
|
187
|
-
Using this utility we are able to route all rake-like tasks through a custom command-line interface. All tasks now are used via the
|
188
|
-
rhoconnect gem's cli. In doing this we have also combined the app and source generators into the same command making it unnecessary to switch
|
189
|
-
from rhoconnect to rake at any point, simply use `rhoconnect` throughout.
|
190
|
-
|
191
|
-
To issue commands this way simply type rhoconnect followed by the task you wish to perform. To see a list of all the tasks you can issue with
|
192
|
-
rhoconnect, simply type `rhoconnect` or `rhoconnect help`.
|
193
|
-
|
194
|
-
:::term
|
195
|
-
$ rhoconnect help
|
196
|
-
Tasks:
|
197
|
-
rhoconnect app NAME # Generates a new rhoconnect application.
|
198
|
-
rhoconnect attach # Attach to rhoconnect console
|
199
|
-
rhoconnect clean-start # Clean rhoconnect, get token, and create new user
|
200
|
-
rhoconnect create-user # Creates and subscribes user for application in rhoconnect
|
201
|
-
rhoconnect delete-device # Deletes a device from rhoconnect
|
202
|
-
rhoconnect delete-user # Deletes a user from rhoconnect
|
203
|
-
rhoconnect dtach-about # About dtach
|
204
|
-
rhoconnect dtach-install # Install dtach 0.8 from source
|
205
|
-
rhoconnect flushdb # Flush data store - WARNING: THIS REMOVES ALL DATA IN RHOCONNECT
|
206
|
-
rhoconnect get-token # Fetches current api token from rhoconnect
|
207
|
-
rhoconnect help [TASK] # Describe available tasks or one specific task
|
208
|
-
rhoconnect redis-about # About redis
|
209
|
-
rhoconnect redis-attach # Attach to redis dtach socket
|
210
|
-
rhoconnect redis-download # Download redis package
|
211
|
-
rhoconnect redis-install # Install the latest verison of Redis from Github (requires git, duh)
|
212
|
-
rhoconnect redis-restart # Restart redis
|
213
|
-
rhoconnect redis-start # Start redis
|
214
|
-
rhoconnect redis-stop # Stop redis
|
215
|
-
rhoconnect reset # Reset the rhoconnect database (you will need to run rhoconnect:get_token afterwards)
|
216
|
-
rhoconnect reset-refresh # Reset source refresh time
|
217
|
-
rhoconnect restart # Alias for `rhoconnect stop; rhoconnect start`
|
218
|
-
rhoconnect secret # Generate a cryptographically secure secret session key
|
219
|
-
rhoconnect set-admin-password # Sets the admin password
|
220
|
-
rhoconnect source NAME # Generates a new source adapter.
|
221
|
-
rhoconnect spec # Run source adapter specs
|
222
|
-
rhoconnect start # Start rhoconnect server
|
223
|
-
rhoconnect stop # Stop rhoconnect server
|
224
|
-
rhoconnect war # Build executable WAR file to be used in Java App Servers
|
225
|
-
rhoconnect web # Launch the web console in a browser - uses :syncserver: in settings.yml
|
226
|
-
|
227
|
-
### Installing DTach (Mac OS / Linux only)
|
228
|
-
|
229
|
-
If you're using MacOS / Linux, install [dtach](http://dtach.sourceforge.net/) on your path before running any of the rake tasks. [DTach](http://dtach.sourceforge.net/) is a simple utility which runs processes in a detached state so you can re-attach your console later.
|
230
|
-
|
231
|
-
:::term
|
232
|
-
$ cd storeserver
|
233
|
-
$ rhoconnect dtach-install
|
234
|
-
|
235
|
-
### Setup Redis
|
236
|
-
|
237
|
-
Next, you will need to setup and start a [redis](http://redis.io/) server:
|
238
|
-
|
239
|
-
:::term
|
240
|
-
$ rhoconnect redis-install
|
241
|
-
$ rhoconnect redis-start
|
242
|
-
|
243
|
-
The server will show that it is running on the console.
|
244
|
-
|
245
|
-
### Start the Application
|
246
|
-
|
247
|
-
Open a new console window (since the redis server is running in the previous console window). Then change directories to your rhoconnect applciation and start the application.
|
248
|
-
|
249
|
-
:::term
|
250
|
-
$ cd storeserver
|
251
|
-
$ rhoconnect start
|
252
|
-
|
253
|
-
If everything went well, you should see the following in your console:
|
254
|
-
|
255
|
-
[05:47:10 PM 2011-04-19] Rhoconnect Server v3.0.0 started...
|
256
|
-
|
257
|
-
To open the web console, navigate to [http://localhost:9292/](http://localhost:9292) in your browser or run:
|
258
|
-
|
259
|
-
:::term
|
260
|
-
$ rhoconnect web
|
261
|
-
|
262
|
-
### Creating executable WAR containers (JRuby environment only)
|
263
|
-
|
264
|
-
It is possible to create Java WAR containers for your Rhoconnect application that can be deployed into the
|
265
|
-
Java App Servers (for example, JBoss). To create the executable WAR container, execute the following command in your app's root directory:
|
266
|
-
|
267
|
-
:::term
|
268
|
-
$ cd storeserver
|
269
|
-
$ rhoconnect war
|
270
|
-
|
271
|
-
This will build the WAR file named <your_app>.war that can be deployed into the Java App Server.
|
272
|
-
|
273
|
-
|
274
|
-
Below is provided a list of rake tasks and their corresponding rhoconnect command.
|
232
|
+
Below is provided a list of rake tasks and their corresponding RhoConnect v.3.2+ command.
|
275
233
|
|
276
234
|
<table border="1", cellpadding="5", width="100%">
|
277
235
|
<tr>
|
@@ -383,16 +341,3 @@ Below is provided a list of rake tasks and their corresponding rhoconnect comman
|
|
383
341
|
<td>rhoconnect redis-stop</td>
|
384
342
|
</tr>
|
385
343
|
</table>
|
386
|
-
|
387
|
-
## Generate Source
|
388
|
-
|
389
|
-
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:
|
390
|
-
|
391
|
-
* [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.
|
392
|
-
|
393
|
-
* [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.
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
data/doc/deploying.txt
CHANGED
@@ -102,19 +102,19 @@ And verify that it's up and running by visiting application web console in your
|
|
102
102
|
### Configuration of web and application servers
|
103
103
|
Installer compiled and configured Nginx as reverse proxy web server (/opt/nginx) with the following settings:
|
104
104
|
|
105
|
-
* Nginx start-up script (
|
105
|
+
* Nginx start-up script (`/etc/init.d/nginx`)
|
106
106
|
|
107
|
-
* Nginx logrotate settings (
|
107
|
+
* Nginx logrotate settings (`/etc/logrotate.d/nginx`)
|
108
108
|
|
109
|
-
* Nginx configuration file (
|
109
|
+
* Nginx configuration file (`/opt/nginx/conf/nginx.conf`)
|
110
110
|
|
111
|
-
* virtual host template for rhoconnect application (
|
111
|
+
* virtual host template for rhoconnect application (`/opt/nginx/conf/conf.d/rhoconnect.conf`)
|
112
112
|
|
113
113
|
Installer also configured Thin app server with the following configuration files:
|
114
114
|
|
115
|
-
* Thin start-up script (
|
115
|
+
* Thin start-up script (`/etc/init.d/thin`)
|
116
116
|
|
117
|
-
* Thin configuration file (
|
117
|
+
* Thin configuration file (`/etc/thin/rhoapp.yml`)
|
118
118
|
|
119
119
|
Default setup of Nginx server is to deal with back-end servers (called "upstreams") that are running on UNIX domain sockets:
|
120
120
|
|
@@ -125,13 +125,15 @@ Default setup of Nginx server is to deal with back-end servers (called "upstream
|
|
125
125
|
least_conn;
|
126
126
|
server unix:/tmp/thin.0.sock;
|
127
127
|
server unix:/tmp/thin.1.sock;
|
128
|
+
# Add additional copies if need more Thin servers
|
128
129
|
#server unix:/tmp/thin.2.sock;
|
129
130
|
#server unix:/tmp/thin.3.sock;
|
130
131
|
}
|
131
132
|
|
132
133
|
server {
|
133
134
|
listen 80;
|
134
|
-
|
135
|
+
# Be sure to point to 'public' folder of your application!
|
136
|
+
root /opt/nginx/html/rhoapp/public;
|
135
137
|
# ...
|
136
138
|
|
137
139
|
}
|
@@ -180,7 +182,7 @@ c) Make sure that your app is bundled properly
|
|
180
182
|
|
181
183
|
:::term
|
182
184
|
$ cd your_rhoconnect_app
|
183
|
-
$ sudo /opt/
|
185
|
+
$ sudo /opt/rhoconnect/bin/bundle install
|
184
186
|
|
185
187
|
d) Configure Nginx virtual host for your rhoconnect application. For that edit the file
|
186
188
|
`/opt/nginx/conf/conf.d/rhoconnect.conf`, so that it reflects your specifications (root directive)
|
@@ -189,8 +191,9 @@ d) Configure Nginx virtual host for your rhoconnect application. For that edit t
|
|
189
191
|
# ...
|
190
192
|
server {
|
191
193
|
listen 80;
|
192
|
-
|
193
|
-
|
194
|
+
# Be sure your app have 'public' folder and root directive
|
195
|
+
# point to it!
|
196
|
+
root /opt/nginx/html/your_rhoconnect_app/public;
|
194
197
|
# ...
|
195
198
|
}
|
196
199
|
|
@@ -207,18 +210,122 @@ e) Edit Thin `/etc/thin/rhoapp.yml` configuration file directly
|
|
207
210
|
$ env PATH=/opt/rhoconnect/bin:$PATH thin config -C /etc/thin/your_rhoconnect_app.yml \
|
208
211
|
-c /opt/nginx/html/your_rhoconnect_app/ \
|
209
212
|
--socket /tmp/thin.sock --servers 2 --log /var/log/thin/thin.log \
|
213
|
+
--user nginx --group nginx \
|
210
214
|
--pid /var/run/thin/thin.pid -e production
|
211
215
|
|
212
216
|
f) As root user restart Nginx, and Thin servers
|
213
217
|
|
214
218
|
:::term
|
215
|
-
|
216
|
-
|
219
|
+
/etc/init.d/nginx restart
|
220
|
+
/etc/init.d/thin restart
|
217
221
|
|
218
222
|
For monitoring and troubleshooting purposes visit web console of your app and look at log files in `/opt/nginx/logs`.
|
219
223
|
|
220
224
|
Also you can use RhoConnect `/opt/nginx/html/rhoapp` application as a template and modify it as you wanted.
|
221
225
|
|
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,
|
227
|
+
or install required gems as `sudo /opt/rhoconnect/bin/gem install gem_name`**
|
228
|
+
|
229
|
+
## Deploying RhoConnect Redis and Push packages on Linux servers
|
230
|
+
|
231
|
+
### RhoConnect Redis
|
232
|
+
|
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.
|
235
|
+
|
236
|
+
The package compiles from sources latest stable Redis release (2.4.15) and installs it to `/opt/rhoconnect` directory with the following settings:
|
237
|
+
|
238
|
+
* Redis server configuration file (`/opt/rhoconnect/etc/redis.conf`)
|
239
|
+
|
240
|
+
* log files located in `/var/log/redis` directory
|
241
|
+
|
242
|
+
* start-up scripts in `/etc/init` and `/etc/init.d` directories
|
243
|
+
|
244
|
+
#### Steps for Debian-Based Linux Users
|
245
|
+
Add the following line to the end of your /etc/apt/sources.list.
|
246
|
+
|
247
|
+
:::term
|
248
|
+
deb http://rhoconnect-repo.s3.amazonaws.com/packages/deb rhoconnect-repo main
|
249
|
+
|
250
|
+
Then update the repo list and install RhoConnect Redis.
|
251
|
+
|
252
|
+
:::term
|
253
|
+
$ sudo apt-get update
|
254
|
+
$ sudo apt-get install rhoconnect-redis
|
255
|
+
|
256
|
+
When Redis server is successfully installed, start it using the following command.
|
257
|
+
|
258
|
+
:::term
|
259
|
+
$ sudo start rhoconnect-redis
|
260
|
+
|
261
|
+
#### Steps for RedHat-Based Linux Users
|
262
|
+
|
263
|
+
Create a file named rhoconnect-repo.repo in the /etc/yum.repos.d/ directory.
|
264
|
+
|
265
|
+
:::term
|
266
|
+
$ sudo nano /etc/yum.repos.d/rhoconnect-repo.repo
|
267
|
+
|
268
|
+
Copy and paste these contents into the file.
|
269
|
+
|
270
|
+
:::term
|
271
|
+
[rhoconnect-redis]
|
272
|
+
name=Rhoconnect Redis
|
273
|
+
baseurl=http://rhoconnect-repo.s3.amazonaws.com/packages/rpm
|
274
|
+
enabled=1
|
275
|
+
gpgcheck=0
|
276
|
+
|
277
|
+
Once that is done, install the RhoConnect Push service.
|
278
|
+
|
279
|
+
:::term
|
280
|
+
$ sudo yum install rhoconnect-redis
|
281
|
+
|
282
|
+
You can start a redis server using the following command.
|
283
|
+
|
284
|
+
:::term
|
285
|
+
$ sudo /etc/init.d/redis start
|
286
|
+
|
287
|
+
### RhoConnect Push Service
|
288
|
+
You can create a RhoConnect Push production environment on Linux servers by installing prepackaged software for Ubuntu (12.x) and CentOS (6.x). In a few clicks, you will have installed on your Linux server.
|
289
|
+
|
290
|
+
* Node.js with Npm package manager
|
291
|
+
|
292
|
+
* RhoConnect Push service
|
293
|
+
|
294
|
+
* Upstart script to start, stop, and control Push service
|
295
|
+
|
296
|
+
#### Steps for Debian-Based Linux Users
|
297
|
+
Add the following line to the end of your /etc/apt/sources.list.
|
298
|
+
|
299
|
+
:::term
|
300
|
+
deb http://rhoconnect-repo.s3.amazonaws.com/packages/deb rhoconnect-repo main
|
301
|
+
|
302
|
+
Then update the repo list and install RhoConnect Push.
|
303
|
+
|
304
|
+
:::term
|
305
|
+
$ sudo apt-get update
|
306
|
+
$ sudo apt-get install rhoconnect-push
|
307
|
+
|
308
|
+
#### Steps for RedHat-Based Linux Users
|
309
|
+
Create a file named rhoconnect-repo.repo in the /etc/yum.repos.d/ directory.
|
310
|
+
|
311
|
+
:::term
|
312
|
+
$ sudo nano /etc/yum.repos.d/rhoconnect-repo.repo
|
313
|
+
|
314
|
+
Copy and paste the following contents into the file.
|
315
|
+
|
316
|
+
:::term
|
317
|
+
[rhoconnect-push]
|
318
|
+
name=Rhoconnect Push Service
|
319
|
+
baseurl=http://rhoconnect-repo.s3.amazonaws.com/packages/rpm
|
320
|
+
enabled=1
|
321
|
+
gpgcheck=0
|
322
|
+
|
323
|
+
Once that is done, install the RhoConnect Push service.
|
324
|
+
|
325
|
+
:::term
|
326
|
+
$ sudo yum install rhoconnect-push
|
327
|
+
|
328
|
+
|
222
329
|
## Deploying into J2EE environment
|
223
330
|
In JRuby environment, there is an option to create the WAR container for the RhoConnect app
|
224
331
|
and deploy it into the J2EE App Server.
|