From 14d53b3386296eb9b4d25c91cd9d40a5dfb52b75 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Tue, 14 Jan 2020 15:43:08 -0500 Subject: [PATCH] Clean up Gemfile & Gemfile.lock refs #16010 Arvados-DCO-1.1-Signed-off-by: Peter Amstutz --- services/api/Gemfile | 9 +- services/api/Gemfile.lock | 31 ++---- services/api/app/middlewares/rack_socket.rb | 102 -------------------- services/login-sync/Gemfile.lock | 2 +- 4 files changed, 10 insertions(+), 134 deletions(-) delete mode 100644 services/api/app/middlewares/rack_socket.rb diff --git a/services/api/Gemfile b/services/api/Gemfile index 52a225c237..2d75a1a2a1 100644 --- a/services/api/Gemfile +++ b/services/api/Gemfile @@ -51,16 +51,11 @@ gem 'omniauth-oauth2', '~> 1.1' gem 'andand' gem 'optimist' -gem 'faye-websocket' gem 'themes_for_rails', git: 'https://github.com/arvados/themes_for_rails' -# We need arvados-cli because of crunchv1. Note: bundler can't handle -# two gems with the same "git" url but different "glob" values, hence -# the use of a wildcard here instead of literal paths -# (sdk/cli/arvados-cli.gem and sdk/ruby/arvados.gem). -gem 'arvados-cli', git: 'https://github.com/arvados/arvados.git', glob: 'sdk/*/*.gemspec' -gem 'arvados', git: 'https://github.com/arvados/arvados.git', glob: 'sdk/*/*.gemspec' +# Import arvados gem. Note: actual git commit is pinned via Gemfile.lock +gem 'arvados', git: 'https://github.com/arvados/arvados.git', glob: 'sdk/ruby/arvados.gem' gem 'httpclient' gem 'sshkey' diff --git a/services/api/Gemfile.lock b/services/api/Gemfile.lock index 0057e60904..582b730556 100644 --- a/services/api/Gemfile.lock +++ b/services/api/Gemfile.lock @@ -1,9 +1,9 @@ GIT remote: https://github.com/arvados/arvados.git - revision: dd9f2403f43bcb93da5908ddde57d8c0491bb4c2 + revision: 0503f58f3f9b78bd803d4fd7544ced9d79e26f1c glob: sdk/*/*.gemspec specs: - arvados (1.4.2.20191019025325) + arvados (1.5.0.pre20200114202620) activesupport (>= 3) andand (~> 1.3, >= 1.3.3) arvados-google-api-client (>= 0.7, < 0.8.9) @@ -11,16 +11,6 @@ GIT i18n (~> 0) json (>= 1.7.7, < 3) jwt (>= 0.1.5, < 2) - arvados-cli (1.4.2.20191017145711) - activesupport (>= 3.2.13, < 5.1) - andand (~> 1.3, >= 1.3.3) - arvados (>= 1.4.1.20190320201707) - arvados-google-api-client (~> 0.6, >= 0.6.3, < 0.8.9) - curb (~> 0.8) - faraday (< 0.16) - json (>= 1.7.7, < 3) - oj (~> 3.0) - optimist (~> 3.0) GIT remote: https://github.com/arvados/themes_for_rails @@ -102,10 +92,8 @@ GEM net-ssh-gateway (>= 1.1.0) concurrent-ruby (1.1.5) crass (1.0.4) - curb (0.9.10) database_cleaner (1.7.0) erubis (2.7.0) - eventmachine (1.2.7) execjs (2.7.0) extlib (0.9.16) factory_bot (5.0.2) @@ -115,9 +103,6 @@ GEM railties (>= 4.2.0) faraday (0.15.4) multipart-post (>= 1.2, < 3) - faye-websocket (0.10.7) - eventmachine (>= 0.12.0) - websocket-driver (>= 0.5.1) ffi (1.9.25) globalid (0.4.2) activesupport (>= 4.2.0) @@ -137,7 +122,7 @@ GEM rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - json (2.2.0) + json (2.3.0) jwt (1.5.6) launchy (2.4.3) addressable (~> 2.3) @@ -153,7 +138,7 @@ GEM nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) - memoist (0.16.0) + memoist (0.16.2) metaclass (0.0.4) method_source (0.9.2) mini_mime (1.0.1) @@ -194,7 +179,7 @@ GEM rake (>= 0.8.1) pg (1.1.4) power_assert (1.1.4) - public_suffix (4.0.1) + public_suffix (4.0.3) rack (2.0.7) rack-test (0.6.3) rack (>= 1.0) @@ -281,7 +266,7 @@ GEM thor (0.20.3) thread_safe (0.3.6) tilt (2.0.8) - tzinfo (1.2.5) + tzinfo (1.2.6) thread_safe (~> 0.1) uglifier (2.7.2) execjs (>= 0.3.0) @@ -297,11 +282,9 @@ DEPENDENCIES acts_as_api andand arvados! - arvados-cli! byebug database_cleaner factory_bot_rails - faye-websocket httpclient jquery-rails lograge @@ -334,4 +317,4 @@ DEPENDENCIES uglifier (~> 2.0) BUNDLED WITH - 1.17.3 + 2.0.2 diff --git a/services/api/app/middlewares/rack_socket.rb b/services/api/app/middlewares/rack_socket.rb deleted file mode 100644 index 1b301e27ab..0000000000 --- a/services/api/app/middlewares/rack_socket.rb +++ /dev/null @@ -1,102 +0,0 @@ -# Copyright (C) The Arvados Authors. All rights reserved. -# -# SPDX-License-Identifier: AGPL-3.0 - -require 'rack' -require 'faye/websocket' -require 'eventmachine' - -# A Rack middleware to handle inbound websocket connection requests and hand -# them over to the faye websocket library. -class RackSocket - - DEFAULT_ENDPOINT = '/websocket' - - # Stop EventMachine on signal, this should give it a chance to to unwind any - # open connections. - def die_gracefully_on_signal - Signal.trap("INT") { EM.stop } - Signal.trap("TERM") { EM.stop } - end - - # Create a new RackSocket handler - # +app+ The next layer of the Rack stack. - # - # Accepts options: - # +:handler+ (Required) A class to handle new connections. #initialize will - # call handler.new to create the actual handler instance object. When a new - # websocket connection is established, #on_connect on the handler instance - # object will be called with the new connection. - # - # +:mount+ The HTTP request path that will be recognized for websocket - # connect requests, defaults to '/websocket'. - # - # +:websocket_only+ If true, the server will only handle websocket requests, - # and all other requests will result in an error. If false, unhandled - # non-websocket requests will be passed along on to 'app' in the usual Rack - # way. - def initialize(app = nil, options = nil) - @app = app if app.respond_to?(:call) - @options = [app, options].grep(Hash).first || {} - @endpoint = @options[:mount] || DEFAULT_ENDPOINT - @websocket_only = @options[:websocket_only] || false - - # from https://gist.github.com/eatenbyagrue/1338545#file-eventmachine-rb - if defined?(PhusionPassenger) - PhusionPassenger.on_event(:starting_worker_process) do |forked| - # for passenger, we need to avoid orphaned threads - if forked && EM.reactor_running? - EM.stop - end - Thread.new do - begin - EM.run - ensure - ActiveRecord::Base.connection.close - end - end - die_gracefully_on_signal - end - else - # faciliates debugging - Thread.abort_on_exception = true - # just spawn a thread and start it up - Thread.new do - begin - EM.run - ensure - ActiveRecord::Base.connection.close - end - end - end - - # Create actual handler instance object from handler class. - @handler = @options[:handler].new - end - - # Handle websocket connection request, or pass on to the next middleware - # supplied in +app+ initialize (unless +:websocket_only+ option is true, in - # which case return an error response.) - # +env+ the Rack environment with information about the request. - def call env - request = Rack::Request.new(env) - if request.path_info == @endpoint and Faye::WebSocket.websocket?(env) - if @handler.overloaded? - return [503, {"Content-Type" => "text/plain"}, ["Too many connections, try again later."]] - end - - ws = Faye::WebSocket.new(env, nil, :ping => 30) - - # Notify handler about new connection - @handler.on_connect ws - - # Return async Rack response - ws.rack_response - elsif not @websocket_only - @app.call env - else - [406, {"Content-Type" => "text/plain"}, ["Only websocket connections are permitted on this port."]] - end - end - -end diff --git a/services/login-sync/Gemfile.lock b/services/login-sync/Gemfile.lock index ce648a2fc9..7e6ee2b5b3 100644 --- a/services/login-sync/Gemfile.lock +++ b/services/login-sync/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - arvados-login-sync (1.5.0.pre20191230153247) + arvados-login-sync (1.5.0.pre20200114202620) arvados (~> 1.3.0, >= 1.3.0) faraday (< 0.16) signet (< 0.12) -- 2.30.2