rhoconnect 3.2.0.beta1 → 3.2.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. data/CHANGELOG.md +14 -0
  2. data/Gemfile +2 -1
  3. data/Gemfile.lock +33 -7
  4. data/README.md +4 -0
  5. data/Rakefile +13 -11
  6. data/commands/commands/rhoconnect/create_user.rb +1 -1
  7. data/commands/commands/rhoconnect/delete_device.rb +1 -1
  8. data/commands/commands/rhoconnect/delete_user.rb +1 -1
  9. data/commands/commands/rhoconnect/get_token.rb +1 -1
  10. data/commands/commands/rhoconnect/reset.rb +1 -1
  11. data/commands/execute.rb +0 -1
  12. data/doc/bulk-sync.txt +35 -1
  13. data/doc/install.txt +7 -3
  14. data/examples/simple/config.ru +1 -1
  15. data/generators/templates/application/Gemfile +1 -1
  16. data/install.sh +4 -4
  17. data/installer/unix-like/create_texts.rb +31 -31
  18. data/installer/unix-like/pre_uninstall.sh +2 -3
  19. data/installer/unix-like/rho_connect_install_constants.rb +3 -3
  20. data/installer/unix-like/rho_connect_install_debian.rb +0 -5
  21. data/installer/unix-like/rho_connect_install_yum.rb +1 -3
  22. data/installer/utils/constants.rb +4 -4
  23. data/installer/utils/nix_install_test.rb +20 -20
  24. data/installer/utils/package_upload/repos.rake +2 -2
  25. data/installer/utils/package_upload/s3_single_file.rb +57 -0
  26. data/lib/rhoconnect/client_sync.rb +1 -1
  27. data/lib/rhoconnect/jobs/bulk_data_job.rb +30 -32
  28. data/lib/rhoconnect/jobs/ping_job.rb +15 -2
  29. data/lib/rhoconnect/server.rb +3 -0
  30. data/lib/rhoconnect/tasks.rb +5 -7
  31. data/lib/rhoconnect/user.rb +1 -0
  32. data/lib/rhoconnect/version.rb +1 -1
  33. data/lib/rhoconnect/web-console/models/adapter.js +2 -0
  34. data/lib/rhoconnect/web-console/models/client.js +0 -22
  35. data/lib/rhoconnect/web-console/models/source.js +1 -1
  36. data/lib/rhoconnect/web-console/templates/index.erb +2 -1
  37. data/lib/rhoconnect/web-console/views/home.js +22 -1
  38. data/lib/rhoconnect/web-console/views/set_adapter.js +5 -6
  39. data/rhoconnect.gemspec +2 -1
  40. data/spec/api/source/fast_insert_spec.rb +1 -1
  41. data/spec/api/user/create_user_spec.rb +11 -1
  42. data/spec/client_sync_spec.rb +32 -25
  43. data/spec/javascripts/admins_routes_spec.js +108 -103
  44. data/spec/javascripts/doc_view_spec.js +2 -3
  45. data/spec/javascripts/edit_user_view_spec.js +1 -1
  46. data/spec/javascripts/home_view_spec.js +6 -6
  47. data/spec/javascripts/server_doc_view_spec.js +4 -0
  48. data/spec/javascripts/session_spec.js +15 -0
  49. data/spec/javascripts/set_adapter_view_spec.js +2 -6
  50. data/spec/javascripts/show_device_view_spec.js +4 -1
  51. data/spec/javascripts/show_user_view_spec.js +4 -0
  52. data/spec/javascripts/source_docs_view_spec.js +2 -2
  53. data/spec/jobs/bulk_data_job_spec.rb +8 -12
  54. data/spec/jobs/ping_job_spec.rb +21 -0
  55. data/spec/perf/bulk_data_perf_spec.rb +1 -2
  56. data/spec/server/server_spec.rb +2 -4
  57. data/spec/spec_helper.rb +13 -3
  58. data/tasks/jasmine.rake +7 -0
  59. metadata +24 -7
  60. data/lib/rhoconnect/console/rhoconnect_api.rb +0 -245
  61. data/spec/api/application/rhoconnect_api_spec.rb +0 -592
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ## 3.2.0.beta2 (2012-05-02)
2
+ * 28571961 fix jasmine tests
3
+ * #28496779 - remove rhoconnect_api.rb and all of its references
4
+ * #28563163 - bug fix : it should not be allowed to create a User with empty login
5
+ * #28528841 - Ping should process all clients and report cumulative error at the end
6
+ * Empty 'queue_updates' request should trigger processing of the CUD queue
7
+ * #28094895 - Zendesk ticket #2354: Bulk sync not updating sources table (fields 'last_inserted_size' and 'backend_refresh_time' now updated)
8
+ * #28855323 - Bulk Sync Associations from Zendesk ticket #2377
9
+ * #28576723 - dpkg lock error on Ubuntu install
10
+ * #28094895 - Zendesk ticket #2354: Bulk sync not updating sources table (fields 'last_inserted_size' and 'backend_refresh_time' now updated)
11
+ * #28865579 - Async dependencies are not properly initialized on Windows (need to add :mingw_19 to the list of platforms in Gemfile)
12
+ * Rhoconnect production stack updated to latest stable version of ruby, redis, and nginx: ruby-1.9.3-p194, redis-2.4.12, nginx-1.2.0.
13
+
1
14
  ## 3.2.0.beta1 (2012-04-20)
