rhoconnect 3.0.5 → 3.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. data/CHANGELOG.md +7 -1
  2. data/Gemfile.lock +9 -9
  3. data/README.md +4 -4
  4. data/Rakefile +41 -28
  5. data/bench/bench_runner.rb +4 -5
  6. data/bench/benchapp/Gemfile +1 -1
  7. data/bench/benchapp/Gemfile.lock +26 -27
  8. data/bench/benchapp/config.ru +4 -0
  9. data/bench/benchapp/log/passenger.3000.log +1 -0
  10. data/bench/benchapp/log/passenger.9292.log +59 -0
  11. data/bench/benchapp/settings/settings.yml +2 -0
  12. data/bench/benchapp/tmp/pids/passenger.3000.pid.lock +0 -0
  13. data/bench/benchapp/tmp/pids/passenger.9292.pid.lock +0 -0
  14. data/bench/distr_bench/distr_bench +7 -0
  15. data/bench/distr_bench/distr_bench_main +99 -0
  16. data/bench/distr_bench/run_distr_client.sh +12 -0
  17. data/bench/distr_bench/run_test_query_script.sh +50 -0
  18. data/bench/lib/bench/bench_result_processor.rb +90 -0
  19. data/bench/lib/bench/cli.rb +35 -2
  20. data/bench/lib/bench/logging.rb +2 -0
  21. data/bench/lib/bench/runner.rb +4 -2
  22. data/bench/lib/bench/session.rb +3 -1
  23. data/bench/lib/bench/statistics.rb +41 -1
  24. data/bench/lib/bench/timer.rb +7 -0
  25. data/bench/lib/bench/utils.rb +8 -0
  26. data/bench/lib/bench.rb +35 -9
  27. data/bench/lib/testdata/0-data.txt +0 -0
  28. data/bench/lib/testdata/1-data.txt +0 -0
  29. data/bench/lib/testdata/10-data.txt +15 -0
  30. data/bench/lib/testdata/2-data.txt +3 -0
  31. data/bench/lib/testdata/25-data.txt +39 -0
  32. data/bench/lib/testdata/250-data.txt +353 -0
  33. data/bench/lib/testdata/3-data.txt +4 -0
  34. data/bench/lib/testdata/5-data.txt +7 -8
  35. data/bench/lib/testdata/50-data.txt +70 -0
  36. data/bench/lib/testdata/500-data.txt +711 -0
  37. data/bench/prepare_bench +45 -0
  38. data/bench/run_bench.sh +3 -3
  39. data/bench/run_blob_script.sh +1 -1
  40. data/bench/run_cud_script.sh +1 -1
  41. data/bench/run_query_md_script.sh +1 -1
  42. data/bench/run_query_only_script.sh +1 -1
  43. data/bench/run_query_script.sh +1 -1
  44. data/bench/run_test_query_script.sh +30 -0
  45. data/bench/run_test_source_script.sh +21 -0
  46. data/bench/scripts/test_query_script.rb +64 -0
  47. data/bench/scripts/test_source_script.rb +27 -0
  48. data/bin/rhoconnect-benchmark +13 -0
  49. data/doc/client-objc.txt +236 -1
  50. data/doc/client.txt +132 -0
  51. data/doc/extending-rhoconnect-server.txt +79 -0
  52. data/doc/install.txt +1 -1
  53. data/doc/java-plugin.txt +291 -0
  54. data/doc/rest-api.txt +3 -1
  55. data/installer/unix-like/create_texts.rb +73 -16
  56. data/installer/unix-like/pre_install.sh +1 -1
  57. data/installer/unix-like/rho_connect_install_constants.rb +1 -1
  58. data/installer/utils/constants.rb +2 -2
  59. data/installer/utils/nix_install_test.rb +85 -75
  60. data/installer/utils/package_upload/repos.rake +82 -2
  61. data/installer/windows/rhosync.nsi +5 -5
  62. data/lib/rhoconnect/api/application/queue_updates.rb +14 -0
  63. data/lib/rhoconnect/api/source/set_db_doc.rb +3 -1
  64. data/lib/rhoconnect/server.rb +9 -17
  65. data/lib/rhoconnect/version.rb +1 -1
  66. data/rhoconnect.gemspec +1 -1
  67. data/spec/api/admin/get_api_token_spec.rb +6 -0
  68. data/spec/api/source/set_db_doc_spec.rb +13 -0
  69. data/spec/server/server_spec.rb +27 -1
  70. data/tasks/redis.rake +2 -2
  71. metadata +73 -48
  72. data/examples/simple/dump.rdb +0 -0
  73. data/installer/utils/package_upload/repos.rb +0 -83
