rhoconnect 3.2.1 → 3.3.1.beta2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +24 -5
- data/Gemfile +2 -2
- data/Gemfile.lock +20 -20
- data/bench/benchapp/Gemfile +17 -20
- data/bench/benchapp/config.ru +2 -2
- data/bench/benchapp/settings/settings.yml +3 -3
- data/bench/blobapp/Gemfile +16 -13
- data/bench/blobapp/config.ru +2 -2
- data/bench/blobapp/settings/settings.yml +5 -3
- data/bench/lib/bench.rb +35 -32
- data/bench/lib/bench/session.rb +9 -1
- data/bench/scripts/blob_cud_script.rb +13 -17
- data/bench/scripts/cud_script.rb +11 -12
- data/bench/scripts/helpers.rb +5 -7
- data/bench/scripts/query_md_script.rb +18 -12
- data/bench/scripts/query_only_script.rb +19 -11
- data/bench/scripts/query_script.rb +17 -13
- data/bench/scripts/test_query_script.rb +46 -17
- data/bench/scripts/test_source_script.rb +7 -7
- data/commands/commands/dtach_commands/dtach_install.rb +44 -16
- data/commands/commands/rhoconnect/spec.rb +13 -9
- data/commands/commands/rhoconnect/version.rb +6 -0
- data/commands/execute.rb +10 -6
- data/doc/deploying.txt +75 -13
- data/doc/install.txt +3 -3
- data/doc/push-client-setup.txt +1 -1
- data/doc/rest-api.txt +4 -23
- data/doc/rhoconnect-redis-stack.txt +26 -7
- data/doc/settings.txt +9 -3
- data/examples/simple/Gemfile +3 -1
- data/examples/simple/application.rb +5 -0
- data/examples/simple/config.ru +3 -2
- data/examples/simple/my_server.rb +14 -0
- data/examples/simple/settings/settings.yml +1 -0
- data/generators/templates/application/Gemfile +4 -4
- data/generators/templates/application/application.rb +4 -0
- data/generators/templates/application/settings/settings.yml +4 -1
- data/installer/unix-like/create_texts.rb +39 -1
- data/installer/unix-like/rho_connect_install_constants.rb +1 -1
- data/installer/utils/package_upload/repos.rake +7 -5
- data/lib/rhoconnect.rb +3 -2
- data/lib/rhoconnect/api/app/ans_login.rb +3 -0
- data/lib/rhoconnect/api/app/bulk_data.rb +6 -0
- data/lib/rhoconnect/api/{source → app}/fast_delete.rb +1 -1
- data/lib/rhoconnect/api/{source → app}/fast_insert.rb +2 -2
- data/lib/rhoconnect/api/{source → app}/fast_update.rb +2 -2
- data/lib/rhoconnect/api/app/login.rb +5 -0
- data/lib/rhoconnect/api/{source → app}/push_deletes.rb +1 -1
- data/lib/rhoconnect/api/{source → app}/push_objects.rb +1 -1
- data/lib/rhoconnect/api/app/query.rb +4 -0
- data/lib/rhoconnect/api/app/queue_updates.rb +94 -0
- data/lib/rhoconnect/api/app/search.rb +4 -0
- data/lib/rhoconnect/api/client/client_get_db_doc.rb +5 -0
- data/lib/rhoconnect/api/client/client_set_db_doc.rb +8 -0
- data/lib/rhoconnect/api/client/create.rb +7 -0
- data/lib/rhoconnect/api/client/get_client_params.rb +2 -1
- data/lib/rhoconnect/api/client/list_client_docs.rb +2 -1
- data/lib/rhoconnect/api/client/register.rb +12 -0
- data/lib/rhoconnect/api/client/reset.rb +5 -0
- data/lib/rhoconnect/api/{source → readstate}/set_refresh_time.rb +2 -1
- data/lib/rhoconnect/api/source/get_source_params.rb +3 -2
- data/lib/rhoconnect/api/source/list_sources.rb +2 -1
- data/lib/rhoconnect/api/source/update_source_params.rb +3 -3
- data/lib/rhoconnect/api/store/get_db_doc.rb +4 -0
- data/lib/rhoconnect/api/store/set_db_doc.rb +7 -0
- data/lib/rhoconnect/api/system/get_adapter.rb +4 -0
- data/lib/rhoconnect/api/{admin → system}/get_license_info.rb +2 -1
- data/lib/rhoconnect/api/system/login.rb +15 -0
- data/lib/rhoconnect/api/{admin → system}/reset.rb +3 -2
- data/lib/rhoconnect/api/system/save_adapter.rb +4 -0
- data/lib/rhoconnect/api/{admin → system}/stats.rb +2 -1
- data/lib/rhoconnect/api/user/create_user.rb +2 -2
- data/lib/rhoconnect/api/user/delete_client.rb +6 -0
- data/lib/rhoconnect/api/user/delete_user.rb +2 -1
- data/lib/rhoconnect/api/user/list_clients.rb +4 -0
- data/lib/rhoconnect/api/user/list_source_docs.rb +11 -0
- data/lib/rhoconnect/api/user/list_users.rb +1 -1
- data/lib/rhoconnect/api/user/ping.rb +7 -0
- data/lib/rhoconnect/api/user/show_user.rb +3 -0
- data/lib/rhoconnect/api/user/update_user.rb +3 -2
- data/lib/rhoconnect/api/user/user_get_db_doc.rb +5 -0
- data/lib/rhoconnect/api/user/user_set_db_doc.rb +10 -0
- data/lib/rhoconnect/app.rb +12 -2
- data/lib/rhoconnect/async.rb +6 -10
- data/lib/rhoconnect/bulk_data/bulk_data.rb +4 -4
- data/lib/rhoconnect/client.rb +10 -9
- data/lib/rhoconnect/client_sync.rb +24 -19
- data/lib/rhoconnect/document.rb +18 -4
- data/lib/rhoconnect/graph_helper.rb +4 -2
- data/lib/rhoconnect/jobs/bulk_data_job.rb +1 -1
- data/lib/rhoconnect/jobs/ping_job.rb +39 -29
- data/lib/rhoconnect/middleware/admin_user.rb +23 -0
- data/lib/rhoconnect/middleware/body_content_type_parser.rb +35 -0
- data/lib/rhoconnect/{cors.rb → middleware/cors.rb} +1 -0
- data/lib/rhoconnect/middleware/current_app.rb +16 -0
- data/lib/rhoconnect/middleware/current_request.rb +16 -0
- data/lib/rhoconnect/middleware/current_user.rb +17 -0
- data/lib/rhoconnect/middleware/helpers.rb +105 -0
- data/lib/rhoconnect/middleware/login_required.rb +22 -0
- data/lib/rhoconnect/{stats/middleware.rb → middleware/stats.rb} +5 -3
- data/lib/rhoconnect/middleware/x_domain_session_wrapper.rb +58 -0
- data/lib/rhoconnect/ping.rb +1 -0
- data/lib/rhoconnect/ping/apple.rb +18 -16
- data/lib/rhoconnect/ping/blackberry.rb +9 -9
- data/lib/rhoconnect/ping/rhoconnect_push.rb +45 -0
- data/lib/rhoconnect/server.rb +98 -91
- data/lib/rhoconnect/source.rb +5 -1
- data/lib/rhoconnect/source_sync.rb +4 -3
- data/lib/rhoconnect/stats/record.rb +15 -15
- data/lib/rhoconnect/store.rb +253 -75
- data/lib/rhoconnect/tasks.rb +3 -3
- data/lib/rhoconnect/version.rb +1 -1
- data/lib/rhoconnect/web-console/controllers/admins.js +1 -14
- data/lib/rhoconnect/web-console/models/adapter.js +18 -8
- data/lib/rhoconnect/web-console/models/client.js +15 -9
- data/lib/rhoconnect/web-console/models/doc.js +7 -11
- data/lib/rhoconnect/web-console/models/session.js +5 -2
- data/lib/rhoconnect/web-console/models/source.js +55 -36
- data/lib/rhoconnect/web-console/models/user.js +20 -11
- data/lib/rhoconnect/web-console/public/backbone.js +8 -2
- data/lib/rhoconnect/web-console/templates/index.erb +11 -5
- data/lib/rhoconnect/web-console/views/doc.js +6 -8
- data/lib/rhoconnect/web-console/views/edit_user.js +6 -3
- data/lib/rhoconnect/web-console/views/home.js +98 -25
- data/lib/rhoconnect/web-console/views/index.js +1 -1
- data/lib/rhoconnect/web-console/views/new_ping.js +6 -3
- data/lib/rhoconnect/web-console/views/server_doc.js +12 -4
- data/lib/rhoconnect/web-console/views/show_device.js +6 -3
- data/rhoconnect.gemspec +1 -2
- data/spec/api/{source → app}/fast_delete_spec.rb +4 -4
- data/spec/api/{source → app}/fast_insert_spec.rb +4 -4
- data/spec/api/{source → app}/fast_update_spec.rb +22 -6
- data/spec/api/{source → app}/push_deletes_spec.rb +2 -2
- data/spec/api/app/push_objects_spec.rb +45 -0
- data/spec/api/client/client_get_db_doc_spec.rb +31 -0
- data/spec/api/client/client_set_db_doc_spec.rb +14 -0
- data/spec/api/client/get_client_params_spec.rb +3 -2
- data/spec/api/client/list_client_docs_spec.rb +2 -2
- data/spec/api/{source → readstate}/set_refresh_time_spec.rb +15 -9
- data/spec/api/source/get_source_params_spec.rb +3 -2
- data/spec/api/source/list_sources_spec.rb +3 -9
- data/spec/api/source/update_source_params_spec.rb +4 -4
- data/spec/api/store/get_db_doc_spec.rb +32 -0
- data/spec/api/store/set_db_doc_spec.rb +43 -0
- data/spec/api/system/adapter_spec.rb +33 -0
- data/spec/api/{admin → system}/get_license_info_spec.rb +2 -5
- data/spec/api/{admin/get_api_token_spec.rb → system/login_spec.rb} +4 -11
- data/spec/api/{admin → system}/reset_spec.rb +2 -2
- data/spec/api/{admin → system}/stats_spec.rb +19 -13
- data/spec/api/user/create_user_spec.rb +15 -8
- data/spec/api/{client → user}/delete_client_spec.rb +3 -4
- data/spec/api/user/delete_user_spec.rb +33 -4
- data/spec/api/user/list_clients_spec.rb +30 -0
- data/spec/api/user/list_source_docs_spec.rb +35 -0
- data/spec/api/user/list_users_spec.rb +5 -6
- data/spec/api/{client → user}/ping_spec.rb +4 -6
- data/spec/api/user/show_user_spec.rb +14 -0
- data/spec/api/user/update_user_spec.rb +28 -10
- data/spec/api/user/user_get_db_doc_spec.rb +16 -0
- data/spec/api/user/user_set_db_doc_spec.rb +41 -0
- data/spec/apps/rhotestapp/application.rb +4 -0
- data/spec/apps/rhotestapp/settings/settings.yml +3 -1
- data/spec/bulk_data/bulk_data_spec.rb +13 -0
- data/spec/client_sync_spec.rb +41 -59
- data/spec/document_spec.rb +23 -0
- data/spec/javascripts/doc_view_spec.js +1 -1
- data/spec/javascripts/home_view_spec.js +10 -5
- data/spec/javascripts/index_view_spec.js +1 -1
- data/spec/jobs/ping_job_spec.rb +26 -0
- data/spec/perf/store_perf_spec.rb +1 -1
- data/spec/ping/android_spec.rb +0 -7
- data/spec/ping/apple_spec.rb +7 -0
- data/spec/ping/blackberry_spec.rb +10 -0
- data/spec/ping/rhoconnect_push_spec.rb +58 -0
- data/spec/server/cors_spec.rb +1 -1
- data/spec/server/server_spec.rb +152 -104
- data/spec/{stats/middleware_spec.rb → server/stats_spec.rb} +4 -5
- data/spec/server/x_domain_session_wrapper_spec.rb +3 -3
- data/spec/source_spec.rb +2 -2
- data/spec/source_sync_spec.rb +2 -0
- data/spec/spec_helper.rb +17 -3
- data/spec/stats/record_spec.rb +18 -19
- data/spec/store_spec.rb +51 -26
- data/spec/support/shared_examples.rb +4 -0
- data/spec/sync_states_spec.rb +2 -2
- metadata +104 -88
- data/bench/benchapp/Gemfile.lock +0 -87
- data/bench/blobapp/Gemfile.lock +0 -107
- data/bench/lib/testdata/5-data.txt +0 -8
- data/doc/release.txt +0 -41
- data/lib/rhoconnect/api/admin/get_api_token.rb +0 -14
- data/lib/rhoconnect/api/admin/login.rb +0 -6
- data/lib/rhoconnect/api/application/bulk_data.rb +0 -7
- data/lib/rhoconnect/api/application/clientcreate.rb +0 -8
- data/lib/rhoconnect/api/application/clientlogin.rb +0 -6
- data/lib/rhoconnect/api/application/clientregister.rb +0 -13
- data/lib/rhoconnect/api/application/clientreset.rb +0 -6
- data/lib/rhoconnect/api/application/query.rb +0 -7
- data/lib/rhoconnect/api/application/queue_updates.rb +0 -20
- data/lib/rhoconnect/api/application/search.rb +0 -6
- data/lib/rhoconnect/api/client/create_client.rb +0 -3
- data/lib/rhoconnect/api/client/delete_client.rb +0 -5
- data/lib/rhoconnect/api/client/list_clients.rb +0 -3
- data/lib/rhoconnect/api/client/ping.rb +0 -7
- data/lib/rhoconnect/api/source/get_adapter.rb +0 -3
- data/lib/rhoconnect/api/source/get_db_doc.rb +0 -7
- data/lib/rhoconnect/api/source/list_source_docs.rb +0 -10
- data/lib/rhoconnect/api/source/save_adapter.rb +0 -3
- data/lib/rhoconnect/api/source/set_db_doc.rb +0 -10
- data/lib/rhoconnect/api/source/upload_file.rb +0 -4
- data/lib/rhoconnect/body_content_type_parser.rb +0 -32
- data/lib/rhoconnect/x_domain_session_wrapper.rb +0 -53
- data/spec/api/admin/api_token_spec.rb +0 -13
- data/spec/api/client/create_client_spec.rb +0 -13
- data/spec/api/client/list_clients_spec.rb +0 -22
- data/spec/api/source/adapter_spec.rb +0 -29
- data/spec/api/source/get_db_doc_spec.rb +0 -21
- data/spec/api/source/list_source_docs_spec.rb +0 -25
- data/spec/api/source/push_objects_spec.rb +0 -27
- data/spec/api/source/set_db_doc_spec.rb +0 -32
- data/spec/api/source/upload_file_spec.rb +0 -26
@@ -4,12 +4,16 @@ Execute.define_task do
|
|
4
4
|
desc "spec", "Run source adapter specs"
|
5
5
|
def spec
|
6
6
|
files = File.join('spec','**','*_spec.rb')
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
7
|
+
pattern = FileList[files]
|
8
|
+
rspec_opts = "-fn -b --color"
|
9
|
+
|
10
|
+
cmd = "bundle exec rspec #{pattern} #{rspec_opts}"
|
11
|
+
puts cmd
|
12
|
+
exec cmd
|
13
|
+
# Another way run rspec examples
|
14
|
+
# RSpec::Core::Runner.run(pattern, $stderr, $stdout)
|
15
|
+
end
|
16
|
+
rescue Exception => e
|
17
|
+
puts "Run source adapter specs error: #{e.inspect}"
|
18
|
+
end
|
19
|
+
end
|
data/commands/execute.rb
CHANGED
@@ -25,10 +25,14 @@ class Execute < Thor
|
|
25
25
|
# Require all tasks defined in the tasks directories
|
26
26
|
TASK_DIRS.each do |dir|
|
27
27
|
Find.find("#{File.expand_path(File.dirname(__FILE__))}/#{dir}") do |path|
|
28
|
-
if !File.directory? path and
|
29
|
-
|
28
|
+
if !File.directory? path and File.extname(path) == '.rb'
|
29
|
+
if File.basename(path, '.rb') == 'spec'
|
30
|
+
rspec_avail = File.exists?(File.join(Dir.pwd,'Gemfile')) && Bundler.load.specs.find{|s| s.name == 'rspec' }
|
31
|
+
# Drop task 'spec' if gem 'rspec' is not in the current bundle.
|
32
|
+
next unless rspec_avail
|
33
|
+
end
|
30
34
|
require path
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/doc/deploying.txt
CHANGED
@@ -93,13 +93,13 @@ To test it you need to as a root user start redis, nginx, and thin servers:
|
|
93
93
|
:::term
|
94
94
|
$ sudo /etc/init.d/redis start
|
95
95
|
$ sudo /etc/init.d/nginx start
|
96
|
-
|
96
|
+
$ sudo /etc/init.d/thin start
|
97
97
|
|
98
98
|
And verify that it's up and running by visiting application web console in your browser:
|
99
99
|
|
100
100
|
http://servername
|
101
101
|
|
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
105
|
* Nginx start-up script (/etc/init.d/nginx)
|
@@ -157,6 +157,66 @@ Configuration file is generated by this command:
|
|
157
157
|
:::term
|
158
158
|
$ thin config -C /etc/thin/rhoapp.yml -c /opt/nginx/html/rhoapp/ --socket /tmp/thin.sock --servers 2 --log /opt/nginx/logs/thin.log --pid /var/run/thin.pid -e production
|
159
159
|
|
160
|
+
### Development and deployment of RhoConnect applications
|
161
|
+
|
162
|
+
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
|
163
|
+
to your bash scripts (i.e. `~/.profile` on Ubuntu; `~/.bash_profile` on CentOS) to automatically add them upon login.
|
164
|
+
|
165
|
+
:::text
|
166
|
+
export PATH=/opt/rhoconnect/bin:$PATH
|
167
|
+
|
168
|
+
To deploy and develop your rhoconnect app on nginx and thin servers
|
169
|
+
|
170
|
+
a) Copy your rhoconnect project (lets name it as `your_rhoconnect_app`) to default location to `/opt/nginx/html` directory
|
171
|
+
|
172
|
+
b) Set up for it `nginx` owner
|
173
|
+
|
174
|
+
:::term
|
175
|
+
$ cd /opt/nginx/html
|
176
|
+
$ sudo chown -R nginx:nginx your_rhoconnect_app/
|
177
|
+
|
178
|
+
c) Make sure that your app is bundled properly
|
179
|
+
|
180
|
+
:::term
|
181
|
+
$ cd your_rhoconnect_app
|
182
|
+
$ sudo /opt/rhconnect/bin/bundle install
|
183
|
+
|
184
|
+
d) Configure Nginx virtual host for your rhoconnect application. For that edit the file
|
185
|
+
`/opt/nginx/conf/conf.d/rhoconnect.conf`, so that it reflects your specifications (root directive)
|
186
|
+
|
187
|
+
:::text
|
188
|
+
# ...
|
189
|
+
server {
|
190
|
+
listen 80;
|
191
|
+
root /opt/nginx/html/your_rhoconnect_app/public; # Be sure your app have 'public' folder and root directive
|
192
|
+
# point to it!
|
193
|
+
# ...
|
194
|
+
}
|
195
|
+
|
196
|
+
e) Edit Thin `/etc/thin/rhoapp.yml` configuration file directly
|
197
|
+
|
198
|
+
:::yaml
|
199
|
+
---
|
200
|
+
chdir: /opt/nginx/html/your_rhoconnect_app
|
201
|
+
# ...
|
202
|
+
|
203
|
+
or as root user generate a new one
|
204
|
+
|
205
|
+
:::term
|
206
|
+
$ env PATH=/opt/rhoconnect/bin:$PATH thin config -C /etc/thin/your_rhoconnect_app.yml \
|
207
|
+
-c /opt/nginx/html/your_rhoconnect_app/ \
|
208
|
+
--socket /tmp/thin.sock --servers 2 --log /opt/nginx/logs/thin.log \
|
209
|
+
--pid /var/run/thin.pid -e production
|
210
|
+
|
211
|
+
f) As root user restart Nginx, and Thin servers
|
212
|
+
|
213
|
+
:::term
|
214
|
+
/etc/init.d/nginx restart
|
215
|
+
/etc/init.d/thin restart
|
216
|
+
|
217
|
+
For monitoring and troubleshooting purposes visit web console of your app and look at log files in `/opt/nginx/logs`.
|
218
|
+
|
219
|
+
Also you can use RhoConnect `/opt/nginx/html/rhoapp` application as a template and modify it as you wanted.
|
160
220
|
|
161
221
|
## Deploying into J2EE environment
|
162
222
|
In JRuby environment, there is an option to create the WAR container for the RhoConnect app
|
@@ -165,9 +225,11 @@ and deploy it into the J2EE App Server.
|
|
165
225
|
Deploying the WAR container varies per J2EE App Server, for JBoss it is necessary
|
166
226
|
to place the WAR file into the server's deploy directory.
|
167
227
|
|
228
|
+
## Deploying on Heroku Cedar
|
168
229
|
|
230
|
+
#### Prerequisites
|
169
231
|
|
170
|
-
|
232
|
+
* [Heroku account](https://api.heroku.com/login) and [Heroku Toolbelt](https://toolbelt.heroku.com/)
|
171
233
|
|
172
234
|
* Rhoconnect gem version >= 3.2.0
|
173
235
|
|
@@ -187,20 +249,20 @@ Create in your rhoconnect project file named `Procfile`:
|
|
187
249
|
|
188
250
|
If your application is using resque worker, then you should specify it in the `Procfile` as well:
|
189
251
|
|
190
|
-
|
191
|
-
|
252
|
+
:::term
|
253
|
+
web: bundle exec thin start -p $PORT
|
192
254
|
worker: bundle exec rake resque:work
|
193
255
|
|
194
|
-
Now you can run your app locally
|
256
|
+
Now you can run your app locally:
|
195
257
|
|
196
|
-
|
258
|
+
:::term
|
197
259
|
$ gem install foreman
|
198
260
|
$ foreman start
|
199
261
|
|
200
262
|
|
201
263
|
#### Deploy to Heroku
|
202
264
|
Before moving your code to Git you need comment in your project's `Gemfile` declaration of `sqlite3` gem, because target
|
203
|
-
Heroku server has no
|
265
|
+
Heroku server has no development libraries required to build that gem.
|
204
266
|
|
205
267
|
:::term
|
206
268
|
$ git init
|
@@ -209,21 +271,21 @@ Heroku server has no devel libraries required to build that gem.
|
|
209
271
|
$ heroku create --stack cedar
|
210
272
|
$ heroku addons:add redistogo:nano
|
211
273
|
$ git push heroku master
|
212
|
-
|
274
|
+
$ heroku open
|
213
275
|
|
214
276
|
#### Monitoring app on Heroku
|
215
277
|
Use `heroku ps` to determine the number of processes that are executing.
|
216
278
|
Use `heroku logs` to view an aggregated list of log messages from all process types.
|
217
279
|
|
218
280
|
:::term
|
219
|
-
|
220
|
-
|
281
|
+
$ heroku ps
|
282
|
+
$ heroku logs
|
221
283
|
|
222
284
|
#### Get connected with Rhodes client
|
223
|
-
If you have rhodes client and wanted to sync it with rhoconnect app on Heroku, then set proper
|
285
|
+
If you have a rhodes client and wanted to sync it with rhoconnect app on Heroku, then set proper `syncserver` URL in `rhoconfig.txt` file:
|
224
286
|
|
225
287
|
:::term
|
226
|
-
syncserver = 'http://<your-app-here>.herokuapp.com/application'
|
288
|
+
syncserver = 'http://<your-heroku-app-here>.herokuapp.com/application'
|
227
289
|
|
228
290
|
|
229
291
|
|
data/doc/install.txt
CHANGED
@@ -8,11 +8,11 @@ On Linux, you install the RhoConnect gem from the command line; you can also do
|
|
8
8
|
|
9
9
|
## Mac OS
|
10
10
|
|
11
|
-
If you're running Mac OS, download the latest [
|
11
|
+
If you're running Mac OS, download the latest [Motorola RhoMobile Suite Installer for Macintosh](http://rhomobile.com/rhostudio-mac). This contains [Redis](http://redis.io/), [RhoConnect](/rhoconnect/introduction) and [Rhodes](/rhodes/introduction).
|
12
12
|
|
13
13
|
Although Mac OS has [Ruby](http://www.ruby-lang.org/en/) installed, the official way to install Ruby for RhoStudio is to install [Ruby Version Manager](https://rvm.io//) and then install Ruby version 1.9.3.
|
14
14
|
|
15
|
-
Click on the
|
15
|
+
Click on the Motorola RhoMobile Suite Installer for Mac download file to open it. You will get a window similar to this:
|
16
16
|
|
17
17
|
<img src="http://rhodocs.s3.amazonaws.com/rhodes-devel/rhostudio-mac-install.png" alt="RhoStudioInstaller Mac" />
|
18
18
|
|
@@ -69,7 +69,7 @@ NOTE: If you get any `no such file to load -- something` messages while running
|
|
69
69
|
|
70
70
|
NOTE: Windows doesn't come with the necessary build tools to install gems ('make', for example). There are various ways to get these tools, but the GnuWin32 project at http://gnuwin32.sourceforge.net/ provides the tools, and can be conveniently installed via the GetGnuWin32 installer at http://sourceforge.net/projects/getgnuwin32/files/. You should follow the GetGnuWin32 instructions carefully.
|
71
71
|
|
72
|
-
|
72
|
+
**NOTE: Installing RhoStudio as a plugin for Eclipse is currently disabled.**
|
73
73
|
|
74
74
|
RhoSimulator, which comes with RhoStudio for Mac and Windows, does not work with Linux.
|
75
75
|
|
data/doc/push-client-setup.txt
CHANGED
@@ -52,7 +52,7 @@ To sync all the sources with do_sync, the source name list would specified as 'a
|
|
52
52
|
|
53
53
|
The sound file should be included in the Rhodes application bundle in the `/public/alerts` folder.
|
54
54
|
|
55
|
-
|
55
|
+
## Setting up the Rhodes Client for iPhone, Android, and Blackberry
|
56
56
|
|
57
57
|
To set up your Rhodes client for push, refer to these links for your respective platforms.
|
58
58
|
|
data/doc/rest-api.txt
CHANGED
@@ -36,7 +36,7 @@ All API calls will return http 200 and requested data (if applied). Otherwise, A
|
|
36
36
|
## API Methods
|
37
37
|
|
38
38
|
### `login`
|
39
|
-
|
39
|
+
Before you can use RhoConnect API you should login to the RhoConnect server and get API token:
|
40
40
|
|
41
41
|
:::ruby
|
42
42
|
require 'rest_client'
|
@@ -46,23 +46,8 @@ Login to the RhoConnect server.
|
|
46
46
|
login = "rhoadmin"
|
47
47
|
password = ""
|
48
48
|
|
49
|
-
|
49
|
+
token = RestClient.post("#{server}/login", { :login => login, :password => password }.to_json, :content_type => :json)
|
50
50
|
|
51
|
-
### `get_api_token`
|
52
|
-
Before you can use RhoConnect API you should get API token:
|
53
|
-
|
54
|
-
:::ruby
|
55
|
-
require 'rest_client'
|
56
|
-
require 'json'
|
57
|
-
|
58
|
-
server = "http://localhost:9292"
|
59
|
-
login = "rhoadmin"
|
60
|
-
password = ""
|
61
|
-
|
62
|
-
res = RestClient.post("#{server}/login", { :login => login, :password => password }.to_json, :content_type => :json)
|
63
|
-
rhoconnect_session_cookie = 'rhoconnect_session=' + res.cookies['rhoconnect_session']
|
64
|
-
token = RestClient.post("#{server}/api/get_api_token",'',{ 'Cookie' => rhoconnect_session_cookie })
|
65
|
-
|
66
51
|
### `get_license_info`
|
67
52
|
Returns license information of the currently used license
|
68
53
|
|
@@ -490,14 +475,11 @@ Return content of a given document (client or source).
|
|
490
475
|
"#{server}/api/get_db_doc",
|
491
476
|
{
|
492
477
|
:api_token => token,
|
493
|
-
:doc => doc
|
494
|
-
:data_type => data_type
|
478
|
+
:doc => doc
|
495
479
|
}.to_json,
|
496
480
|
:content_type => :json
|
497
481
|
).body
|
498
482
|
|
499
|
-
`:data_type` should be 'string' for the documents containing single string (size or token docs); otherwise this call will return hash of hashes.
|
500
|
-
|
501
483
|
### `set_db_doc`
|
502
484
|
Sets the content of the specified server document. Data should be either a string or hash of hashes. Data type should be set accordingly.
|
503
485
|
If `append` flag is set to `true` , the data is appended to the current doc (if it exists) instead of replacing it.
|
@@ -508,8 +490,7 @@ If `append` flag is set to `true` , the data is appended to the current doc (if
|
|
508
490
|
{
|
509
491
|
:api_token => token,
|
510
492
|
:doc => doc,
|
511
|
-
:data => data,
|
512
|
-
:data_type => data_type,
|
493
|
+
:data => data,
|
513
494
|
:append => false
|
514
495
|
}.to_json,
|
515
496
|
:content_type => :json
|
@@ -27,10 +27,11 @@ In the AWS Management Console, change the Region to US West (N. California).
|
|
27
27
|
|
28
28
|
<img src="http://rhodocs.s3.amazonaws.com/rhoconnect-redis-aws/cloudformation-tab-ncalif-crop.png" alt="Cloud Formation page N California region" />
|
29
29
|
|
30
|
-
We provide a public preconfigured
|
31
|
-
|
32
|
-
* `ami-cbc59e8e` (Us West N. California)
|
30
|
+
We provide a few public preconfigured images that contains a blank RhoConnect app for `Us West N. California` region:
|
33
31
|
|
32
|
+
* `ami-cbc59e8e` (RhoConnect-3.1.2 with Nginx and phusion passenger)
|
33
|
+
* `ami-0dfca748` (RhoConnect-3.2.0 with Nginx and cluster of thin servers)
|
34
|
+
|
34
35
|
### Launching an Instance
|
35
36
|
|
36
37
|
To create your own RhoConnect Image, launch an EC2 Image:
|
@@ -46,7 +47,7 @@ Click the Launch Classic Wizard radio button. Click Continue.
|
|
46
47
|
### Requesting the Instance
|
47
48
|
|
48
49
|
In the Choose an AMI section, click the Community AMIs tab.
|
49
|
-
Then paste in the AMI `ami-cbc59e8e`. When the preconfigured RhoConnect AMI appears, click Select.
|
50
|
+
Then paste in the AMI ID, i. e. `ami-cbc59e8e`. When the preconfigured RhoConnect AMI appears, click Select.
|
50
51
|
|
51
52
|
<img src="http://rhodocs.s3.amazonaws.com/rhoconnect-redis-aws/request-instances-wizard-community-AMIs.png" alt="request instances - choose AMI" />
|
52
53
|
|
@@ -76,7 +77,7 @@ Click the Add Rule button to add each port.
|
|
76
77
|
* Add port 80 for HTTP.
|
77
78
|
* Add port 6379 for redis.
|
78
79
|
|
79
|
-
**NOTE
|
80
|
+
**NOTE: You may use a preexisting security group if it has ports 22, 80, and 6379 open. **
|
80
81
|
|
81
82
|
Enter a firewall name and a group description, then click Continue.
|
82
83
|
|
@@ -120,11 +121,21 @@ You can test the application.
|
|
120
121
|
$ sudo /etc/init.d/redis start
|
121
122
|
$ sudo /etc/init.d/nginx start
|
122
123
|
|
124
|
+
**NOTE: If your instance based on `ami-0dfca748` (RhoConnect-3.2.0) image, then you need to do one more step:**
|
125
|
+
|
126
|
+
:::term
|
127
|
+
$ sudo /etc/init.d/thin start
|
128
|
+
|
123
129
|
If everything is configured properly, then you can login to the RhoConnect web console in your browser by using the instance's public DNS name as the URL in your browser. When you are done, you can stop the application.
|
124
130
|
|
125
131
|
:::term
|
126
132
|
$ sudo /etc/init.d/nginx stop
|
127
133
|
$ sudo /etc/init.d/redis stop
|
134
|
+
|
135
|
+
**NOTE: Do not forget also stop cluster of thin servers if your instance based on `ami-0dfca748` (RhoConnect-3.2.0):**
|
136
|
+
|
137
|
+
:::term
|
138
|
+
$ sudo /etc/init.d/thin stop
|
128
139
|
|
129
140
|
## Create the Image
|
130
141
|
|
@@ -168,15 +179,23 @@ Now get the template by either providing the URL for the template file, or by up
|
|
168
179
|
|
169
180
|
Click the Provide a Template URL radio button.
|
170
181
|
|
171
|
-
|
182
|
+
If your custom image based on `ami-cbc59e8e`(RhoConnect-3.1.2) image, then copy the following URL and paste it into the text field below the Provide a Template URL radio button:
|
172
183
|
|
173
184
|
`https://s3-us-west-1.amazonaws.com/rhoconnect-ca-deploy/rhoconnect_template.txt`
|
174
185
|
|
186
|
+
If your custom image based on `ami-0dfca748` (RhoConnect-3.2.0), then use this URL:
|
187
|
+
|
188
|
+
`https://s3-us-west-1.amazonaws.com/rhoconnect-ca-deploy/rhoconnect_template-3.2.txt`
|
189
|
+
|
175
190
|
#### Uploading the Template File
|
176
191
|
|
177
192
|
Click the Upload a Template File radio button.
|
178
193
|
|
179
|
-
In another browser window, go to [https://s3-us-west-1.amazonaws.com/rhoconnect-ca-deploy/rhoconnect_template.txt](https://s3-us-west-1.amazonaws.com/rhoconnect-ca-deploy/rhoconnect_template.txt)
|
194
|
+
In another browser window, go to [https://s3-us-west-1.amazonaws.com/rhoconnect-ca-deploy/rhoconnect_template.txt](https://s3-us-west-1.amazonaws.com/rhoconnect-ca-deploy/rhoconnect_template.txt)
|
195
|
+
if your custom image based on `ami-cbc59e8e` (RhoConnect-3.1.2).
|
196
|
+
|
197
|
+
If your custom image based on `ami-0dfca748` (RhoConnect-3.2.0), then to go
|
198
|
+
[https://s3-us-west-1.amazonaws.com/rhoconnect-ca-deploy/rhoconnect_template-3.2.txt](https://s3-us-west-1.amazonaws.com/rhoconnect-ca-deploy/rhoconnect_template-3.2.txt).
|
180
199
|
|
181
200
|
Save that text file to your computer.
|
182
201
|
|
data/doc/settings.txt
CHANGED
@@ -52,7 +52,13 @@ Typical source settings include:
|
|
52
52
|
:::yaml
|
53
53
|
:poll_interval: <secs> - source's sync poll interval.
|
54
54
|
:force_default: <true|false> - if specified, this setting forces to use
|
55
|
-
|
56
|
-
|
55
|
+
default application poll interval
|
56
|
+
even if source has its own setting.
|
57
57
|
:partition_type: <app|user> - default partition type for the source
|
58
|
-
|
58
|
+
:priority: <num> - these settings are used to determine the order the models
|
59
|
+
are processed and synchronized. They might be useful when
|
60
|
+
there are a set of linked together sources and client need
|
61
|
+
to know in which order to process them.
|
62
|
+
Priority starts from lower value 1. If priorities are not
|
63
|
+
specified, then there are no guarantee that models will be
|
64
|
+
listed and processed in natural order.
|
data/examples/simple/Gemfile
CHANGED
@@ -7,6 +7,8 @@ gem 'rhoconnect', :path => '../../'
|
|
7
7
|
gem 'SystemTimer', '~> 1.2.3', :platforms => :ruby_18
|
8
8
|
gem 'win32-process', :platforms => [:mswin, :mingw]
|
9
9
|
|
10
|
+
gem 'rack-parser', :require => 'rack/parser'
|
11
|
+
|
10
12
|
# for Async, Eventful execution
|
11
13
|
platforms :ruby_19 do
|
12
14
|
gem 'rack-fiber_pool'
|
@@ -22,7 +24,7 @@ platforms :jruby do
|
|
22
24
|
gem 'warbler'
|
23
25
|
end
|
24
26
|
|
25
|
-
gem 'sqlite3', ">= 1.3.3", :platforms => [:ruby, :mswin, :mingw]
|
27
|
+
#gem 'sqlite3', ">= 1.3.3", :platforms => [:ruby, :mswin, :mingw]
|
26
28
|
|
27
29
|
group :development do
|
28
30
|
# FIXME: At this moment (01/10/2012) only pre release of 'eventmachine' is working on Windows
|
@@ -21,6 +21,11 @@ class Application < Rhoconnect::Base
|
|
21
21
|
def store_blob(obj,field_name,blob)
|
22
22
|
super #=> returns blob[:tempfile]
|
23
23
|
end
|
24
|
+
|
25
|
+
def ans_authenticate(username,password)
|
26
|
+
puts "ans_authenticate - user: #{username} password: #{password}"
|
27
|
+
true
|
28
|
+
end
|
24
29
|
end
|
25
30
|
end
|
26
31
|
|
data/examples/simple/config.ru
CHANGED
@@ -26,9 +26,10 @@ Rhoconnect::Server.use Rack::Static, :urls => ['/data'], :root => Rhoconnect
|
|
26
26
|
|
27
27
|
# Load our rhoconnect application
|
28
28
|
require './application'
|
29
|
+
require './my_server'
|
29
30
|
|
30
31
|
# Setup the url map
|
31
32
|
run Rack::URLMap.new \
|
32
|
-
'/' =>
|
33
|
+
'/' => MyServer.new,
|
33
34
|
'/resque' => Resque::Server.new, # If you don't want resque frontend, disable it here
|
34
|
-
|
35
|
+
'/console' => RhoconnectConsole::Server.new # If you don't want rhoconnect frontend, disable it here
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# FIXME: This is a temporary server to handle ans token registration
|
2
|
+
class MyServer < Rhoconnect::Server
|
3
|
+
post '/ans/token' do
|
4
|
+
user = "tuser"
|
5
|
+
User.create(:login => user)
|
6
|
+
current_app.users << user
|
7
|
+
fields = {:user_id => user}
|
8
|
+
fields[:app_id] = 'application'
|
9
|
+
fields[:device_type] = 'rhoconnect_push'
|
10
|
+
fields[:device_pin] = params['token']
|
11
|
+
Client.create(fields)
|
12
|
+
status 200
|
13
|
+
end
|
14
|
+
end
|