2
15
  * Rhoconnect commands (replacement for rake tasks)
3
16
  * Async framework is introduced for rubies 1.9.x (no 1.8.7 or JRuby support)
@@ -7,6 +20,7 @@
7
20
  * #28219647 - Schema Change Error from Zendesk ticket #2353
8
21
  * #28328057 - Feature Request: Adding a Bulk Data Job after_perform hook from Zendesk ticket #2367
9
22
  * #28330213 - Implementing fast_insert/update/delete API
23
+ * #27051649 - Rhoconnect Console is re-worked using Twitter.Bootstrap
10
24
 
11
25
  ## 3.1.2 (2012-04-02)
12
26
  * #19297819 - Refactor server middleware loading to be static
data/Gemfile CHANGED
@@ -7,7 +7,7 @@ gem 'win32-process', :platforms => [:mswin, :mingw]
7
7
 
8
8
  # for async framework
9
9
  # for Async, Eventful execution
10
- platforms :ruby_19 do
10
+ platforms :ruby_19, :mingw_19 do
11
11
  gem 'eventmachine'
12
12
  gem 'rack-fiber_pool'
13
13
  gem 'async-rack'
@@ -36,6 +36,7 @@ group :test do
36
36
  gem 'simplecov', :require => false, :platforms => [:ruby_19,:jruby]
37
37
  gem 'rack-test', '>= 0.5.3', :require => 'rack/test'
38
38
  gem 'jasmine'
39
+ gem 'jasmine-headless-webkit'
39
40
  end
40
41
 
41
42
  group :build do
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rhoconnect (3.2.0.beta1)
4
+ rhoconnect (3.2.0.beta2)
5
5
  bundler (~> 1.0)
6
6
  json (~> 1.6.0)
7
7
  rake (~> 0.9.2)
@@ -11,6 +11,7 @@ PATH
11
11
  rubyzip (~> 0.9.4)
12
12
  sinatra (~> 1.3)
13
13
  templater (~> 1.0.0)
14
+ thin (~> 1.3.1)
14
15
  thor (~> 0.14.6)
15
16
  uuidtools (>= 2.1.1)
16
17
 
@@ -18,7 +19,7 @@ GEM
18
19
  remote: http://rubygems.org/
19
20
  specs:
20
21
  SystemTimer (1.2.3)
21
- addressable (2.2.7)
22
+ addressable (2.2.8)
22
23
  arr-pm (0.0.7)
23
24
  cabin (> 0)
24
25
  async-rack (0.5.1)
@@ -34,10 +35,17 @@ GEM
34
35
  childprocess (0.3.2)
35
36
  ffi (~> 1.0.6)
36
37
  clamp (0.3.1)
38
+ coffee-script (2.2.0)
39
+ coffee-script-source
40
+ execjs
41
+ coffee-script-source (1.3.1)
37
42
  crack (0.3.1)
43
+ daemons (1.1.8)
38
44
  diff-lcs (1.1.3)
39
45
  eventmachine (0.12.10)
40
46
  excon (0.13.4)
47
+ execjs (1.3.1)
48
+ multi_json (~> 1.0)
41
49
  extlib (0.9.15)
42
50
  ffaker (1.14.0)
43
51
  ffi (1.0.11)
@@ -52,24 +60,31 @@ GEM
52
60
  nokogiri (~> 1.5.0)
53
61
  ruby-hmac
54
62
  formatador (0.2.1)