@@ -166,17 +166,33 @@ redis_stop() {
166
166
  }
167
167
 
168
168
  redis_usage() {
169
- echo -e "Usage: $0 {start,stop}"
169
+ echo -e "Usage: $0 {start,stop,restart,status}"
170
170
  exit 1
171
171
  }
172
172
 
173
+ redis_status() {
174
+ "$redis_cli" -p ${port} INFO > /dev/null 2>&1
175
+ info=$?
176
+ if (( $info )) ; then
177
+ echo "Redis server not running";
178
+ else
179
+ echo "Redis server running";
180
+ fi
181
+ exit $info
182
+ }
183
+
173
184
  #
174
185
  # CLI logic.
175
186
  #
176
187
  case "$1" in
177
- start) redis_start ;;
178
- stop) redis_stop ;;
179
- *) redis_usage ;;
188
+ start) redis_start ;;
189
+ stop) redis_stop ;;
190
+ restart)
191
+ $0 stop
192
+ $0 start
193
+ ;;
194
+ status) redis_status ;;
195
+ *) redis_usage ;;
180
196
  esac
181
197
  _REDIS_INIT_SCRIPT_
182
198
 
@@ -310,7 +326,7 @@ _NGINX_LOGRORATE_CONF_
310
326
  File.open('/etc/logrotate.d/nginx', 'w') { |f| f << nginx_logrorate_conf }
311
327
  end
312
328
 
313
- def create_nginx_conf_files
329
+ def create_nginx_conf_files(app_name)
314
330
  nginx_server_conf = <<'_NGINX_CONF_'
315
331
  user nginx;
316
332
 
@@ -350,12 +366,13 @@ _NGINX_CONF_
350
366
  File.open('/opt/nginx/conf/nginx.conf', 'w' ) { |f| f << nginx_server_conf }
351
367
 
352
368
  Dir.mkdir "/opt/nginx/conf/conf.d" unless File.exist? "/opt/nginx/conf/conf.d"
353
- rho_vhost_conf = <<'_VHOST_CONF_'
369
+ rho_vhost_conf = <<_VHOST_CONF_
354
370
  server {
355
371
  listen 80;
356
- # server_name www.yourhost.com; # <-- your server domain name!
357
- root /opt/nginx/html/rhoapp/public; # <--- be sure to point to 'public' folder of your application!
372
+ root /opt/nginx/html/#{app_name}/public; # <-- be sure to point to 'public' folder of your application!
358
373
  passenger_enabled on;
374
+ # access_log off; # <-- disable access logging
375
+ # error_log /dev/null crit; # <-- disable error logging, but critical errors only
359
376
  }
360
377
  _VHOST_CONF_
361
378
  File.open('/opt/nginx/conf/conf.d/rhoconnect.conf', 'w' ) { |f| f << rho_vhost_conf }
@@ -550,6 +567,24 @@ def generate_rhoapp(rho_path)
550
567
  end
551
568
  end
552
569
 
570
+ def copy_benchapp(rho_path)
571
+ puts "Copy bench rhoconnect application to /opt/nginx/html directory ..."
572
+ Dir.chdir "#{rho_path}/installer"
573
+ `tar xzf bench.tar.gz -C #{rho_path}`
574
+ `rm -rf bench.tar.gz`
575
+
576
+ `#{rho_path}/bin/gem install ffaker --no-ri --no-rdoc`
577
+ `#{rho_path}/bin/gem install thor --no-ri --no-rdoc`
578
+
579
+ Dir.chdir "#{rho_path}/bench"
580
+ `cp -r benchapp /opt/nginx/html`
581
+ Dir.chdir "/opt/nginx/html/benchapp"
582
+ `rm -rf Gemfile.lock`
583
+ `#{rho_path}/bin/bundle install --without=test development`
584
+ Dir.chdir "../"
585
+ `chown -R nginx:nginx benchapp/`
586
+ end
587
+
553
588
  def create_texts
