rhoconnect 3.1.2 → 3.2.0.beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +14 -2
- data/CREDITS +151 -10
- data/Gemfile +16 -5
- data/Gemfile.lock +58 -23
- data/Rakefile +70 -50
- data/bench/bench_runner.rb +2 -2
- data/bench/benchapp/Gemfile +6 -0
- data/bench/benchapp/Gemfile.lock +5 -0
- data/bench/benchapp/config.ru +2 -0
- data/bench/lib/bench/cli.rb +2 -0
- data/bench/lib/bench/distr_runner.rb +3 -2
- data/bench/lib/bench/runner.rb +1 -1
- data/bench/lib/bench.rb +10 -1
- data/bench/run_bench.sh +1 -1
- data/bench/scripts/test_query_script.rb +2 -1
- data/bench/spec/bench_spec_helper.rb +1 -0
- data/bin/rhoconnect +9 -27
- data/bin/rhoconnect-benchmark +10 -1
- data/commands/commands/dtach_commands/dtach_about.rb +6 -0
- data/commands/commands/dtach_commands/dtach_install.rb +30 -0
- data/commands/commands/redis_commands/redis_about.rb +6 -0
- data/commands/commands/redis_commands/redis_attach.rb +6 -0
- data/commands/commands/redis_commands/redis_download.rb +33 -0
- data/commands/commands/redis_commands/redis_install.rb +26 -0
- data/commands/commands/redis_commands/redis_make.rb +9 -0
- data/commands/commands/redis_commands/redis_restart.rb +7 -0
- data/commands/commands/redis_commands/redis_runner.rb +67 -0
- data/commands/commands/redis_commands/redis_start.rb +6 -0
- data/commands/commands/redis_commands/redis_startbg.rb +6 -0
- data/commands/commands/redis_commands/redis_stop.rb +6 -0
- data/commands/commands/rhoconnect/attach.rb +7 -0
- data/commands/commands/rhoconnect/clean_start.rb +9 -0
- data/commands/commands/rhoconnect/config.rb +15 -0
- data/commands/commands/rhoconnect/console.rb +15 -0
- data/commands/commands/rhoconnect/console_helper.rb +3 -0
- data/commands/commands/rhoconnect/create_user.rb +18 -0
- data/commands/commands/rhoconnect/delete_device.rb +9 -0
- data/commands/commands/rhoconnect/delete_user.rb +8 -0
- data/commands/commands/rhoconnect/flushdb.rb +14 -0
- data/commands/commands/rhoconnect/get_token.rb +25 -0
- data/commands/commands/rhoconnect/reset.rb +16 -0
- data/commands/commands/rhoconnect/reset_refresh.rb +11 -0
- data/commands/commands/rhoconnect/restart.rb +7 -0
- data/commands/commands/rhoconnect/secret.rb +11 -0
- data/commands/commands/rhoconnect/set_admin_password.rb +26 -0
- data/commands/commands/rhoconnect/spec.rb +15 -0
- data/commands/commands/rhoconnect/start.rb +18 -0
- data/commands/commands/rhoconnect/startbg.rb +34 -0
- data/commands/commands/rhoconnect/startdebug.rb +35 -0
- data/commands/commands/rhoconnect/stop.rb +11 -0
- data/commands/commands/rhoconnect/war.rb +32 -0
- data/commands/commands/rhoconnect/web.rb +7 -0
- data/commands/execute.rb +35 -0
- data/commands/generators/app.rb +6 -0
- data/commands/generators/source.rb +6 -0
- data/commands/utilities/dtach_installed.rb +10 -0
- data/doc/benchmarks-running.txt +5 -0
- data/doc/command-line.txt +216 -27
- data/doc/heroku-addon.txt +1 -1
- data/doc/preparing-production.txt +20 -1
- data/doc/public/cli.txt +191 -0
- data/doc/push-backend-setup.txt +148 -0
- data/doc/push-client-setup.txt +61 -0
- data/doc/push-server-setup.txt +91 -0
- data/doc/push.txt +8 -137
- data/doc/rest-api.txt +96 -0
- data/doc/settings.txt +1 -1
- data/doc/supported-platforms.txt +2 -1
- data/doc/tutorial.txt +6 -4
- data/examples/simple/Gemfile +39 -0
- data/examples/simple/Rakefile +7 -12
- data/examples/simple/config.ru +16 -31
- data/examples/simple/settings/settings.yml +5 -4
- data/examples/simple/sources/product.rb +51 -0
- data/generators/templates/application/Gemfile +7 -0
- data/generators/templates/application/Rakefile +5 -18
- data/generators/templates/application/config.ru +11 -19
- data/install.sh +24 -49
- data/installer/unix-like/create_texts.rb +71 -123
- data/installer/unix-like/post_install.sh +3 -0
- data/installer/unix-like/post_uninstall.sh +2 -0
- data/installer/unix-like/pre_install.sh +5 -3
- data/installer/unix-like/pre_uninstall.sh +14 -6
- data/installer/unix-like/rho_connect_install_checkers.rb +1 -1
- data/installer/unix-like/rho_connect_install_constants.rb +6 -10
- data/installer/unix-like/rho_connect_install_debian.rb +2 -2
- data/installer/unix-like/rho_connect_install_dnd.rb +2 -5
- data/installer/unix-like/rho_connect_install_installers.rb +15 -23
- data/installer/unix-like/rho_connect_install_yum.rb +2 -2
- data/installer/utils/constants.rb +4 -4
- data/installer/utils/create_sha1.rb +1 -1
- data/installer/utils/nix_install_test.rb +32 -31
- data/installer/utils/nix_installation.rake +1 -1
- data/installer/utils/package_upload/repos.rake +34 -30
- data/installer/utils/package_upload/s3_upload.rb +3 -3
- data/lib/rhoconnect/api/source/fast_delete.rb +10 -0
- data/lib/rhoconnect/api/source/fast_insert.rb +10 -0
- data/lib/rhoconnect/api/source/fast_update.rb +10 -0
- data/lib/rhoconnect/api/source/get_source_params.rb +1 -1
- data/lib/rhoconnect/api/source/list_sources.rb +2 -2
- data/lib/rhoconnect/api/source/save_adapter.rb +1 -1
- data/lib/rhoconnect/api/source/update_source_params.rb +6 -0
- data/lib/rhoconnect/async.rb +82 -0
- data/lib/rhoconnect/bulk_data/bulk_data.rb +5 -1
- data/lib/rhoconnect/client_sync.rb +18 -3
- data/lib/rhoconnect/console/rhoconnect_api.rb +2 -2
- data/lib/rhoconnect/console/server.rb +5 -32
- data/lib/rhoconnect/console.rb +2 -2
- data/lib/rhoconnect/graph_helper.rb +225 -0
- data/lib/rhoconnect/jobs/bulk_data_job.rb +24 -2
- data/lib/rhoconnect/server.rb +31 -11
- data/lib/rhoconnect/source.rb +10 -5
- data/lib/rhoconnect/source_sync.rb +32 -2
- data/lib/rhoconnect/tasks.rb +19 -108
- data/lib/rhoconnect/test_methods.rb +20 -0
- data/lib/rhoconnect/utilities.rb +118 -0
- data/lib/rhoconnect/version.rb +1 -1
- data/lib/rhoconnect/web-console/controllers/admins.js +245 -0
- data/lib/rhoconnect/web-console/models/adapter.js +53 -0
- data/lib/rhoconnect/web-console/models/client.js +105 -0
- data/lib/rhoconnect/web-console/models/doc.js +113 -0
- data/lib/rhoconnect/web-console/models/session.js +40 -0
- data/lib/rhoconnect/web-console/models/source.js +115 -0
- data/lib/rhoconnect/web-console/models/stats.js +84 -0
- data/lib/rhoconnect/web-console/models/user.js +111 -0
- data/lib/rhoconnect/web-console/public/backbone.js +1432 -0
- data/lib/rhoconnect/web-console/public/bootstrap.css +3990 -0
- data/lib/rhoconnect/{console/app → web-console}/public/jqplot/excanvas.min.js +0 -0
- data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.barRenderer.min.js +0 -0
- data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.canvasAxisLabelRenderer.js +0 -0
- data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.canvasAxisTickRenderer.js +0 -0
- data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.canvasTextRenderer.js +0 -0
- data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.categoryAxisRenderer.min.js +0 -0
- data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.cursor.js +0 -0
- data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.dateAxisRenderer.js +0 -0
- data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.dateAxisRenderer.min.js +0 -0
- data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.pointLabels.min.js +0 -0
- data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jquery-1.4.2.min.js +0 -0
- data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jquery.jqplot.min.css +0 -0
- data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jquery.jqplot.min.js +0 -0
- data/lib/rhoconnect/web-console/public/jquery-1.7.1.min.js +154 -0
- data/lib/rhoconnect/web-console/public/rhoconnect-web.js +15 -0
- data/lib/rhoconnect/web-console/public/underscore.js +999 -0
- data/lib/rhoconnect/web-console/server.rb +55 -0
- data/lib/rhoconnect/web-console/templates/index.erb +90 -0
- data/lib/rhoconnect/web-console/templates/jqplot.erb +60 -0
- data/lib/rhoconnect/web-console/views/api_token.js +16 -0
- data/lib/rhoconnect/web-console/views/doc.js +63 -0
- data/lib/rhoconnect/web-console/views/edit_user.js +43 -0
- data/lib/rhoconnect/web-console/views/home.js +56 -0
- data/lib/rhoconnect/web-console/views/index.js +63 -0
- data/lib/rhoconnect/web-console/views/new_ping.js +58 -0
- data/lib/rhoconnect/web-console/views/new_user.js +29 -0
- data/lib/rhoconnect/web-console/views/server_doc.js +103 -0
- data/lib/rhoconnect/web-console/views/set_adapter.js +38 -0
- data/lib/rhoconnect/web-console/views/settings.js +53 -0
- data/lib/rhoconnect/web-console/views/show_device.js +56 -0
- data/lib/rhoconnect/web-console/views/show_user.js +38 -0
- data/lib/rhoconnect/web-console/views/source_docs.js +30 -0
- data/lib/rhoconnect/web-console/views/stats.js +69 -0
- data/lib/rhoconnect/web-console/views/users.js +20 -0
- data/lib/rhoconnect.rb +2 -1
- data/rhoconnect.gemspec +3 -1
- data/spec/api/application/rhoconnect_api_spec.rb +3 -5
- data/spec/api/source/fast_delete_spec.rb +27 -0
- data/spec/api/source/fast_insert_spec.rb +28 -0
- data/spec/api/source/fast_update_spec.rb +51 -0
- data/spec/api/source/get_source_params_spec.rb +1 -0
- data/spec/api/source/update_source_params_spec.rb +24 -0
- data/spec/async_spec.rb +19 -0
- data/spec/client_sync_spec.rb +19 -2
- data/spec/javascripts/PlayerSpec.js +58 -0
- data/spec/javascripts/admins_routes_spec.js +117 -0
- data/spec/javascripts/admins_spec.js +27 -0
- data/spec/javascripts/doc_view_spec.js +37 -0
- data/spec/javascripts/edit_user_view_spec.js +44 -0
- data/spec/javascripts/helpers/SpecHelper.js +9 -0
- data/spec/javascripts/helpers/jasmine-jquery.js +305 -0
- data/spec/javascripts/helpers/jasmine-sinon.js +43 -0
- data/spec/javascripts/helpers/sinon-1.3.2.js +3551 -0
- data/spec/javascripts/home_view_spec.js +39 -0
- data/spec/javascripts/index_view_spec.js +42 -0
- data/spec/javascripts/new_ping_view_spec.js +48 -0
- data/spec/javascripts/new_user_view_spec.js +42 -0
- data/spec/javascripts/server_doc_view_spec.js +39 -0
- data/spec/javascripts/set_adapter_view_spec.js +32 -0
- data/spec/javascripts/show_device_view_spec.js +41 -0
- data/spec/javascripts/show_user_view_spec.js +46 -0
- data/spec/javascripts/source_docs_view_spec.js +36 -0
- data/spec/javascripts/support/jasmine.yml +79 -0
- data/spec/javascripts/support/jasmine_config.rb +23 -0
- data/spec/javascripts/support/jasmine_runner.rb +32 -0
- data/spec/javascripts/users_view_spec.js +35 -0
- data/spec/jobs/bulk_data_job_spec.rb +10 -2
- data/spec/perf/bulk_data_perf_spec.rb +1 -0
- data/spec/server/server_spec.rb +3 -1
- data/spec/source_sync_spec.rb +14 -1
- data/spec/spec_helper.rb +51 -0
- data/spec/store_spec.rb +6 -0
- data/spec/test_methods_spec.rb +11 -0
- data/tasks/redis.rake +3 -1
- metadata +172 -64
- data/doc/contributing.txt +0 -60
- data/lib/rhoconnect/console/app/helpers/auth_helper.rb +0 -22
- data/lib/rhoconnect/console/app/helpers/extensions.rb +0 -19
- data/lib/rhoconnect/console/app/helpers/helpers.rb +0 -57
- data/lib/rhoconnect/console/app/public/ThickBox.css +0 -649
- data/lib/rhoconnect/console/app/public/home.css +0 -431
- data/lib/rhoconnect/console/app/public/images/foot_logo_rhoconnect.png +0 -0
- data/lib/rhoconnect/console/app/public/images/header_halo.jpg +0 -0
- data/lib/rhoconnect/console/app/public/images/land_separator.gif +0 -0
- data/lib/rhoconnect/console/app/public/images/landing_header.jpg +0 -0
- data/lib/rhoconnect/console/app/public/images/logo_rhoconnect.png +0 -0
- data/lib/rhoconnect/console/app/public/images/tabs_separator.png +0 -0
- data/lib/rhoconnect/console/app/public/main.css +0 -7
- data/lib/rhoconnect/console/app/public/reset.css +0 -76
- data/lib/rhoconnect/console/app/public/style.css +0 -2201
- data/lib/rhoconnect/console/app/public/text.txt +0 -0
- data/lib/rhoconnect/console/app/routes/adapter.rb +0 -28
- data/lib/rhoconnect/console/app/routes/auth.rb +0 -29
- data/lib/rhoconnect/console/app/routes/client.rb +0 -31
- data/lib/rhoconnect/console/app/routes/docs.rb +0 -145
- data/lib/rhoconnect/console/app/routes/heroku.rb +0 -19
- data/lib/rhoconnect/console/app/routes/home.rb +0 -63
- data/lib/rhoconnect/console/app/routes/timing.rb +0 -242
- data/lib/rhoconnect/console/app/routes/user.rb +0 -122
- data/lib/rhoconnect/console/app/views/adapter.erb +0 -16
- data/lib/rhoconnect/console/app/views/client.erb +0 -30
- data/lib/rhoconnect/console/app/views/content.erb +0 -14
- data/lib/rhoconnect/console/app/views/doc.erb +0 -8
- data/lib/rhoconnect/console/app/views/docdata.erb +0 -28
- data/lib/rhoconnect/console/app/views/docs.erb +0 -30
- data/lib/rhoconnect/console/app/views/edituser.erb +0 -13
- data/lib/rhoconnect/console/app/views/headermenu.erb +0 -40
- data/lib/rhoconnect/console/app/views/home.erb +0 -24
- data/lib/rhoconnect/console/app/views/index.erb +0 -58
- data/lib/rhoconnect/console/app/views/jqplot.erb +0 -52
- data/lib/rhoconnect/console/app/views/layout.erb +0 -153
- data/lib/rhoconnect/console/app/views/login.erb +0 -26
- data/lib/rhoconnect/console/app/views/newuser.erb +0 -17
- data/lib/rhoconnect/console/app/views/ping.erb +0 -40
- data/lib/rhoconnect/console/app/views/result.erb +0 -11
- data/lib/rhoconnect/console/app/views/rightboxlinks.erb +0 -15
- data/lib/rhoconnect/console/app/views/select_doc.erb +0 -17
- data/lib/rhoconnect/console/app/views/upload_doc.erb +0 -23
- data/lib/rhoconnect/console/app/views/user.erb +0 -29
- data/lib/rhoconnect/console/app/views/users.erb +0 -19
- data/lib/rhoconnect/server/views/index.erb +0 -13
|
@@ -37,9 +37,9 @@ def build_type
|
|
|
37
37
|
when 'beta'
|
|
38
38
|
'beta-packages'
|
|
39
39
|
when 'release'
|
|
40
|
-
'
|
|
40
|
+
'packages'
|
|
41
41
|
else
|
|
42
|
-
'
|
|
42
|
+
'packages'
|
|
43
43
|
end #case
|
|
44
44
|
end #build_type
|
|
45
45
|
|
|
@@ -60,28 +60,28 @@ def compile_stack_info
|
|
|
60
60
|
# Append the rest of the file name according to distribution
|
|
61
61
|
if @user == 'ubuntu'
|
|
62
62
|
|
|
63
|
-
@dist = { :flavor
|
|
64
|
-
:package
|
|
65
|
-
:local_file
|
|
66
|
-
:pkg_mgr
|
|
67
|
-
:pkg_type
|
|
68
|
-
:pkg_repo
|
|
69
|
-
:deps
|
|
63
|
+
@dist = { :flavor => "ubuntu",
|
|
64
|
+
:package => "rhoconnect_#{Constants::RC_VERSION}_all.deb",
|
|
65
|
+
:local_file => "#{local_file}rhoconnect_#{Constants::RC_VERSION}_all.deb",
|
|
66
|
+
:pkg_mgr => 'dpkg',
|
|
67
|
+
:pkg_type => 'DEB',
|
|
68
|
+
:pkg_repo => 'apt-get',
|
|
69
|
+
:deps => Constants::DEB_DEPS,
|
|
70
70
|
:repo_src_file => '/etc/apt/sources.list',
|
|
71
|
-
:repo_str
|
|
72
|
-
'# This is the repository for rhoconnect packages\n' +
|
|
71
|
+
:repo_str => '\n' +
|
|
72
|
+
'# This is the repository for rhoconnect packages\n' +
|
|
73
73
|
"deb http://#{BUCKET}.s3.amazonaws.com/#{channel}/deb rhoconnect main" }
|
|
74
74
|
elsif @user == 'root'
|
|
75
|
-
@dist = { :flavor
|
|
76
|
-
:package
|
|
77
|
-
:local_file
|
|
78
|
-
:pkg_mgr
|
|
79
|
-
:pkg_type
|
|
80
|
-
:pkg_repo
|
|
81
|
-
:deps
|
|
75
|
+
@dist = { :flavor => "centos",
|
|
76
|
+
:package => "rhoconnect-#{Constants::RC_VERSION}.noarch.rpm",
|
|
77
|
+
:local_file => "#{local_file}rhoconnect-#{Constants::RC_VERSION}.noarch.rpm",
|
|
78
|
+
:pkg_mgr => 'rpm',
|
|
79
|
+
:pkg_type => 'RPM',
|
|
80
|
+
:pkg_repo => 'yum',
|
|
81
|
+
:deps => Constants::RPM_DEPS,
|
|
82
82
|
:repo_src_file => '/etc/yum.repos.d/rhoconnect.repo',
|
|
83
|
-
:repo_str
|
|
84
|
-
'name=Rhoconnect\n' +
|
|
83
|
+
:repo_str => '[rhoconnect]\n' +
|
|
84
|
+
'name=Rhoconnect\n' +
|
|
85
85
|
"baseurl=http://#{BUCKET}.s3.amazonaws.com/#{channel}/rpm" +
|
|
86
86
|
'\nenabled=1\n' +
|
|
87
87
|
'gpgcheck=0\n' }
|
|
@@ -112,9 +112,9 @@ end #get_access_keys
|
|
|
112
112
|
def make_fog
|
|
113
113
|
get_access_keys
|
|
114
114
|
@fog = Fog::Compute.new(
|
|
115
|
-
:provider
|
|
116
|
-
:region
|
|
117
|
-
:aws_access_key_id
|
|
115
|
+
:provider => 'AWS',
|
|
116
|
+
:region => Constants::REGION,
|
|
117
|
+
:aws_access_key_id => @access_key,
|
|
118
118
|
:aws_secret_access_key => @secret_access_key
|
|
119
119
|
)
|
|
120
120
|
end #make_fog
|
|
@@ -138,7 +138,7 @@ def start_new_instance
|
|
|
138
138
|
puts
|
|
139
139
|
|
|
140
140
|
# save important instance information
|
|
141
|
-
@host
|
|
141
|
+
@host = @server.dns_name
|
|
142
142
|
@server_id = @server.id
|
|
143
143
|
else
|
|
144
144
|
puts "Server timed out."
|
|
@@ -162,11 +162,11 @@ end #destroy_ec2_instance
|
|
|
162
162
|
# prepare_sources
|
|
163
163
|
# Prepares the remote machine's repo source list to be able to download rhoconnect
|
|
164
164
|
def prepare_sources
|
|
165
|
-
puts "preparing sources..."
|
|
165
|
+
puts "preparing sources..."
|
|
166
166
|
|
|
167
167
|
ssh_cmd "sudo touch #{@dist[:repo_src_file]}" if @dist[:flavor] == 'centos'
|
|
168
168
|
filename = @dist[:repo_src_file]
|
|
169
|
-
src_str
|
|
169
|
+
src_str = @dist[:repo_str]
|
|
170
170
|
|
|
171
171
|
# Create file for yum rhoconnect sources
|
|
172
172
|
# Get current permissions of file
|
|
@@ -186,7 +186,7 @@ end #prepare_sources
|
|
|
186
186
|
# Issues commands to the remote machine to start the installation
|
|
187
187
|
def install_package
|
|
188
188
|
prepare_sources
|
|
189
|
-
puts "Installing rhoconnect package.\n" +
|
|
189
|
+
puts "Installing rhoconnect package.\n" +
|
|
190
190
|
"This may take a while...\n\n"
|
|
191
191
|
ssh_cmd "yes | sudo #{@dist[:pkg_repo]} install rhoconnect"
|
|
192
192
|
end #install_package
|
|
@@ -197,7 +197,7 @@ def start_servers
|
|
|
197
197
|
max_attempts = 100
|
|
198
198
|
puts
|
|
199
199
|
|
|
200
|
-
['Redis', 'Nginx'].each do |program|
|
|
200
|
+
['Redis', 'Nginx', 'thin'].each do |program|
|
|
201
201
|
attempts = 0
|
|
202
202
|
while @ssh.run("pgrep #{program.downcase}")[0].stdout.strip == "" and
|
|
203
203
|
attempts < max_attempts
|
|
@@ -221,14 +221,15 @@ def check_rc_service
|
|
|
221
221
|
puts "Host: #{@host}"
|
|
222
222
|
|
|
223
223
|
puts "Checking RC service."
|
|
224
|
-
request = nil
|
|
224
|
+
request = nil #Defined outside block as to not limit the scope of request to the do block.
|
|
225
225
|
2.times do
|
|
226
226
|
request = Net::HTTP.get_response(@host, '/')
|
|
227
227
|
end #do
|
|
228
228
|
|
|
229
229
|
puts "Code: #{request.code} Message: #{request.message}"
|
|
230
230
|
|
|
231
|
-
if request.code == '200'
|
|
231
|
+
if request.code == '200' or
|
|
232
|
+
request.code == '302'
|
|
232
233
|
puts "Rhoconnect service up!"
|
|
233
234
|
else
|
|
234
235
|
puts "Failed to connect to rhoconnect service."
|
|
@@ -261,7 +262,7 @@ Constants::STACKS.each do |stack|
|
|
|
261
262
|
start_time = Time.now
|
|
262
263
|
|
|
263
264
|
begin
|
|
264
|
-
@stack = stack
|
|
265
|
+
@stack = stack
|
|
265
266
|
compile_stack_info
|
|
266
267
|
|
|
267
268
|
puts "\n" +
|
|
@@ -18,18 +18,20 @@ task "build:repos", :build_type, :build_number do |t, args|
|
|
|
18
18
|
|
|
19
19
|
# CONSTANTS
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
21
|
+
RHOCONNECT_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', '..'))
|
|
22
|
+
|
|
23
|
+
PKG_DIR = case build_type
|
|
24
|
+
when 'release'
|
|
25
|
+
'/packages'
|
|
26
|
+
when 'test'
|
|
27
|
+
'/test-packages'
|
|
28
|
+
when 'beta'
|
|
29
|
+
'/beta-packages'
|
|
30
|
+
else 'nightly'
|
|
31
|
+
'/nightly-packages'
|
|
32
|
+
end #case
|
|
33
|
+
|
|
34
|
+
BUCKET = 'rhoconnect'
|
|
33
35
|
|
|
34
36
|
def cmd(cmd)
|
|
35
37
|
puts cmd
|
|
@@ -70,6 +72,8 @@ task "build:repos", :build_type, :build_number do |t, args|
|
|
|
70
72
|
end #prepare_destination
|
|
71
73
|
|
|
72
74
|
def copy_files
|
|
75
|
+
# Move back into rhoconnect repo root first
|
|
76
|
+
Dir.chdir RHOCONNECT_ROOT
|
|
73
77
|
# Copy the packages to their respective directory
|
|
74
78
|
Find.find('./pkg') do |file|
|
|
75
79
|
if !FileTest.directory?(file)
|
|
@@ -88,25 +92,25 @@ task "build:repos", :build_type, :build_number do |t, args|
|
|
|
88
92
|
end #copy_files
|
|
89
93
|
|
|
90
94
|
prepare_destination
|
|
91
|
-
|
|
95
|
+
|
|
92
96
|
copy_files
|
|
93
97
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
98
|
+
# if build_type != "release" &&
|
|
99
|
+
# build_type != "test"
|
|
100
|
+
# # Change name of packages to include build number
|
|
101
|
+
# ['deb', 'rpm'].each do |arch|
|
|
102
|
+
# Find.find("#{PKG_DIR}") do |file|
|
|
103
|
+
# if !File.directory?(file) &&
|
|
104
|
+
# file =~ /#{arch}$/
|
|
105
|
+
# file_to_rename = File.open(file, 'r')
|
|
106
|
+
# old_name = File.expand_path(file)
|
|
107
|
+
# puts "Old Name:\t#{old_name}"
|
|
108
|
+
# new_name = old_name.gsub(/(#{arch})$/, "build-#{build_number.to_s}.\\1" )
|
|
109
|
+
# File.rename(old_name, new_name)
|
|
110
|
+
# end #if
|
|
111
|
+
# end #do
|
|
112
|
+
# end #do
|
|
113
|
+
# end #if
|
|
110
114
|
|
|
111
115
|
# REPOIFY!
|
|
112
116
|
cmd "sudo reprepro -b #{PKG_DIR}/deb includedeb rhoconnect #{PKG_DIR}/deb/#{@deb_pkg}"
|
|
@@ -121,4 +125,4 @@ task "build:repos", :build_type, :build_number do |t, args|
|
|
|
121
125
|
cmd "sudo ruby ./installer/utils/package_upload/s3_upload.rb #{PKG_DIR}/#{dir} #{BUCKET}"
|
|
122
126
|
end #do
|
|
123
127
|
cmd "sudo ruby ./installer/utils/package_upload/s3_upload.rb #{PKG_DIR}/SHA1 #{BUCKET}"
|
|
124
|
-
end #build:repos
|
|
128
|
+
end #build:repos
|
|
@@ -7,7 +7,7 @@ require 'find'
|
|
|
7
7
|
# CONSTANTS
|
|
8
8
|
|
|
9
9
|
START_DIR = ARGV[0]
|
|
10
|
-
BUCKET
|
|
10
|
+
BUCKET = ARGV[1]
|
|
11
11
|
USER_DATA = `wget -q -O - http://169.254.169.254/latest/user-data`.split("\n")
|
|
12
12
|
|
|
13
13
|
# METHODS
|
|
@@ -42,7 +42,7 @@ end #check_params
|
|
|
42
42
|
|
|
43
43
|
# Retrieves S3 credential information
|
|
44
44
|
def get_keys
|
|
45
|
-
access_key
|
|
45
|
+
access_key = USER_DATA[0].to_s.strip
|
|
46
46
|
secret_access_key = USER_DATA[1].to_s.strip
|
|
47
47
|
keys = { :access_key_id => access_key,
|
|
48
48
|
:secret_access_key => secret_access_key}
|
|
@@ -66,7 +66,7 @@ def upload(file)
|
|
|
66
66
|
end #upload
|
|
67
67
|
|
|
68
68
|
# Traverses list of file to upload and calls Upload to upload them
|
|
69
|
-
def upload_files
|
|
69
|
+
def upload_files
|
|
70
70
|
# Get list of files do be added
|
|
71
71
|
number_of_files = 0
|
|
72
72
|
paths = []
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Server.api :fast_delete, :source do |params,user|
|
|
2
|
+
source = Source.load(params[:source_id],{:app_id=>APP_NAME,:user_id=>params[:user_id]})
|
|
3
|
+
# if source does not exist create one for dynamic adapter
|
|
4
|
+
source = Source.create({:name => params[:source_id]},{:app_id => APP_NAME,:user_id=>params[:user_id]}) unless source
|
|
5
|
+
source_sync = SourceSync.new(source)
|
|
6
|
+
timeout = params[:timeout] || 10
|
|
7
|
+
raise_on_expire = params[:raise_on_expire] || false
|
|
8
|
+
source_sync.fast_delete(params[:data], timeout,raise_on_expire)
|
|
9
|
+
'done'
|
|
10
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Server.api :fast_insert, :source do |params,user|
|
|
2
|
+
source = Source.load(params[:source_id],{:app_id=>APP_NAME,:user_id=>params[:user_id]})
|
|
3
|
+
# if source does not exist create one for dynamic adapter
|
|
4
|
+
source = Source.create({:name => params[:source_id]},{:app_id => APP_NAME,:user_id=>params[:user_id]}) unless source
|
|
5
|
+
source_sync = SourceSync.new(source)
|
|
6
|
+
timeout = params[:timeout] || 10
|
|
7
|
+
raise_on_expire = params[:raise_on_expire] || false
|
|
8
|
+
source_sync.fast_insert(params[:data], timeout,raise_on_expire)
|
|
9
|
+
'done'
|
|
10
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Server.api :fast_update, :source do |params,user|
|
|
2
|
+
source = Source.load(params[:source_id],{:app_id=>APP_NAME,:user_id=>params[:user_id]})
|
|
3
|
+
# if source does not exist create one for dynamic adapter
|
|
4
|
+
source = Source.create({:name => params[:source_id]},{:app_id => APP_NAME,:user_id=>params[:user_id]}) unless source
|
|
5
|
+
source_sync = SourceSync.new(source)
|
|
6
|
+
timeout = params[:timeout] || 10
|
|
7
|
+
raise_on_expire = params[:raise_on_expire] || false
|
|
8
|
+
source_sync.fast_update(params[:delete_data], params[:data],timeout,raise_on_expire)
|
|
9
|
+
'done'
|
|
10
|
+
end
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Server.api :list_sources, :source do |params,user|
|
|
2
2
|
sources = App.load(APP_NAME).sources
|
|
3
|
-
if params[
|
|
3
|
+
if params['partition_type'].nil? or params['partition_type'] == 'all'
|
|
4
4
|
sources.to_json
|
|
5
5
|
else
|
|
6
6
|
res = []
|
|
7
7
|
sources.each do |name|
|
|
8
8
|
s = Source.load(name,{:app_id => APP_NAME,:user_id => '*'})
|
|
9
|
-
if s.partition_type and s.partition_type == params[
|
|
9
|
+
if s and s.partition_type and s.partition_type == params['partition_type'].to_sym
|
|
10
10
|
res << name
|
|
11
11
|
end
|
|
12
12
|
end
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
require 'rack/fiber_pool'
|
|
2
|
+
require 'async-rack'
|
|
3
|
+
require 'eventmachine'
|
|
4
|
+
|
|
5
|
+
module Rhoconnect
|
|
6
|
+
module Synchrony
|
|
7
|
+
def setup_sessions(builder)
|
|
8
|
+
options = {}
|
|
9
|
+
if settings.respond_to?(:fiberpool_size)
|
|
10
|
+
options[:size] = settings.fiberpool_size
|
|
11
|
+
end
|
|
12
|
+
options[:rescue_exception] = handle_exception
|
|
13
|
+
builder.use Rack::FiberPool, options unless test?
|
|
14
|
+
super
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def handle_exception
|
|
18
|
+
Proc.new do |env, e|
|
|
19
|
+
if settings.show_exceptions?
|
|
20
|
+
request = Sinatra::Request.new(env)
|
|
21
|
+
printer = Sinatra::ShowExceptions.new(proc{ raise e })
|
|
22
|
+
s, h, b = printer.call(env)
|
|
23
|
+
[s, h, b]
|
|
24
|
+
else
|
|
25
|
+
[500, {}, ""]
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
module AsyncHelpers
|
|
32
|
+
def self.included(klass)
|
|
33
|
+
(klass.instance_methods & self.instance_methods).each do |method|
|
|
34
|
+
klass.instance_eval{remove_method method.to_sym}
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def catch_all
|
|
39
|
+
res = nil
|
|
40
|
+
begin
|
|
41
|
+
res = catch(:halt) { yield }
|
|
42
|
+
rescue ApiException => ae
|
|
43
|
+
res = [ae.error_code, ae.message]
|
|
44
|
+
rescue Exception => e
|
|
45
|
+
log e.message + e.backtrace.join("\n")
|
|
46
|
+
res = [500, e.message]
|
|
47
|
+
end
|
|
48
|
+
res
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def execute_api_call(client_call = false)
|
|
52
|
+
f = Fiber.current
|
|
53
|
+
operation = proc {
|
|
54
|
+
if client_call or check_api_token
|
|
55
|
+
catch_all do
|
|
56
|
+
res = yield params, (client_call ? current_user : api_user), self
|
|
57
|
+
if params.has_key? :warning
|
|
58
|
+
Rhoconnect.log params[:warning]
|
|
59
|
+
response.headers['Warning'] = params[:warning]
|
|
60
|
+
end
|
|
61
|
+
res
|
|
62
|
+
end
|
|
63
|
+
else
|
|
64
|
+
[422, "No API token provided"]
|
|
65
|
+
end
|
|
66
|
+
}
|
|
67
|
+
result = nil
|
|
68
|
+
callback = proc { |proc_res| result = proc_res; f.resume }
|
|
69
|
+
|
|
70
|
+
EventMachine.defer operation, callback
|
|
71
|
+
Fiber.yield
|
|
72
|
+
# we can not throw exceptions across threads
|
|
73
|
+
# so we analyze it in the main thread after the
|
|
74
|
+
# request has been processed and if result
|
|
75
|
+
# has error code - then we throw :halt here
|
|
76
|
+
if Array === result and Fixnum === result.first
|
|
77
|
+
throw :halt, result
|
|
78
|
+
end
|
|
79
|
+
result
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
@@ -261,14 +261,14 @@ module Rhoconnect
|
|
|
261
261
|
raise ArgumentError.new(UNKNOWN_CLIENT) unless client
|
|
262
262
|
name = BulkData.get_name(partition,client.user_id)
|
|
263
263
|
data = BulkData.load(name)
|
|
264
|
-
|
|
264
|
+
|
|
265
265
|
sources = client.app.partition_sources(partition,client.user_id)
|
|
266
266
|
return {:result => :nop} if sources.length <= 0
|
|
267
|
-
|
|
267
|
+
|
|
268
268
|
do_bd_sync = data.nil?
|
|
269
269
|
do_bd_sync = (data.completed? and
|
|
270
270
|
(data.refresh_time <= Time.now.to_i or !data.dbfiles_exist?)) unless do_bd_sync
|
|
271
|
-
|
|
271
|
+
|
|
272
272
|
if do_bd_sync
|
|
273
273
|
data.delete if data
|
|
274
274
|
data = BulkData.create(:name => name,
|
|
@@ -281,6 +281,21 @@ module Rhoconnect
|
|
|
281
281
|
|
|
282
282
|
if data and data.completed? and data.dbfiles_exist?
|
|
283
283
|
client.update_clientdoc(sources)
|
|
284
|
+
sources.each do |src|
|
|
285
|
+
s = Source.load(src, {:user_id => client.user_id, :app_id => client.app_id})
|
|
286
|
+
errordoc = s.docname(:errors)
|
|
287
|
+
errors = {}
|
|
288
|
+
Store.lock(errordoc) do
|
|
289
|
+
errors = Store.get_data(errordoc)
|
|
290
|
+
end
|
|
291
|
+
unless errors.empty?
|
|
292
|
+
# FIXME: :result => :bulk_sync_error, :errors => "#{errors}"
|
|
293
|
+
log "Bulk sync errors are found in #{src}: #{errors}"
|
|
294
|
+
# Delete all related bulk files
|
|
295
|
+
data.delete_files
|
|
296
|
+
return {:result => :url, :url => ''}
|
|
297
|
+
end
|
|
298
|
+
end
|
|
284
299
|
{:result => :url, :url => data.url}
|
|
285
300
|
elsif data
|
|
286
301
|
{:result => :wait}
|
|
@@ -29,7 +29,7 @@ module RhoconnectApi
|
|
|
29
29
|
Server.save_adapter({:attributes => {'adapter_url' => adapter_url}},nil)
|
|
30
30
|
else
|
|
31
31
|
RestClient.post("#{server}/api/source/save_adapter",
|
|
32
|
-
{:api_token => token,:
|
|
32
|
+
{:api_token => token,:adapter_url => adapter_url}.to_json,
|
|
33
33
|
:content_type => :json)
|
|
34
34
|
end
|
|
35
35
|
end
|
|
@@ -37,7 +37,7 @@ module RhoconnectApi
|
|
|
37
37
|
def create_user(server,token,login,password)
|
|
38
38
|
if directcall?(server) and verify_token(token)
|
|
39
39
|
Server.create_user({:attributes => {'login' => login, 'password' => password}},nil)
|
|
40
|
-
else
|
|
40
|
+
else
|
|
41
41
|
RestClient.post("#{server}/api/user/create_user",
|
|
42
42
|
{:api_token => token,:attributes => {:login => login, :password => password}}.to_json,
|
|
43
43
|
:content_type => :json)
|
|
@@ -1,32 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
require '
|
|
3
|
-
|
|
4
|
-
require '
|
|
5
|
-
require '
|
|
6
|
-
require 'rhoconnect_api'
|
|
7
|
-
|
|
8
|
-
module RhoconnectConsole
|
|
9
|
-
class << self
|
|
10
|
-
ROOT_DIR = File.dirname(File.expand_path(__FILE__)) unless defined? ROOT_DIR
|
|
11
|
-
def root_path(*args)
|
|
12
|
-
File.join(ROOT_DIR, *args)
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
class Server < Sinatra::Base
|
|
17
|
-
set :views, RhoconnectConsole::root_path("app","views")
|
|
18
|
-
set :public_folder, RhoconnectConsole::root_path("app","public")
|
|
19
|
-
set :static, true
|
|
20
|
-
use Rack::Session::Cookie
|
|
21
|
-
HEROKU_NAV = ENV['INSTANCE_ID'] ? RestClient.get('http://nav.heroku.com/v1/providers/header') : nil
|
|
22
|
-
before do
|
|
23
|
-
headers['Expires'] = 'Sun, 19 Nov 1978 05:00:00 GMT'
|
|
24
|
-
headers['Cache-Control'] = 'no-store, no-cache, must-revalidate'
|
|
25
|
-
headers['Pragma'] = 'no-cache'
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
Dir[File.join(File.dirname(__FILE__),"app/**/*.rb")].each do |file|
|
|
31
|
-
require file
|
|
32
|
-
end
|
|
1
|
+
puts "\nDEPRECATION WARNING: 'rhoconnect/console/server' will be removed in 4.0. Please change your config.ru:\n\n"
|
|
2
|
+
puts "require 'rhoconnect/console/server'"
|
|
3
|
+
puts "\nto the following:\n\n"
|
|
4
|
+
puts "require 'rhoconnect/web-console/server'\n\n"
|
|
5
|
+
require 'rhoconnect/web-console/server'
|
data/lib/rhoconnect/console.rb
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
path = File.join(File.dirname(__FILE__),'..'
|
|
1
|
+
path = File.join(File.dirname(__FILE__), '..')
|
|
2
2
|
$:.unshift path
|
|
3
|
-
ROOT_PATH =
|
|
3
|
+
ROOT_PATH = Dir.pwd
|