55
- fpm (0.4.6)
63
+ fpm (0.4.9)
56
64
  arr-pm (~> 0.0.7)
57
65
  backports (= 2.3.0)
58
66
  cabin (~> 0.4.3)
59
- clamp
60
- json
67
+ clamp (= 0.3.1)
68
+ json (= 1.6.6)
61
69
  highline (1.6.11)
70
+ hike (1.2.1)
62
71
  jasmine (1.1.2)
63
72
  jasmine-core (>= 1.1.0)
64
73
  rack (>= 1.1)
65
74
  rspec (>= 1.3.1)
66
75
  selenium-webdriver (>= 0.1.3)
67
76
  jasmine-core (1.1.0)
77
+ jasmine-headless-webkit (0.8.4)
78
+ coffee-script
79
+ jasmine-core (~> 1.1)
80
+ multi_json
81
+ rainbow
82
+ sprockets (~> 2)
68
83
  json (1.6.6)
69
84
  libwebsocket (0.1.3)
70
85
  addressable
71
86
  mime-types (1.18)
72
- multi_json (1.3.2)
87
+ multi_json (1.3.4)
73
88
  net-scp (1.0.4)
74
89
  net-ssh (>= 1.99.1)
75
90
  net-ssh (2.3.0)
@@ -80,6 +95,7 @@ GEM
80
95
  rack
81
96
  rack-test (0.6.1)
82
97
  rack (>= 1.0)
98
+ rainbow (1.1.4)
83
99
  rake (0.9.2.2)
84
100
  rcov (1.0.0)
85
101
  redis (2.2.2)
@@ -101,7 +117,7 @@ GEM
101
117
  diff-lcs (~> 1.1.3)
102
118
  rspec-mocks (2.9.0)
103
119
  ruby-hmac (0.4.0)
104
- rubyzip (0.9.7)
120
+ rubyzip (0.9.8)
105
121
  selenium-webdriver (2.21.2)
106
122
  childprocess (>= 0.2.5)
107
123
  ffi (~> 1.0)
@@ -116,11 +132,20 @@ GEM
116
132
  rack (~> 1.3, >= 1.3.6)
117
133
  rack-protection (~> 1.2)
118
134
  tilt (~> 1.3, >= 1.3.3)
135
+ sprockets (2.4.1)
136
+ hike (~> 1.2)
137
+ multi_json (~> 1.0)
138
+ rack (~> 1.0)
139
+ tilt (~> 1.1, != 1.3.0)
119
140
  sqlite3 (1.3.6)
120
141
  templater (1.0.0)
121
142
  diff-lcs (>= 1.1.2)
122
143
  extlib (>= 0.9.5)
123
144
  highline (>= 1.4.0)
145
+ thin (1.3.1)
146
+ daemons (>= 1.0.9)
147
+ eventmachine (>= 0.12.6)
148
+ rack (>= 1.0.0)
124
149
  thor (0.14.6)
125
150
  tilt (1.3.3)
126
151
  uuidtools (2.1.2)
@@ -145,6 +170,7 @@ DEPENDENCIES
145
170
  fog (>= 1.1.0)
146
171
  fpm (>= 0.4.6)
147
172
  jasmine
173
+ jasmine-headless-webkit
148
174
  jdbc-sqlite3 (>= 3.7.2)
149
175
  jruby-openssl (>= 0.7.4)
150
176
  rack-fiber_pool
data/README.md CHANGED
@@ -2,6 +2,10 @@ RhoConnect App Integration Server
2
2
  -------------------------------------------------------------
3
3
  RhoConnect is an app integration server which keeps enterprise data current and available on users’ devices.
4
4
 
5
+ Prerequisites
6
+ -------------------------------------------------------------
7
+ You will need to install the Qt libraray <http://qt.nokia.com/downloads> in order to run the specs.
8
+
5
9
  More Info
6
10
  -------------------------------------------------------------
7
11
  * Intro to Rhodes & RhoConnect: <http://docs.rhomobile.com>
data/Rakefile CHANGED
@@ -11,7 +11,8 @@ $:.unshift File.join(File.dirname(__FILE__),'lib')
11
11
  require 'rhoconnect'
12
12
 
13
13
  include Rake::DSL
14
- task :default => 'spec:all'
14
+ #task :default => 'spec:all'
15
+ task :default => ["spec:all","jasmine:headless"]
15
16
  task :spec => 'spec:spec'
16
17
 
17
18
  begin