554
589
  if @redis
555
590
  create_redis_init
@@ -558,9 +593,17 @@ def create_texts
558
593
 
559
594
  if @server == 'nginx'
560
595
  create_nginx_init
596
+
561
597
  create_nginx_logrotate
562
- create_nginx_conf_files
563
- generate_rhoapp @prefix
598
+ @use_bench_app = File.exist? "#{@prefix}/installer/bench.tar.gz"
599
+ if @use_bench_app
600
+ create_nginx_conf_files "benchapp"
601
+ copy_benchapp @prefix
602
+ else
603
+ create_nginx_conf_files "rhoapp"
604
+ generate_rhoapp @prefix
605
+ end
606
+
564
607
  distro_info = nginx_readme
565
608
  else
566
609
  create_passenger_load
@@ -584,9 +627,20 @@ To finish this setup, please complete the following...
584
627
 
585
628
  _IT_SHOULD_BE_DONE_
586
629
 
587
- puts afterwords +
588
- if @server == 'nginx'
589
- server_todo_list = <<_NGINX_TO_DO_
630
+ about_app =
631
+ if @use_bench_app
632
+ server_todo_list = <<_NGINX_TO_DO_
633
+ 2) Rhoconnect 'benchapp' application is created in /opt/nginx/html directory. To run it
634
+ A) As root user start redis and nginx servers:
635
+ /etc/init.d/redis start
636
+ /etc/init.d/nginx start
637
+ B) To verify that application up and running open web console in your browser:
638
+ http://localhost/console/
639
+
640
+ _NGINX_TO_DO_
641
+ else
642
+ if @server == 'nginx'
643
+ server_todo_list = <<_NGINX_TO_DO_
590
644
  2) Try rhoconnect 'rhoapp' application, created in /opt/nginx/html directory
591
645
  A) As root user start redis and nginx servers:
592
646
  /etc/init.d/redis start
@@ -595,8 +649,8 @@ _IT_SHOULD_BE_DONE_
595
649
  http://localhost/console/
596
650
 
597
651
  _NGINX_TO_DO_
598
- else
599
- server_todo_list = <<_APACHE2_TO_DO_
652
+ else
653
+ server_todo_list = <<_APACHE2_TO_DO_
600
654
  2) Complete setup of Apache2 web server
601
655
  A) Configure virtual host for your rhoconnect application:
602
656
  Edit the file /etc/httpd/conf.d/rhoconnect.conf so that it reflects your specifications.
@@ -604,7 +658,10 @@ _NGINX_TO_DO_
604
658
  /sbin/service httpd start
605
659
 
606
660
  _APACHE2_TO_DO_
607
- end + "For more details see #{@prefix}/README file."
661
+ end
662
+ end
663
+
664
+ puts afterwords + about_app + "For more details see #{@prefix}/README file."
608
665
 
609
666
  end #create_texts
610
667
 
@@ -1,7 +1,7 @@
1
1
  #!/bin/bash
2
2
 
3
3
  if [ -d "/opt/rhoconnect" ]; then
4
- rm -rf /opt.rhoconnect
4
+ rm -rf /opt/rhoconnect
5
5
  fi
6
6
 
7
7
  #if [ -d "/opt/nginx" ]; then
@@ -8,7 +8,7 @@ module Constants
8
8
  "libaprutil1-dev",
9
9
  "dtach"]
10
10
 
11
- REDIS = "redis-2.4.1"
11
+ REDIS = "redis-2.4.2"
12
12
  SQLITE3 = "sqlite-autoconf-3070701"
13
13
  RUBY = "ruby-enterprise-1.8.7-2011.03"
14
14
  Nginx = "nginx-1.0.6"
@@ -6,12 +6,12 @@ module Constants
6
6
 
7
7
  RC_VERSION = Rhoconnect::VERSION
8
8
  REGION = 'us-west-1'
9
- SLEEP = 45
9
+ SLEEP = 60
10
10
  HOME_DIR = `echo ~/`.strip.chomp("/")
11
11
  REMOTE_HOME = '/home/ubuntu'
12
12
  PEM_FILE = 'alexdevkey.pem'
13
13
  SSH_KEY = "#{HOME_DIR}/.ssh/#{PEM_FILE}"