@@ -103,23 +104,23 @@ end
103
104
 
104
105
  # Debian and RPM package building tasks
105
106
  def build_pkg(dist, arch, deps, use_bench_tarball=false)
106
- build_dir = "/tmp/rhobuild"
107
- version = Rhoconnect::VERSION
108
- description = '"Rhoconnect production environment"'
109
- prefix = "/opt/rhoconnect/installer"
110
- gem_name = "rhoconnect-#{version}.gem"
107
+ puts start_dir = Dir.pwd
108
+ build_dir = "/tmp/rhobuild"
109
+ version = Rhoconnect::VERSION
110
+ description = '"Rhoconnect production environment"'
111
+ prefix = "/opt/rhoconnect/installer"
112
+ gem_name = "rhoconnect-#{version}.gem"
111
113
 
112
114
  before_install_script = "#{build_dir}/unix-like/pre_install.sh"
113
- after_install_script = "#{build_dir}/unix-like/post_install.sh"
114
- before_remove_script = "#{build_dir}/unix-like/pre_uninstall.sh"
115
- after_remove_script = "#{build_dir}/unix-like/post_uninstall.sh"
115
+ after_install_script = "#{build_dir}/unix-like/post_install.sh"
116
+ before_remove_script = "#{build_dir}/unix-like/pre_uninstall.sh"
117
+ after_remove_script = "#{build_dir}/unix-like/post_uninstall.sh"
116
118
 
117
119
  `rm -rf #{build_dir}` if File.exist?("#{build_dir}")
118
120
  Dir.mkdir("#{build_dir}")
119
121
  Dir.mkdir("#{build_dir}/unix-like")
120
122
 
121
123
  # Copy all necessary Files into the build_dir
122
- Dir.chdir(File.expand_path(File.dirname(__FILE__)))
123
124
  system("cp install.sh Gemfile Gemfile.lock #{build_dir}")
124
125
  system("cp -r installer/unix-like/*.sh #{build_dir}/unix-like")
125
126
  system("cp -r installer/unix-like/*.rb #{build_dir}/unix-like")
@@ -145,6 +146,7 @@ def build_pkg(dist, arch, deps, use_bench_tarball=false)
145
146
  system(fpm_cmd)
146
147
  # Leave no trace...
147
148
  system("rm -rf #{build_dir}")
149
+ Dir.chdir(start_dir)
148
150
  end
149
151
 
150
152
  DEB_DEPS = [
@@ -183,7 +185,7 @@ end
183
185
 
184
186
  begin
185
187
  require 'jasmine'
186
- load 'jasmine/tasks/jasmine.rake'
188
+ load 'tasks/jasmine.rake'
187
189
  rescue LoadError
188
190
  task :jasmine do
189
191
  abort "Jasmine is not available. In order to run jasmine, you must: (sudo) gem install jasmine"
@@ -13,6 +13,6 @@ Execute.define_task do
13
13
  exit
14
14
  end
15
15
  puts ''
16
- RhoconnectApi.create_user($url,$token,login,password)
16
+ RestClient.post("#{$url}/api/user/create_user", { :api_token => $token, :attributes => {:login => login, :password => password}})
17
17
  end #create_user
18
18
  end #do
@@ -4,6 +4,6 @@ Execute.define_task do
4
4
  invoke :config
5
5
  user_id = ask "device's user_id: "
6
6
  device_id = ask "device to delete: "
7
- RhoconnectApi.delete_client($url,$token,user_id,device_id)
7
+ RestClient.post("#{$url}/api/client/delete_client", { :api_token => $token, :user_id => user_id, :client_id => device_id})
8
8
  end #delete_device
9
9
  end #do
@@ -3,6 +3,6 @@ desc "delete-user", "Deletes a user from rhoconnect"
3
3
  def delete_user
4
4
  invoke :config
5
5
  login = ask "user to delete: "
6
- RhoconnectApi.delete_user($url,$token,login)
6
+ RestClient.post("#{$url}/api/user/delete_user", { :api_token => $token, :user_id => login })
7
7
  end #delete_user
8
8
  end #do
@@ -14,7 +14,7 @@ desc "get-token", "Fetches current api token from rhoconnect"
14
14
  end
15
15
  puts ''
16
16
  begin
17
- $token = RhoconnectApi.get_token($url,login,password)
17
+ $token = RestClient.post("#{$url}/api/admin/login", { :login => login, :password => password})
18
18
  rescue
19
19
  puts "Login failed."
20
20
  exit
@@ -7,7 +7,7 @@ Execute.define_task do
7
7
  " existing devices when they connect! (yes/no):"
8
8
 
9
9
  if confirm == 'yes'
10
- RhoconnectApi.reset($url,$token)
10
+ RestClient.post("#{$url}/api/admin/reset", { :api_token => $token })
11
11
  puts "Database reset."
12
12
  else
13
13
  puts "Cancelling."
data/commands/execute.rb CHANGED
@@ -10,7 +10,6 @@ $:.unshift File.join(File.dirname(__FILE__), '.')
10
10
  $:.unshift File.join(File.dirname(__FILE__), '..')
11
11
  require 'lib/rhoconnect/utilities'
12
12
  require 'lib/rhoconnect'
13
- require 'lib/rhoconnect/console/rhoconnect_api'
14
13
 
15
14
  include Utilities
16
15
 
data/doc/bulk-sync.txt CHANGED
@@ -73,6 +73,37 @@ By default, bulk sync data files will be stored in the application's root folder
73
73
  :syncserver: http://localhost:9292/application/
74
74
  :bulk_sync_poll_interval: 3600
75
75
 
76
+ ## Bulk Sync Associations
77
+
78
+ Sometimes your bulk data is not simply a collection of separate sources, but they are linked together through associations. For these purposes
79
+ RhoConnect uses the notation of `belongs_to` association. The `belongs_to` association is a natural way to express hasOne and hasMany associations. In the case of bulk sync, data `belongs_to` relationship includes a list of all dependent objects for model(s) and helps resolve dependency issues during bulk sync process.
80
+
81
+ Associations are defined in your RhoConnect application's `settings/settings.yml` file.
82
+
83
+ For example, you can have a list of customers who have purchased a product, and thus you can have them belong to that product:
84
+
85
+ :::yaml
86
+ :sources:
87
+ :Product:
88
+ :poll_interval: 600
89
+ :partition_type: app
90
+ :sync_type: bulk_sync_only
91
+ :Customer:
92
+ :poll_interval: 300
93
+ # ...
94
+ belongs_to:
95
+ - :product_id: 'Product'
96
+
97
+ `belongs_to` format is an array of attribute/source_name pairs. It can be polymorphic and define associations across multiple sources:
98
+
99
+ :::yaml
100
+ belongs_to:
101
+ - :parent_id, 'Product'
102
+ - :parent_id, 'Cases'
103
+
104
+ Bulk Sync Associations are similar to [Rhom Sync Associations](/rhodes/rhom#associations) and both should be considered together
105
+ if you are planning to use bulk sync data.
106
+
76
107
  ## Using Bulk Sync with Fixed Schema Models
77
108
 
78
109
  If your Rhom model is a [fixed schema model](/rhodes/rhom#fixed-schema) and you use bulk sync, you can control the bulk sync schema at runtime in your source adapter by implementing the 'schema' method.
@@ -99,4 +130,7 @@ An example schema method is as follows:
99
130
  'by_price' => 'price'
100
131
  }
101
132
  }.to_json
102
- end
133
+ end
134
+
135
+ **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.**
136
+
data/doc/install.txt CHANGED
@@ -1,8 +1,10 @@
1
1
  # Installing RhoConnect
2
2
 
3
- On Windows and Mac OS, the usual way to install RhoConnect is to install RhoStudio.
3
+ This section discusses how to install the development environment for RhoConnect. For those who have developed a RhoConnect application, and now wish to deploy that RhoConnect application on a server, refer to the instructions for deploying a RhoConnect application, such as [preparing a RhoConnect app for production](/rhoconnect/preparing-production) and [deploying a RhoConnect application](/rhoconnect/deploying).
4
4
 
5
- On Linux, you install the Rhodes gem from the command line; you can also do this from Windows or Mac OS.
5
+ On Windows and Mac OS, the usual way to install the RhoConnect development environment is to install RhoStudio.
6
+
7
+ On Linux, you install the RhoConnect gem from the command line; you can also do this from Windows or Mac OS.
6
8
 
7
9
  ## Mac OS
8
10
 
@@ -22,7 +24,9 @@ You can also install RhoConnect without RhoStudio by [installing Ruby and the Rh
22
24
 
23
25
  If you're running Windows 32-bit, download the latest [RhoStudio Installer for Windows](http://rhomobile.com/rhostudio-windows). This installs the [Ruby stack](http://www.ruby-lang.org/en/), [Redis](http://redis.io/), [RhoConnect](/rhoconnect/introduction), and [Rhodes](/rhodes/introduction).
24
26
 
25
- If you are running Windows 64-bit, you need to [install Ruby and the RhoConnect gem](/rhoconnect/install#rhoconnect-gem-for-linux-and-non-rhostudio). If you also want RhoStudio, you need to have 64-bit Eclipse, and then you [install RhoStudio as a plugin for Eclipse](/rhodes/rhostudio-eclipse).
27
+ If you are running Windows 64-bit, you need to use 32-bit Java when you run RhoStudio. You can include the 32-bit Java in the PATH, or you can run RhoStudio with a link to 32-bit Java:
28
+
29
+ C:\RhoStudio\eclipse\RhoStudio.exe -vm "<32-bit java path>\bin\javaw.exe"
26
30
 
27
31
  ## Java Development Kit (JDK)
28
32
 
@@ -12,7 +12,7 @@ if ENV['DEBUG'] == 'yes'
12
12
  end
13
13
 
14
14
  require 'rhoconnect/server'
15
- require 'rhoconnect/console/server'
15
+ require 'rhoconnect/web-console/server'
16
16
  require 'resque/server'
17
17
 
18
18
  # Rhoconnect server flags
@@ -7,7 +7,7 @@ gem 'SystemTimer', '~> 1.2.3', :platforms => :ruby_18
7
7
  gem 'win32-process', :platforms => [:mswin, :mingw]
8
8
 
9
9
  # for Async, Eventful execution
10
- platforms :ruby_19 do
10
+ platforms :ruby_19, :mingw_19 do
11
11
  gem 'thin'
12
12
  gem 'rack-fiber_pool'
13
13
  gem 'async-rack'
data/install.sh CHANGED
@@ -200,10 +200,10 @@ logAndPrint ()
200
200
  setRubyVars ()
201
201
  {
202
202
  if [[ $rubyVersion == "" || $rubyVersion =~ ruby'ee'|'enterprise' ]]; then
203
- rubyVersion="ruby-1.9.3-p125"
204
- rubyDir="ruby-1.9.3-p125"
203
+ rubyVersion="ruby-1.9.3-p194"
204
+ rubyDir="ruby-1.9.3-p194"
205
205
  rubyTar="${rubyDir}.tar.gz"
206
- # http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
206
+ # http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
207
207
  rubyURL="http://ftp.ruby-lang.org/pub/ruby/1.9/${rubyTar}"
208
208
  elif [$rubyVersion == "ruby187"]; then
209
209
  rubyDir="ruby-1.8.7"
@@ -234,7 +234,7 @@ installRuby ()
234
234
  # rubyee)
235
235
  # logAndPrint "${prefix}/${rubyDir}/installer --dont-install-useful-gems --no-dev-docs --auto ${prefix}"
236
236
  # ;;
237
- ruby-1.9.3-p125)
237
+ ruby-1.9.3-p194)
238
238
  (
239
239
  echo "cd ${prefix}/${rubyDir}" | tee -a $log
240
240
  cd ${prefix}/${rubyDir}
@@ -373,11 +373,10 @@ _NGINX_CONF_
373
373
  Dir.mkdir "/opt/nginx/conf/conf.d" unless File.exist? "/opt/nginx/conf/conf.d"
374
374
  rho_vhost_conf = <<_VHOST_CONF_
375
375
  upstream thin_cluster {
376
- server unix:/tmp/thin.sock;
377
- #server unix:/tmp/thin.0.sock;
378
- #server unix:/tmp/thin.1.sock;
379
- #server unix:/tmp/thin.2.sock;
380
- #server unix:/tmp/thin.3.sock;
376
+ server unix:/tmp/thin.0.sock;
377
+ server unix:/tmp/thin.1.sock;
378
+ # server unix:/tmp/thin.2.sock;
379
+ # server unix:/tmp/thin.3.sock;
381
380
  }
382
381
 
383
382
  server {
@@ -479,15 +478,21 @@ def nginx_readme
479
478
  - Nginx start-up script (/etc/init.d/nginx)
480
479
  - Nginx logrotate settings (/etc/logrotate.d/nginx)
481
480
  - Nginx configuration file (/opt/nginx/conf/nginx.conf)
482
- - passenger configuration file and virtual host template for rhoconnect application
483
- (/opt/nginx/conf/conf.d/passenger.conf and /opt/nginx/conf/conf.d/rhoconnect.conf)
481
+ - virtual host template for rhoconnect application
482
+ (/opt/nginx/conf/conf.d/rhoconnect.conf)
484
483
 
485
- To complete setup of web server
484
+ To change default setup of web server
486
485
  A) Configure virtual host for rhoconnect application:
487
486
  Edit the file /opt/nginx/conf/conf.d/rhoconnect.conf so that it reflects your specifications.
488
-
489
487
  B) As root user start server to pick up the changes:
490
488
  /etc/init.d/nginx start
489
+
490
+ 5) Installer also configured Thin app server with the following configuration files:
491
+ - Thin start-up script (/etc/init.d/thin)
492
+ - Thin configuration file (/etc/thin/rhoapp.yml)
493
+
494
+ By default, init script start cluster of 2 servers running on UNIX domain sockets.
495
+ Nginx connected to cluster via upstream block in nginx config file.
491
496
  _NGINX_README_
492
497
  readme
493
498
  end
@@ -525,25 +530,20 @@ end
525
530
 
526
531
  def config_and_install_thin_scripts(rho_path)
527
532
  puts "Configuring and installing thin scripts ..."
528
- `#{rho_path}/bin/thin install`
529
-
530
- # >> Installing thin service at /etc/rc.d/thin ...
531
- # mkdir -p /etc/rc.d
532
- # writing /etc/rc.d/thin
533
- # chmod +x /etc/rc.d/thin
534
- # mkdir -p /etc/thin
535
- #
536
- # To configure thin to start at system boot:
537
- # on RedHat like systems:
538
- # sudo /sbin/chkconfig --level 345 thin on
539
- # on Debian-like systems (Ubuntu):
540
- # sudo /usr/sbin/update-rc.d -f thin defaults
541
- # on Gentoo:
542
- # sudo rc-update add thin default
543
- #
544
- # Then put your config files in /etc/thin
545
-
546
- `#{rho_path}/bin/thin config -C /etc/thin/rhoapp.yml -c /opt/nginx/html/rhoapp/ --socket /tmp/thin.sock --log /opt/nginx/logs/thin.log --pid /var/run/thin.pid -e production`
533
+ `env PATH=#{rho_path}/bin:$PATH thin install`
534
+ # >> Installing thin service at /etc/rc.d/thin (RedHat) or /etc/init.d/thin (Ubuntu) ...
535
+
536
+ thin_conf_file = (File.exists?('/etc/init.d/thin')) ? "/etc/init.d/thin" : "/etc/rc.d/thin"
537
+ File.open("/tmp/thin", 'w') do |f|
538
+ File.foreach(thin_conf_file) do |line|
539
+ f << "export PATH=/opt/rhoconnect/bin:$PATH" << "\n" if line =~ /^DAEMON/
540
+ f << line
541
+ end
542
+ end
543
+ File.rename("/tmp/thin", thin_conf_file)
544
+ `chmod +x #{thin_conf_file}`
545
+
546
+ `env PATH=#{rho_path}/bin:$PATH 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`
547
547
  `ln -s /etc/rc.d/thin /etc/init.d/.` if File.directory?('/etc/rc.d')
548
548
  end
549
549
 
@@ -593,18 +593,18 @@ _IT_SHOULD_BE_DONE_
593
593
  /etc/init.d/redis start
594
594
  /etc/init.d/nginx start
595
595
  B) To verify that application up and running open web console in your browser:
596
- http://localhost/console/
596
+ http://server_ip_address
597
597
 
598
598
  _NGINX_TO_DO_
599
599
  else
600
600
  server_todo_list = <<_NGINX_TO_DO_
601
601
  2) Try rhoconnect 'rhoapp' application, created in /opt/nginx/html directory
602
- A) As root user start redis and nginx servers:
602
+ A) As root user start redis, nginx and thin servers:
603
603
  /etc/init.d/redis start
604
604
  /etc/init.d/nginx start
605
605
  /etc/init.d/thin start
606
606
  B) Open RhoConnect application web console in your browser:
607
- http://localhost/console/
607
+ http://server_ip_address
608
608
 
609
609
  _NGINX_TO_DO_
610
610
  end
@@ -14,12 +14,11 @@ if [ -e "/etc/init.d/redis" ]; then
14
14
  fi
15
15
 
16
16
  #stop thin
17
- if [ -e "/etc/init.d/thin" ]; then /etc/init.d/thin stop; fi
17
+ [ "$(ps aux | grep '[t]hin')" ] && [ -e "/etc/init.d/thin" ] && /etc/init.d/thin stop
18
18
 
19
19
  #stop nginx
20
- if [ -e "/etc/init.d/nginx" ]; then /etc/init.d/nginx stop; fi
20
+ [ "$(ps aux | grep '[n]ginx')" ] && [ -e "/etc/init.d/nginx" ] && /etc/init.d/nginx stop
21
21
 