14
- ACCESS_KEY_FILE = "#{HOME_DIR}/.ec2/credentials"
14
+ ACCESS_KEY_FILE = "#{HOME_DIR}/.ec2"
15
15
  UBUNTU_STACK = { :image_id => 'ami-3d491a78',
16
16
  :flavor_id => 'm1.small',
17
17
  :key_name => 'alexdevkey',
@@ -36,22 +36,35 @@ def compile_stack_info
36
36
 
37
37
  # Append the rest of the file name according to distribution
38
38
  if @user == 'ubuntu'
39
- @dist = { :package => "rhoconnect_#{Constants::RC_VERSION}_all.deb",
40
- :local_file => "#{local_file}rhoconnect_#{Constants::RC_VERSION}_all.deb",
41
- :pkg_mgr => 'dpkg',
42
- :pkg_type => 'DEB',
43
- :pkg_repo => 'apt-get -y',
44
- :deps => Constants::DEB_DEPS }
39
+ @dist = { :flavor => "ubuntu",
40
+ :package => "rhoconnect_#{Constants::RC_VERSION}_all.deb",
41
+ :local_file => "#{local_file}rhoconnect_#{Constants::RC_VERSION}_all.deb",
42
+ :pkg_mgr => 'dpkg',
43
+ :pkg_type => 'DEB',
44
+ :pkg_repo => 'apt-get',
45
+ :deps => Constants::DEB_DEPS,
46
+ :repo_src_file => '/etc/apt/sources.list',
47
+ :repo_str => '\n' +
48
+ '# This is the repository for rhoconnect packages\n' +
49
+ 'deb http://rhoconnect.s3.amazonaws.com/packages/deb rhoconnect main' }
45
50
  elsif @user == 'root'
46
- @dist = { :package => "rhoconnect-#{Constants::RC_VERSION}.noarch.rpm",
47
- :local_file => "#{local_file}rhoconnect-#{Constants::RC_VERSION}.noarch.rpm",
48
- :pkg_mgr => 'rpm',
49
- :pkg_type => 'RPM',
50
- :pkg_repo => 'yes | yum',
51
- :deps => Constants::RPM_DEPS }
51
+ @dist = { :flavor => "centos",
52
+ :package => "rhoconnect-#{Constants::RC_VERSION}.noarch.rpm",
53
+ :local_file => "#{local_file}rhoconnect-#{Constants::RC_VERSION}.noarch.rpm",
54
+ :pkg_mgr => 'rpm',
55
+ :pkg_type => 'RPM',
56
+ :pkg_repo => 'yum',
57
+ :deps => Constants::RPM_DEPS,
58
+ :repo_src_file => '/etc/yum.repos.d/rhoconnect.repo',
59
+ :repo_str => '[rhoconnect]\n' +
60
+ 'name=Rhoconnect\n' +
61
+ 'baseurl=http://rhoconnect.s3.amazonaws.com/packages/rpm\n' +
62
+ 'enabled=1\n' +
63
+ 'gpgcheck=0\n' }
64
+
52
65
  else
53
66
  puts "Incorrect user name"
54
- exit
67
+ exit 3
55
68
  end #i
56
69
  end #compile_stack_info
57
70
 
@@ -66,8 +79,8 @@ end #create_ec2_instance
66
79
  # Retrieves the access key and secret access key from the above specified file.
67
80
  def get_access_keys
68
81
  lines = IO.readlines Constants::ACCESS_KEY_FILE
69
- @access_key = lines.first.strip
70
- @secret_access_key = lines.last.strip
82
+ @access_key = lines.first.strip.split("=")[1]
83
+ @secret_access_key = lines.last.strip.split("=")[1]
71
84
  end #get_access_keys
72
85
 
73
86
  # make_fog
@@ -105,7 +118,7 @@ def start_new_instance
105
118
  @server_id = @server.id
106
119
  else
107
120
  puts "Server timed out."
108
- exit
121
+ exit 7
109
122
  end #if
110
123
  end #start_new_instance
111
124
 
@@ -115,29 +128,6 @@ def establish_ssh_connection
115
128
  @ssh = Fog::SSH.new( @host, @user, :keys => Constants::SSH_KEY )
116
129
  end #establish_ssh_connection
117
130
 
118
- # establish_scp_connection
119
- # Establishes a gateway through which to transfer data
120
- def establish_scp_connection
121
- @scp = Fog::SCP.new( @host, @user, :keys => Constants::SSH_KEY )
122
- end #create_scp_connection
123
-
124
- # transfer
125
- # transfers given data to remote machine via scp
126
- def transfer(local_data, remote_data)
127
- puts "Attempting file transfer via SCP"
128
- puts "Transferring #{local_data} to #{remote_data}..."
129
- @scp.upload( local_data, remote_data ) do |cd, name, sent, total|
130
- print "\r#{name}: #{(sent.to_f * 100 / total.to_f).to_i}%"
131
- end #do
132
- puts
133
- end #establish_scp_connection
134
-
135
- # transfer_rhoconnect
136
- # Transfers the rhoconnect package over SCP
137
- def transfer_rhoconnect
138
- transfer @dist[:local_file], @dist[:remote_home]
139
- end #transfer_rhoconnect
140
-
141
131
  # destroy_ec2_instance
142
132
  # Terminates the current ec2 instance
143
133
  def destroy_ec2_instance
@@ -145,50 +135,71 @@ def destroy_ec2_instance
145
135
  puts "Terminating Instance."
146
136
  end #destroy_ec2_instance
147
137
 
148
- # install_dependencies
149
- # Installs all dependant packages on the remove machine
150
- def install_dependencies
151
- dep_install_string = "sudo #{@dist[:pkg_repo]} install"
152
- @dist[:deps].each do |dep|
153
- dep_install_string << " #{dep}"
154
- end #do
155
- ssh_cmd "sudo #{@dist[:pkg_repo]} update"
156
- ssh_cmd dep_install_string
157
- puts
158
- end #install_dependencies
138
+ # prepare_sources
139
+ # Prepares the remote machine's repo source list to be able to download rhoconnect
140
+ def prepare_sources
141
+ puts "preparing sources..."
142
+
143
+ ssh_cmd "sudo touch #{@dist[:repo_src_file]}" if @dist[:flavor] == 'centos'
144
+ filename = @dist[:repo_src_file]
145
+ src_str = @dist[:repo_str]
146
+
147
+ # Create file for yum rhoconnect sources
148
+ # Get current permissions of file
149
+ perms = @ssh.run("stat --format=%a #{filename}")[0].stdout.strip
150
+
151
+ # Change permissions so that it can be edited by "others"
152
+ ssh_cmd "sudo chmod 0666 #{filename}"
153
+
154
+ ssh_cmd "echo -e \"#{src_str}\" >> #{filename}"
155
+
156
+ ssh_cmd "sudo chmod 0#{perms} #{filename}"
157
+
158
+ cat_src = @ssh.run("cat #{@dist[:repo_src_file]}")[0].stdout.strip
159
+
160
+ ssh_cmd "sudo #{@dist[:pkg_repo]} update" unless @dist[:flavor] == "centos"
161
+ end #prepare_sources
159
162
 
160
163
  # install_package
161
164
  # Issues commands to the remote machine to start the installation
162
165
  def install_package
163
- install_dependencies
164
- ssh_cmd "sudo #{@dist[:pkg_mgr]} -i #{@dist[:package]}"
165
- puts
166
+ prepare_sources
167
+ puts "Installing rhoconnect package.\n" +
168
+ "This may take a while...\n\n"
169
+ ssh_cmd "yes | sudo #{@dist[:pkg_repo]} install rhoconnect"
166
170
  end #install_package
167
171
 
172
+ # start_servers
173
+ # Attempts to start redis and nginx servers
168
174
  def start_servers
175
+ puts "Waiting #{Constants::SLEEP} seconds for services to initialize."
176
+ Constants::SLEEP.times do |sec|
177
+ print '.'
178
+ STDOUT.flush
179
+ sleep 1
180
+ end #do
181
+ puts
182
+
169
183
  attempts = 0
170
184
  while @ssh.run("pgrep redis")[0].stdout.strip == ""
171
- ssh_cmd "sudo /etc/init.d/redis start"
172
- attempts += 0
185
+ ssh_cmd "sudo /etc/init.d/redis start"
186
+ attempts += 1
187
+ sleep 1
173
188
  end #while
174
189
  puts "Redis start took #{attempts} attempts"
175
190
  puts
176
191
  attempts = 0
177
192
  while @ssh.run("pgrep nginx")[0].stdout.strip == ""
178
193
  ssh_cmd "sudo /etc/init.d/nginx start"
179
- attempts += 0
194
+ attempts += 1
195
+ sleep 1
180
196
  end #while
181
197
  puts "Nginx start took #{attempts} attempts."
182
198
  puts
183
- puts "Waiting #{Constants::SLEEP} seconds for servers to initialize"
184
- Constants::SLEEP.times do
185
- sleep 1
186
- print '.'
187
- STDOUT.flush
188
- end # do
189
- puts
190
199
  end # start_servers
191
200
 
201
+ # chack_rc_service
202
+ # Makes an HTTP request to check that the rhoconnect service is working
192
203
  def check_rc_service
193
204
  request = Net::HTTP.get_response(@host, '/console')
194
205
  puts "Host: #{@host}"
@@ -196,10 +207,13 @@ def check_rc_service
196
207
  if request.code == '200'
197
208
  puts "Rhoconnect service up!"
198
209
  else
199
- puts "Rhoconnect service down :("
210
+ puts "Failed to connect to rhoconnect service."
211
+ exit 13
200
212
  end #if
201
213
  end #check_rc_service
202
214
 
215
+ # compute_time
216
+ # General time computation method
203
217
  def compute_time(start_time, end_time)
204
218
  time_delta = (end_time - start_time)
205
219
 
@@ -224,24 +238,19 @@ Constants::STACKS.each do |stack|
224
238
  begin
225
239
  @stack = stack
226
240
  compile_stack_info
227
- puts
228
- puts "================================================"
229
- puts "Now starting test of #{@dist[:pkg_type]} package"
230
- puts "================================================"
231
- puts
241
+
242
+ puts "\n" +
243
+ "================================================\n" +
244
+ "Now starting test of #{@dist[:pkg_type]} package\n" +
245
+ "================================================\n" +
246
+ "\n\n"
232
247
 
233
248
  create_ec2_instance
234
249
 
235
250
  # Establish connections
236
251
  establish_ssh_connection
237
252
  @dist[:remote_home] = @ssh.run("echo ~")[0].stdout.strip
238
- establish_scp_connection
239
253
 
240
- # Transfer the Rhoconnect package to the remote machine
241
- transfer_rhoconnect
242
-
243
- puts "Installing rhoconnect package.\n" +
244
- "This may take a while...\n\n"
245
254
  install_package
246
255
 
247
256
  # Start the redis and nginx servers on the remote machine
@@ -256,6 +265,7 @@ Constants::STACKS.each do |stack|
256
265
  puts "OH NOEZ, Exception!!"
257
266
  puts e.inspect
258
267
  puts e.backtrace
268
+ exit 15
259
269
  ensure
260
270
  if @server != nil
261
271
  destroy_ec2_instance
@@ -1,5 +1,85 @@
1
1
  desc 'Creates and uploads apt and rpm repos.'
2
2
  task "build:repos" => ['build:deb', 'build:rpm'] do
3
- # Run repos.rb
4
- ruby "installer/utils/package_upload/repos.rb"
3
+ require 'find'
4
+
5
+ # CONSTANTS
6
+
7
+ PKG_DIR = '/packages'
8
+ START_DIR = PKG_DIR
9
+ BUCKET = 'rhoconnect'
10
+
11
+ def cmd(cmd)
12
+ puts cmd unless @raked
13
+ system(cmd)
14
+ end #cmd
15
+
16
+ def prepare_destination
17
+ # Prompt to remove the /deb directory if it exists
18
+ if File.directory?("#{PKG_DIR}/deb")
19
+ if !@raked
20
+ puts "Remove #{PKG_DIR}/deb?"
21
+ remove = STDIN.gets.strip.downcase.chars.first
22
+ else
23
+ remove = 'y'
24
+ end #if
25
+ if remove == 'y'
26
+ cmd "sudo rm -rf #{PKG_DIR}/deb"
27
+ end #if
28
+ end #if
29
+
30
+ # Create deb directory if it does not already exist
31
+ cmd "sudo mkdir -p #{PKG_DIR}/deb" unless File.directory?("#{PKG_DIR}/deb")
32
+
33
+ # Create configuration file "ditributions" in deb directory
34
+ filename = "#{PKG_DIR}/deb/conf/"
35
+ cmd "sudo mkdir -p #{filename}"
36
+ distributions = "Origin: Rhomobile, Inc.\n" +
37
+ "Label: Rhomobile, Inc.\n" +
38
+ "Codename: rhoconnect\n" +
39
+ "Architectures: i386 amd64\n" +
40
+ "Components: main\n" +
41
+ "Description: Rhoconnect APT Repository"
42
+ cmd "touch #{filename}/distributions"
43
+
44
+ # Write distributions string to corresponding file
45
+ dist_file = File.new("#{filename}/distributions", "w")
46
+ dist_file.write(distributions)
47
+ dist_file.close
48
+
49
+ # Create rpm directory if it does not already exist
50
+ cmd "sudo mkdir -p #{PKG_DIR}/rpm" unless File.directory?("#{PKG_DIR}/rpm")
51
+
52
+ end #prepare_destination
53
+
54
+ def copy_files
55
+ # Copy the packages to their respective directory
56
+ Find.find('./pkg') do |file|
57
+ if !FileTest.directory?(file)
58
+ dest_dir = File.extname(file)
59
+ #get rid of '.' before extension name
60
+ dest_dir[0] = ''
61
+ if dest_dir == 'deb' || dest_dir == 'rpm'
62
+ if dest_dir == 'deb'
63
+ @deb_pkg = File.basename(file)
64
+ end #if
65
+ file_path = File.expand_path(file)
66
+ cmd "sudo cp -rf #{file_path} #{PKG_DIR}/#{dest_dir}"
67
+ end #if
68
+ end #if
69
+ end #do
70
+ end #copy_files
71
+
72
+ @raked = true
73
+
74
+ prepare_destination
75
+
76
+ copy_files
77
+
78
+ # REPOIFY!
79
+ cmd "sudo reprepro -b #{PKG_DIR}/deb includedeb rhoconnect #{PKG_DIR}/deb/#{@deb_pkg}"
80
+ cmd "sudo createrepo #{PKG_DIR}/rpm"
81
+
82
+ # Call S3 upload script
83
+ cmd "ruby ./installer/utils/package_upload/s3_upload.rb #{START_DIR} #{BUCKET} #{@raked}"
84
+
5
85
  end #build:repos
@@ -99,7 +99,7 @@ section "uninstall"
99
99
  Push "PATH"
100
100
  Push "R"
101
101
  Push "HKLM"
102
- Push "$INSTDIR\redis-2.4.1"
102
+ Push "$INSTDIR\redis-2.4.2"
103
103
  Call un.EnvVarUpdate
104
104
  Pop $R0
105
105
 
@@ -170,25 +170,25 @@ Section "Redis" redisSection
170
170
 
171
171
  SetOutPath $INSTDIR
172
172
 
173
- File /r "redis-2.4.1"
173
+ File /r "redis-2.4.2"
174
174
 
175
175
  ;add to path here
176
176
 
177
177
  Push "PATH"
178
178
  Push "P"
179
179
  Push "HKLM"
180
- Push "$INSTDIR\redis-2.4.1"
180
+ Push "$INSTDIR\redis-2.4.2"
181
181
  Call EnvVarUpdate
182
182
  Pop $R0
183
183
 
184
184
  Push "REDIS_HOME"
185
185
  Push "P"
186
186
  Push "HKLM"
187
- Push "$INSTDIR\redis-2.4.1"
187
+ Push "$INSTDIR\redis-2.4.2"
188
188
  Call EnvVarUpdate
189
189
  Pop $R0
190
190
 
191
- ExecWait '$INSTDIR\redis-2.4.1\redis-service.exe install' $0
191
+ ExecWait '$INSTDIR\redis-2.4.2\redis-service.exe install' $0
192
192
  StrCmp $0 "0" continue wrong
193
193
 
194
194
  wrong:
@@ -1,4 +1,18 @@
1
1
  Server.api :queue_updates, :application, :post do |params,user,server|
2
+ begin
3
+ if params["cud"]
4
+ cud = JSON.parse(params["cud"])
5
+ params.delete("cud")
6
+ params.merge!(cud)
7
+ end
8
+ rescue JSON::ParserError => jpe
9
+ log jpe.message + jpe.backtrace.join("\n")
10
+ throw :halt, [500, "Server error while processing client data"]
11
+ rescue Exception => e
12
+ log e.message + e.backtrace.join("\n")
13
+ throw :halt, [500, "Internal server error"]
14
+ end
15
+
2
16
  server.catch_all do
3
17
  server.current_client_sync.receive_cud(params)
4
18
  server.status 200
@@ -2,7 +2,9 @@ Server.api :set_db_doc, :source do |params,user|
2
2
  if params[:data_type] and params[:data_type] == 'string'
3
3
  Store.put_value(params[:doc],params[:data])
4
4
  else
5
- Store.put_data(params[:doc],params[:data])
5
+ append_to_doc = params[:append]
6
+ append_to_doc ||= false
7
+ Store.put_data(params[:doc],params[:data],append_to_doc)
6
8
  end
7
9
  ''
8
10
  end
@@ -220,19 +220,6 @@ module Rhoconnect
220
220
  cache_control :no_cache
221
221
  headers({'pragma'=>'no-cache'})
222
222
 
223
- begin
224
- if params["cud"]
225
- cud = JSON.parse(params["cud"])
226
- params.delete("cud")
227
- params.merge!(cud)
228
- end
229
- rescue JSON::ParserError => jpe
230
- log jpe.message + jpe.backtrace.join("\n")
231
- throw :halt, [500, "Server error while processing client data"]
232
- rescue Exception => e
233
- log e.message + e.backtrace.join("\n")
234
- throw :halt, [500, "Internal server error"]
235
- end
236
223
  if params[:version] and params[:version].to_i < 3
237
224
  throw :halt, [404, "Server supports version 3 or higher of the protocol."]
238
225
  end
@@ -251,19 +238,24 @@ module Rhoconnect
251
238
  erb :index
252
239
  end
253
240
 
254
- # Collection routes
241
+ # old routes
255
242
  post '/login' do
256
243
  mark_deprecated_call_and_reroute(:login, :admin, self, params)
257
244
  end
258
-
259
- # Member routes
260
245
  get '/application' do
261
246
  mark_deprecated_call_and_reroute(:query, :application, self, params)
262
247
  end
263
-
264
248
  post '/application' do
265
249
  mark_deprecated_call_and_reroute(:queue_updates, :application, self, params)
266
250
  end
251
+ # confusion routes - only because Rhodes didn't switch
252
+ # to new style API yet
253
+ get '/api/application' do
254
+ mark_deprecated_call_and_reroute(:query, :application, self, params)
255
+ end
256
+ post '/api/application' do
257
+ mark_deprecated_call_and_reroute(:queue_updates, :application, self, params)
258
+ end
267
259
 
268
260
  def self.api(name, namespace = nil, verb = :post, &block)
269
261
  old_api_prefix = (namespace == :application) ? :application : :api
@@ -1,3 +1,3 @@
1
1
  module Rhoconnect
2
- VERSION = '3.0.5'
2
+ VERSION = '3.0.6'
3
3
  end
data/rhoconnect.gemspec CHANGED
@@ -38,7 +38,7 @@ Gem::Specification.new do |s|
38
38
 
39
39
  s.add_dependency('bundler', '~> 1.0')
40
40
  s.add_dependency("sinatra", '~> 1.3')
41
- s.add_dependency('rake', '0.9.2')
41
+ s.add_dependency('rake', '~> 0.9.2')
42
42
  s.add_dependency('json', '~> 1.5.0')
43
43
  s.add_dependency('rubyzip', '~> 0.9.4')
44
44
  s.add_dependency('uuidtools', '>= 2.1.1')
@@ -32,5 +32,11 @@ describe "RhoconnectApiGetApiToken" do
32
32
  post "/api/user/create_user", params
33
33
  last_response.status.should == 422
34
34
  end
35
+
36
+ it "response should have cache-control and pragma headers set to no-cache" do
37
+ post "/login", :login => 'rhoadmin',:password => ''
38
+ last_response.headers['Cache-Control'].should == 'no-cache'
39
+ last_response.headers['Pragma'].should == 'no-cache'
40
+ end
35
41
  end
36
42
  end