22
- #/etc/logrotate.d/redis
23
22
  rm -f /etc/init.d/redis
24
23
  rm -f /etc/logrotate.d/redis
25
24
 
@@ -8,10 +8,10 @@ module Constants
8
8
  "libaprutil1-dev",
9
9
  "dtach"]
10
10
 
11
- RUBY = "ruby-1.9.3-p125"
12
- REDIS = "redis-2.4.10"
11
+ RUBY = "ruby-1.9.3-p194"
12
+ REDIS = "redis-2.4.12"
13
13
  SQLITE3 = "sqlite-autoconf-3071000"
14
- NGINX = "nginx-1.0.15"
14
+ NGINX = "nginx-1.2.0"
15
15
  PASSENGER_ROOT = "/opt/rhoconnect/lib/ruby/gems/1.9.1/gems/passenger"
16
16
 
17
17
  SOFTWARE = [ REDIS, SQLITE3, RUBY, NGINX ]
@@ -9,8 +9,6 @@ class Debian
9
9
  def initialize(options)
10
10
  @@flavor = "Debian"
11
11
  @options = options
12
- @options[:pkg_mgr] = 'apt-get -y'
13
- @options[:pkg_chkr] = 'dpkg -l'
14
12
  end #initialize
15
13
 
16
14
  # check_for_installed_software_only
@@ -35,9 +33,6 @@ class Debian
35
33
  # Install sqlite3 libs
36
34
  install_sqlite
37
35
 
38
- # Look for sqlite3-dev as it is required by the sqlite3 gem
39
- `#{@options[:pkg_mgr]} install libsqlite3-dev` if `#{@options[:pkg_chkr]} | grep libsqlite3-dev`.empty?
40
-
41
36
  #start installing
42
37
  install_all_gems
43
38
  configure_nginx @options
@@ -9,8 +9,6 @@ class Yum
9
9
  def initialize(options)
10
10
  @@flavor = "Yum"
11
11
  @options = options
12
- @options[:pkg_mgr] = 'yes | yum'
13
- @options[:pkg_chkr] = 'rpm -qa'
14
12
  end #initialize
15
13
 
16
14
  # check_for_installed_software_only
@@ -31,7 +29,7 @@ class Yum
31
29
  # ruby gems is installed by the REE installer
32
30
  # install_rubygems
33
31
  install_redis if @options[:redis]
34
- # Cent OS uses obsolete sqlite3 libs, update them the latest ones
32
+ # Cent OS 5.x uses obsolete sqlite3 libs, update them the latest ones
35
33
  install_sqlite
36
34
 
37
35
  #start installing
@@ -12,14 +12,14 @@ module Constants
12
12
  PEM_FILE = 'jenkinskey.pem'
13
13
  SSH_KEY = "#{HOME_DIR}/.ssh/#{PEM_FILE}"
14
14
  ACCESS_KEY_FILE = "#{HOME_DIR}/.ec2"
15
- UBUNTU_STACK = { :image_id => 'ami-6da8f128',
15
+ UBUNTU_STACK = { :image_id => 'ami-938ed5d6',
16
16
  :flavor_id => 'c1.xlarge',
17
17
  :key_name => 'jenkinskey',
18
18
  :groups => 'load-test',
19
19
  :user => 'ubuntu'}
20
20
 
21
- CENTOS_STACK = { :image_id => 'ami-13346656',
22
- :flavor_id => 'c1.medium',
21
+ CENTOS_STACK = { :image_id => 'ami-178dd652',
22
+ :flavor_id => 'c1.xlarge',
23
23
  :key_name => 'jenkinskey',
24
24
  :groups => 'load-test',
25
25
  :user => 'root'}
@@ -41,4 +41,4 @@ module Constants
41
41
  "pcre-devel",
42
42
  "openssl-devel",
43
43
  "readline-devel" ]
44
- end #Constants
44
+ end #Constants