[ARVADOS] created: 1.3.0-548-g3cc37a0ba
Git user
git at public.curoverse.com
Fri Mar 22 12:47:26 UTC 2019
at 3cc37a0ba2c572731ef998a7f5724294c9415fdb (commit)
commit 3cc37a0ba2c572731ef998a7f5724294c9415fdb
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date: Fri Mar 22 09:42:44 2019 -0300
14873: Rails 5 upgrade. Some tests still failing. (WIP)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>
diff --git a/services/api/Gemfile b/services/api/Gemfile
index c91495d8f..62beda057 100644
--- a/services/api/Gemfile
+++ b/services/api/Gemfile
@@ -4,7 +4,7 @@
source 'https://rubygems.org'
-gem 'rails', '~> 4.2'
+gem 'rails', '~> 5.0.0'
gem 'responders', '~> 2.0'
group :test, :development do
@@ -31,9 +31,6 @@ gem 'pg', '~> 0.18'
gem 'multi_json'
gem 'oj'
-# for building assets
-gem 'sass-rails', '~> 4.0'
-gem 'coffee-rails', '~> 4.0'
gem 'therubyracer'
gem 'uglifier', '~> 2.0'
@@ -45,14 +42,15 @@ gem 'acts_as_api'
gem 'passenger'
+# Locking to 5.10.3 to workaround issue in 5.11.1 (https://github.com/seattlerb/minitest/issues/730)
+gem 'minitest', '5.10.3'
+
# Restricted because omniauth >= 1.5.0 requires Ruby >= 2.1.9:
gem 'omniauth', '~> 1.4.0'
gem 'omniauth-oauth2', '~> 1.1'
gem 'andand'
-gem 'test_after_commit', :group => :test
-
gem 'trollop'
gem 'faye-websocket'
@@ -68,6 +66,9 @@ gem 'logstash-event'
gem 'rails-observers'
+gem 'rails-perftest'
+gem 'rails-controller-testing'
+
# Install any plugin gems
Dir.glob(File.join(File.dirname(__FILE__), 'lib', '**', "Gemfile")) do |f|
eval(IO.read(f), binding)
diff --git a/services/api/Gemfile.lock b/services/api/Gemfile.lock
index ad76a2ffb..e9a41861b 100644
--- a/services/api/Gemfile.lock
+++ b/services/api/Gemfile.lock
@@ -8,39 +8,42 @@ GIT
GEM
remote: https://rubygems.org/
specs:
- actionmailer (4.2.11)
- actionpack (= 4.2.11)
- actionview (= 4.2.11)
- activejob (= 4.2.11)
+ actioncable (5.0.7.2)
+ actionpack (= 5.0.7.2)
+ nio4r (>= 1.2, < 3.0)
+ websocket-driver (~> 0.6.1)
+ actionmailer (5.0.7.2)
+ actionpack (= 5.0.7.2)
+ actionview (= 5.0.7.2)
+ activejob (= 5.0.7.2)
mail (~> 2.5, >= 2.5.4)
- rails-dom-testing (~> 1.0, >= 1.0.5)
- actionpack (4.2.11)
- actionview (= 4.2.11)
- activesupport (= 4.2.11)
- rack (~> 1.6)
- rack-test (~> 0.6.2)
- rails-dom-testing (~> 1.0, >= 1.0.5)
+ rails-dom-testing (~> 2.0)
+ actionpack (5.0.7.2)
+ actionview (= 5.0.7.2)
+ activesupport (= 5.0.7.2)
+ rack (~> 2.0)
+ rack-test (~> 0.6.3)
+ rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
- actionview (4.2.11)
- activesupport (= 4.2.11)
+ actionview (5.0.7.2)
+ activesupport (= 5.0.7.2)
builder (~> 3.1)
erubis (~> 2.7.0)
- rails-dom-testing (~> 1.0, >= 1.0.5)
+ rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
- activejob (4.2.11)
- activesupport (= 4.2.11)
- globalid (>= 0.3.0)
- activemodel (4.2.11)
- activesupport (= 4.2.11)
- builder (~> 3.1)
- activerecord (4.2.11)
- activemodel (= 4.2.11)
- activesupport (= 4.2.11)
- arel (~> 6.0)
- activesupport (4.2.11)
- i18n (~> 0.7)
+ activejob (5.0.7.2)
+ activesupport (= 5.0.7.2)
+ globalid (>= 0.3.6)
+ activemodel (5.0.7.2)
+ activesupport (= 5.0.7.2)
+ activerecord (5.0.7.2)
+ activemodel (= 5.0.7.2)
+ activesupport (= 5.0.7.2)
+ arel (~> 7.0)
+ activesupport (5.0.7.2)
+ concurrent-ruby (~> 1.0, >= 1.0.2)
+ i18n (>= 0.7, < 2)
minitest (~> 5.1)
- thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
acts_as_api (1.0.1)
activemodel (>= 3.0.0)
@@ -49,23 +52,34 @@ GEM
addressable (2.6.0)
public_suffix (>= 2.0.2, < 4.0)
andand (1.3.3)
- arel (6.0.4)
- arvados (1.3.1.20190301212059)
+ arel (7.1.4)
+ arvados (1.3.1.20190320201707)
activesupport (>= 3)
andand (~> 1.3, >= 1.3.3)
- cure-google-api-client (>= 0.7, < 0.8.9)
+ arvados-google-api-client (>= 0.7, < 0.8.9)
i18n (~> 0)
json (>= 1.7.7, < 3)
jwt (>= 0.1.5, < 2)
- arvados-cli (1.3.1.20190211211047)
- activesupport (>= 3.2.13, < 5)
+ arvados-cli (1.3.1.20190320201707)
+ activesupport (>= 3.2.13, < 5.1)
andand (~> 1.3, >= 1.3.3)
arvados (~> 1.3.0, >= 1.3.0)
+ arvados-google-api-client (~> 0.6, >= 0.6.3, < 0.8.9)
curb (~> 0.8)
- cure-google-api-client (~> 0.6, >= 0.6.3, < 0.8.9)
json (>= 1.7.7, < 3)
oj (~> 3.0)
optimist (~> 3.0)
+ arvados-google-api-client (0.8.7.2)
+ activesupport (>= 3.2, < 5.1)
+ addressable (~> 2.3)
+ autoparse (~> 0.3)
+ extlib (~> 0.9)
+ faraday (~> 0.9)
+ googleauth (~> 0.3)
+ launchy (~> 2.4)
+ multi_json (~> 1.10)
+ retriable (~> 1.4)
+ signet (~> 0.6)
autoparse (0.3.3)
addressable (>= 2.3.1)
extlib (>= 0.9.15)
@@ -77,43 +91,25 @@ GEM
net-sftp (>= 2.0.0)
net-ssh (>= 2.0.14)
net-ssh-gateway (>= 1.1.0)
- coffee-rails (4.2.2)
- coffee-script (>= 2.2.0)
- railties (>= 4.0.0)
- coffee-script (2.4.1)
- coffee-script-source
- execjs
- coffee-script-source (1.12.2)
- concurrent-ruby (1.1.4)
+ concurrent-ruby (1.1.5)
crass (1.0.4)
- curb (0.9.8)
- cure-google-api-client (0.8.7.1)
- activesupport (>= 3.2, < 5.0)
- addressable (~> 2.3)
- autoparse (~> 0.3)
- extlib (~> 0.9)
- faraday (~> 0.9)
- googleauth (~> 0.3)
- launchy (~> 2.4)
- multi_json (~> 1.10)
- retriable (~> 1.4)
- signet (~> 0.6)
+ curb (0.9.9)
database_cleaner (1.7.0)
erubis (2.7.0)
- eventmachine (1.2.6)
+ eventmachine (1.2.7)
execjs (2.7.0)
extlib (0.9.16)
- factory_bot (4.11.1)
- activesupport (>= 3.0.0)
- factory_bot_rails (4.11.1)
- factory_bot (~> 4.11.1)
- railties (>= 3.0.0)
- faraday (0.12.2)
+ factory_bot (5.0.2)
+ activesupport (>= 4.2.0)
+ factory_bot_rails (5.0.1)
+ factory_bot (~> 5.0.0)
+ 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)
- globalid (0.4.1)
+ globalid (0.4.2)
activesupport (>= 4.2.0)
googleauth (0.8.0)
faraday (~> 0.12)
@@ -122,9 +118,8 @@ GEM
multi_json (~> 1.11)
os (>= 0.9, < 2.0)
signet (~> 0.7)
- hashie (3.5.7)
- highline (1.7.10)
- hike (1.2.3)
+ hashie (3.6.0)
+ highline (2.0.1)
httpclient (2.8.3)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
@@ -150,30 +145,32 @@ GEM
mini_mime (>= 0.1.1)
memoist (0.16.0)
metaclass (0.0.4)
+ method_source (0.9.2)
mini_mime (1.0.1)
mini_portile2 (2.4.0)
- minitest (5.11.3)
- mocha (1.5.0)
+ minitest (5.10.3)
+ mocha (1.8.0)
metaclass (~> 0.0.1)
multi_json (1.13.1)
multi_xml (0.6.0)
multipart-post (2.0.0)
- net-scp (1.2.1)
- net-ssh (>= 2.6.5)
+ net-scp (2.0.0)
+ net-ssh (>= 2.6.5, < 6.0.0)
net-sftp (2.1.2)
net-ssh (>= 2.6.5)
- net-ssh (4.2.0)
+ net-ssh (5.2.0)
net-ssh-gateway (2.0.0)
net-ssh (>= 4.0.0)
- nokogiri (1.9.1)
+ nio4r (2.3.1)
+ nokogiri (1.10.1)
mini_portile2 (~> 2.4.0)
- oauth2 (1.4.0)
- faraday (>= 0.8, < 0.13)
- jwt (~> 1.0)
+ oauth2 (1.4.1)
+ faraday (>= 0.8, < 0.16.0)
+ jwt (>= 1.0, < 3.0)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
- oj (3.7.9)
+ oj (3.7.11)
omniauth (1.4.3)
hashie (>= 1.2, < 4)
rack (>= 1.6.2, < 3)
@@ -182,59 +179,57 @@ GEM
omniauth (~> 1.2)
optimist (3.0.0)
os (1.0.0)
- passenger (5.3.0)
+ passenger (6.0.2)
rack
rake (>= 0.8.1)
pg (0.21.0)
- power_assert (1.1.1)
+ power_assert (1.1.3)
public_suffix (3.0.3)
- rack (1.6.11)
+ rack (2.0.6)
rack-test (0.6.3)
rack (>= 1.0)
- rails (4.2.11)
- actionmailer (= 4.2.11)
- actionpack (= 4.2.11)
- actionview (= 4.2.11)
- activejob (= 4.2.11)
- activemodel (= 4.2.11)
- activerecord (= 4.2.11)
- activesupport (= 4.2.11)
- bundler (>= 1.3.0, < 2.0)
- railties (= 4.2.11)
- sprockets-rails
- rails-deprecated_sanitizer (1.0.3)
- activesupport (>= 4.2.0.alpha)
- rails-dom-testing (1.0.9)
- activesupport (>= 4.2.0, < 5.0)
- nokogiri (~> 1.6)
- rails-deprecated_sanitizer (>= 1.0.1)
+ rails (5.0.7.2)
+ actioncable (= 5.0.7.2)
+ actionmailer (= 5.0.7.2)
+ actionpack (= 5.0.7.2)
+ actionview (= 5.0.7.2)
+ activejob (= 5.0.7.2)
+ activemodel (= 5.0.7.2)
+ activerecord (= 5.0.7.2)
+ activesupport (= 5.0.7.2)
+ bundler (>= 1.3.0)
+ railties (= 5.0.7.2)
+ sprockets-rails (>= 2.0.0)
+ rails-controller-testing (1.0.4)
+ actionpack (>= 5.0.1.x)
+ actionview (>= 5.0.1.x)
+ activesupport (>= 5.0.1.x)
+ rails-dom-testing (2.0.3)
+ activesupport (>= 4.2.0)
+ nokogiri (>= 1.6)
rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2)
rails-observers (0.1.5)
activemodel (>= 4.0)
- railties (4.2.11)
- actionpack (= 4.2.11)
- activesupport (= 4.2.11)
+ rails-perftest (0.0.7)
+ railties (5.0.7.2)
+ actionpack (= 5.0.7.2)
+ activesupport (= 5.0.7.2)
+ method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (12.3.2)
ref (2.0.0)
request_store (1.4.1)
rack (>= 1.4)
- responders (2.4.0)
- actionpack (>= 4.2.0, < 5.3)
- railties (>= 4.2.0, < 5.3)
+ responders (2.4.1)
+ actionpack (>= 4.2.0, < 6.0)
+ railties (>= 4.2.0, < 6.0)
retriable (1.4.1)
ruby-prof (0.17.0)
rvm-capistrano (1.5.6)
capistrano (~> 2.15.4)
- safe_yaml (1.0.4)
- sass (3.2.19)
- sass-rails (4.0.5)
- railties (>= 4.0.0, < 5.0)
- sass (~> 3.2.2)
- sprockets (~> 2.8, < 3.0)
- sprockets-rails (~> 2.0)
+ safe_yaml (1.0.5)
signet (0.11.0)
addressable (~> 2.3)
faraday (~> 0.9)
@@ -246,33 +241,28 @@ GEM
simplecov-html (0.7.1)
simplecov-rcov (0.2.3)
simplecov (>= 0.4.1)
- sprockets (2.12.5)
- hike (~> 1.2)
- multi_json (~> 1.0)
- rack (~> 1.0)
- tilt (~> 1.1, != 1.3.0)
- sprockets-rails (2.3.3)
- actionpack (>= 3.0)
- activesupport (>= 3.0)
- sprockets (>= 2.8, < 4.0)
- sshkey (1.9.0)
- test-unit (3.2.7)
+ sprockets (3.7.2)
+ concurrent-ruby (~> 1.0)
+ rack (> 1, < 3)
+ sprockets-rails (3.2.1)
+ actionpack (>= 4.0)
+ activesupport (>= 4.0)
+ sprockets (>= 3.0.0)
+ sshkey (2.0.0)
+ test-unit (3.3.0)
power_assert
- test_after_commit (1.1.0)
- activerecord (>= 3.2)
therubyracer (0.12.3)
libv8 (~> 3.16.14.15)
ref
thor (0.20.3)
thread_safe (0.3.6)
- tilt (1.4.1)
trollop (2.9.9)
tzinfo (1.2.5)
thread_safe (~> 0.1)
uglifier (2.7.2)
execjs (>= 0.3.0)
json (>= 1.8.0)
- websocket-driver (0.7.0)
+ websocket-driver (0.6.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
@@ -284,7 +274,6 @@ DEPENDENCIES
andand
arvados (>= 1.3.1.20190301212059)
arvados-cli
- coffee-rails (~> 4.0)
database_cleaner
factory_bot_rails
faye-websocket
@@ -292,6 +281,7 @@ DEPENDENCIES
jquery-rails
lograge
logstash-event
+ minitest (= 5.10.3)
mocha
multi_json
oj
@@ -299,22 +289,22 @@ DEPENDENCIES
omniauth-oauth2 (~> 1.1)
passenger
pg (~> 0.18)
- rails (~> 4.2)
+ rails (~> 5.0.0)
+ rails-controller-testing
rails-observers
+ rails-perftest
responders (~> 2.0)
ruby-prof
rvm-capistrano
safe_yaml
- sass-rails (~> 4.0)
simplecov (~> 0.7.1)
simplecov-rcov
sshkey
test-unit (~> 3.0)
- test_after_commit
themes_for_rails!
therubyracer
trollop
uglifier (~> 2.0)
BUNDLED WITH
- 1.17.2
+ 1.17.3
diff --git a/services/api/Rakefile b/services/api/Rakefile
index 3de2d273b..70ceb653e 100644
--- a/services/api/Rakefile
+++ b/services/api/Rakefile
@@ -7,6 +7,7 @@
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
+require 'rake/testtask'
Server::Application.load_tasks
diff --git a/services/api/app/models/arvados_model.rb b/services/api/app/models/arvados_model.rb
index 3d6e15025..2fe4cec4c 100644
--- a/services/api/app/models/arvados_model.rb
+++ b/services/api/app/models/arvados_model.rb
@@ -119,7 +119,7 @@ class ArvadosModel < ActiveRecord::Base
end
def initialize raw_params={}, *args
- super(self.class.permit_attribute_params(raw_params), *args)
+ super(self.class.permit_attribute_params(raw_params.to_hash), *args)
end
# Reload "old attributes" for logging, too.
diff --git a/services/api/bin/bundle b/services/api/bin/bundle
new file mode 100755
index 000000000..66e9889e8
--- /dev/null
+++ b/services/api/bin/bundle
@@ -0,0 +1,3 @@
+#!/usr/bin/env ruby
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+load Gem.bin_path('bundler', 'bundle')
diff --git a/services/api/bin/rails b/services/api/bin/rails
new file mode 100755
index 000000000..073966023
--- /dev/null
+++ b/services/api/bin/rails
@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby
+APP_PATH = File.expand_path('../config/application', __dir__)
+require_relative '../config/boot'
+require 'rails/commands'
diff --git a/services/api/bin/rake b/services/api/bin/rake
new file mode 100755
index 000000000..17240489f
--- /dev/null
+++ b/services/api/bin/rake
@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby
+require_relative '../config/boot'
+require 'rake'
+Rake.application.run
diff --git a/services/api/bin/setup b/services/api/bin/setup
new file mode 100755
index 000000000..e620b4dad
--- /dev/null
+++ b/services/api/bin/setup
@@ -0,0 +1,34 @@
+#!/usr/bin/env ruby
+require 'pathname'
+require 'fileutils'
+include FileUtils
+
+# path to your application root.
+APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+
+def system!(*args)
+ system(*args) || abort("\n== Command #{args} failed ==")
+end
+
+chdir APP_ROOT do
+ # This script is a starting point to setup your application.
+ # Add necessary setup steps to this file.
+
+ puts '== Installing dependencies =='
+ system! 'gem install bundler --conservative'
+ system('bundle check') || system!('bundle install')
+
+ # puts "\n== Copying sample files =="
+ # unless File.exist?('config/database.yml')
+ # cp 'config/database.yml.sample', 'config/database.yml'
+ # end
+
+ puts "\n== Preparing database =="
+ system! 'bin/rails db:setup'
+
+ puts "\n== Removing old logs and tempfiles =="
+ system! 'bin/rails log:clear tmp:clear'
+
+ puts "\n== Restarting application server =="
+ system! 'bin/rails restart'
+end
diff --git a/services/api/bin/update b/services/api/bin/update
new file mode 100755
index 000000000..a8e4462f2
--- /dev/null
+++ b/services/api/bin/update
@@ -0,0 +1,29 @@
+#!/usr/bin/env ruby
+require 'pathname'
+require 'fileutils'
+include FileUtils
+
+# path to your application root.
+APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+
+def system!(*args)
+ system(*args) || abort("\n== Command #{args} failed ==")
+end
+
+chdir APP_ROOT do
+ # This script is a way to update your development environment automatically.
+ # Add necessary update steps to this file.
+
+ puts '== Installing dependencies =='
+ system! 'gem install bundler --conservative'
+ system('bundle check') || system!('bundle install')
+
+ puts "\n== Updating database =="
+ system! 'bin/rails db:migrate'
+
+ puts "\n== Removing old logs and tempfiles =="
+ system! 'bin/rails log:clear tmp:clear'
+
+ puts "\n== Restarting application server =="
+ system! 'bin/rails restart'
+end
diff --git a/services/api/config/application.default.yml b/services/api/config/application.default.yml
index 8f0dbf4e4..b9e4638f2 100644
--- a/services/api/config/application.default.yml
+++ b/services/api/config/application.default.yml
@@ -559,8 +559,10 @@ production:
test:
force_ssl: false
cache_classes: true
- serve_static_files: true
- static_cache_control: public, max-age=3600
+ public_file_server:
+ enabled: true
+ headers:
+ 'Cache-Control': public, max-age=3600
whiny_nils: true
consider_all_requests_local: true
action_controller.perform_caching: false
diff --git a/services/api/config/boot.rb b/services/api/config/boot.rb
index c70ab9591..717101c2b 100644
--- a/services/api/config/boot.rb
+++ b/services/api/config/boot.rb
@@ -2,9 +2,7 @@
#
# SPDX-License-Identifier: AGPL-3.0
-require 'rubygems'
-
# Set up gems listed in the Gemfile.
-ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
-require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
+require 'bundler/setup'
diff --git a/services/api/config/cable.yml b/services/api/config/cable.yml
new file mode 100644
index 000000000..0bbde6f74
--- /dev/null
+++ b/services/api/config/cable.yml
@@ -0,0 +1,9 @@
+development:
+ adapter: async
+
+test:
+ adapter: async
+
+production:
+ adapter: redis
+ url: redis://localhost:6379/1
diff --git a/services/api/config/environment.rb b/services/api/config/environment.rb
index e24eee035..b82ba27f9 100644
--- a/services/api/config/environment.rb
+++ b/services/api/config/environment.rb
@@ -3,8 +3,8 @@
# SPDX-License-Identifier: AGPL-3.0
# Load the rails application
-require File.expand_path('../application', __FILE__)
+require_relative 'application'
require 'josh_id'
# Initialize the rails application
-Server::Application.initialize!
+Rails.application.initialize!
diff --git a/services/api/config/initializers/application_controller_renderer.rb b/services/api/config/initializers/application_controller_renderer.rb
new file mode 100644
index 000000000..89d2efab2
--- /dev/null
+++ b/services/api/config/initializers/application_controller_renderer.rb
@@ -0,0 +1,8 @@
+# Be sure to restart your server when you modify this file.
+
+# ActiveSupport::Reloader.to_prepare do
+# ApplicationController.renderer.defaults.merge!(
+# http_host: 'example.org',
+# https: false
+# )
+# end
diff --git a/services/api/config/initializers/assets.rb b/services/api/config/initializers/assets.rb
new file mode 100644
index 000000000..01ef3e663
--- /dev/null
+++ b/services/api/config/initializers/assets.rb
@@ -0,0 +1,11 @@
+# Be sure to restart your server when you modify this file.
+
+# Version of your assets, change this if you want to expire all your assets.
+Rails.application.config.assets.version = '1.0'
+
+# Add additional assets to the asset load path
+# Rails.application.config.assets.paths << Emoji.images_path
+
+# Precompile additional assets.
+# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
+# Rails.application.config.assets.precompile += %w( search.js )
diff --git a/services/api/config/initializers/cookies_serializer.rb b/services/api/config/initializers/cookies_serializer.rb
new file mode 100644
index 000000000..1389e86a3
--- /dev/null
+++ b/services/api/config/initializers/cookies_serializer.rb
@@ -0,0 +1,5 @@
+# Be sure to restart your server when you modify this file.
+
+# Specify a serializer for the signed and encrypted cookie jars.
+# Valid options are :json, :marshal, and :hybrid.
+Rails.application.config.action_dispatch.cookies_serializer = :marshal
diff --git a/services/api/config/initializers/filter_parameter_logging.rb b/services/api/config/initializers/filter_parameter_logging.rb
new file mode 100644
index 000000000..4a994e1e7
--- /dev/null
+++ b/services/api/config/initializers/filter_parameter_logging.rb
@@ -0,0 +1,4 @@
+# Be sure to restart your server when you modify this file.
+
+# Configure sensitive parameters which will be filtered from the log file.
+Rails.application.config.filter_parameters += [:password]
diff --git a/services/api/config/initializers/new_framework_defaults.rb b/services/api/config/initializers/new_framework_defaults.rb
new file mode 100644
index 000000000..cbf423a81
--- /dev/null
+++ b/services/api/config/initializers/new_framework_defaults.rb
@@ -0,0 +1,25 @@
+# Be sure to restart your server when you modify this file.
+#
+# This file contains migration options to ease your Rails 5.0 upgrade.
+#
+# Once upgraded flip defaults one by one to migrate to the new default.
+#
+# Read the Guide for Upgrading Ruby on Rails for more info on each option.
+
+Rails.application.config.action_controller.raise_on_unfiltered_parameters = true
+
+# Enable per-form CSRF tokens. Previous versions had false.
+Rails.application.config.action_controller.per_form_csrf_tokens = false
+
+# Enable origin-checking CSRF mitigation. Previous versions had false.
+Rails.application.config.action_controller.forgery_protection_origin_check = false
+
+# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
+# Previous versions had false.
+ActiveSupport.to_time_preserves_timezone = false
+
+# Require `belongs_to` associations by default. Previous versions had false.
+Rails.application.config.active_record.belongs_to_required_by_default = false
+
+# Do not halt callback chains when a callback returns false. Previous versions had true.
+ActiveSupport.halt_callback_chains_on_return_false = true
diff --git a/services/api/config/initializers/session_store.rb b/services/api/config/initializers/session_store.rb
index 5e9290c88..7ed424e64 100644
--- a/services/api/config/initializers/session_store.rb
+++ b/services/api/config/initializers/session_store.rb
@@ -4,7 +4,7 @@
# Be sure to restart your server when you modify this file.
-Server::Application.config.session_store :cookie_store, :key => '_server_session'
+Rails.application.config.session_store :cookie_store, key: '_server_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
diff --git a/services/api/config/puma.rb b/services/api/config/puma.rb
new file mode 100644
index 000000000..c7f311f81
--- /dev/null
+++ b/services/api/config/puma.rb
@@ -0,0 +1,47 @@
+# Puma can serve each request in a thread from an internal thread pool.
+# The `threads` method setting takes two numbers a minimum and maximum.
+# Any libraries that use thread pools should be configured to match
+# the maximum value specified for Puma. Default is set to 5 threads for minimum
+# and maximum, this matches the default thread size of Active Record.
+#
+threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i
+threads threads_count, threads_count
+
+# Specifies the `port` that Puma will listen on to receive requests, default is 3000.
+#
+port ENV.fetch("PORT") { 3000 }
+
+# Specifies the `environment` that Puma will run in.
+#
+environment ENV.fetch("RAILS_ENV") { "development" }
+
+# Specifies the number of `workers` to boot in clustered mode.
+# Workers are forked webserver processes. If using threads and workers together
+# the concurrency of the application would be max `threads` * `workers`.
+# Workers do not work on JRuby or Windows (both of which do not support
+# processes).
+#
+# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
+
+# Use the `preload_app!` method when specifying a `workers` number.
+# This directive tells Puma to first boot the application and load code
+# before forking the application. This takes advantage of Copy On Write
+# process behavior so workers use less memory. If you use this option
+# you need to make sure to reconnect any threads in the `on_worker_boot`
+# block.
+#
+# preload_app!
+
+# The code in the `on_worker_boot` will be called if you are using
+# clustered mode by specifying a number of `workers`. After each worker
+# process is booted this block will be run, if you are using `preload_app!`
+# option you will want to use this block to reconnect to any threads
+# or connections that may have been created at application boot, Ruby
+# cannot share connections between processes.
+#
+# on_worker_boot do
+# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
+# end
+
+# Allow puma to be restarted by `rails restart` command.
+plugin :tmp_restart
diff --git a/services/api/config/secrets.yml b/services/api/config/secrets.yml
new file mode 100644
index 000000000..4ebe02ae9
--- /dev/null
+++ b/services/api/config/secrets.yml
@@ -0,0 +1,22 @@
+# Be sure to restart your server when you modify this file.
+
+# Your secret key is used for verifying the integrity of signed cookies.
+# If you change this key, all old signed cookies will become invalid!
+
+# Make sure the secret is at least 30 characters and all random,
+# no regular words or you'll be exposed to dictionary attacks.
+# You can use `rails secret` to generate a secure secret key.
+
+# Make sure the secrets in this file are kept private
+# if you're sharing your code publicly.
+
+development:
+ secret_key_base: ef8dfe92893202f906d198094f428aaefa75749338e306ed2874938598cad7153ef0dd3cb8036c618cc7c27bb0c6c559728e8cc224da7cdfa2ad1d02874643b0
+
+test:
+ secret_key_base: 0b5454fe8163063950a7124348e2bc780fabbb022fa15f8a074c2fbcfce8eca480ed46b549b87738904f2bae6617ad949c3c3579e272d486c25aaa0ead563355
+
+# Do not keep production secrets in the repository,
+# instead read values from the environment.
+production:
+ secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
diff --git a/services/api/config/spring.rb b/services/api/config/spring.rb
new file mode 100644
index 000000000..c9119b40c
--- /dev/null
+++ b/services/api/config/spring.rb
@@ -0,0 +1,6 @@
+%w(
+ .ruby-version
+ .rbenv-vars
+ tmp/restart.txt
+ tmp/caching-dev.txt
+).each { |path| Spring.watch(path) }
diff --git a/services/api/lib/has_uuid.rb b/services/api/lib/has_uuid.rb
index dc8bdcb6c..60db53d5e 100644
--- a/services/api/lib/has_uuid.rb
+++ b/services/api/lib/has_uuid.rb
@@ -79,8 +79,8 @@ module HasUuid
def destroy_permission_links
if uuid
- Link.destroy_all(['link_class=? and (head_uuid=? or tail_uuid=?)',
- 'permission', uuid, uuid])
+ Link.where(['link_class=? and (head_uuid=? or tail_uuid=?)',
+ 'permission', uuid, uuid]).destroy_all
end
end
end
commit aeb966ee09166bf074ea19a4a2dd5045ca795a98
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date: Mon Mar 18 17:10:04 2019 -0300
14873: Removes activerecord-deprecated_finders gem dependency.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>
diff --git a/services/api/Gemfile b/services/api/Gemfile
index ad27c2df1..c91495d8f 100644
--- a/services/api/Gemfile
+++ b/services/api/Gemfile
@@ -23,10 +23,6 @@ end
# We need this dependency because of crunchv1
gem 'arvados-cli'
-# We'll need to update related code prior to Rails 5.
-# See: https://github.com/rails/activerecord-deprecated_finders
-gem 'activerecord-deprecated_finders', require: 'active_record/deprecated_finders'
-
# pg is the only supported database driver.
# Note: Rails 4.2 is not compatible with pg 1.0
# (See: https://github.com/rails/rails/pull/31671)
diff --git a/services/api/Gemfile.lock b/services/api/Gemfile.lock
index 9f7f36ee0..ad76a2ffb 100644
--- a/services/api/Gemfile.lock
+++ b/services/api/Gemfile.lock
@@ -37,7 +37,6 @@ GEM
activemodel (= 4.2.11)
activesupport (= 4.2.11)
arel (~> 6.0)
- activerecord-deprecated_finders (1.0.4)
activesupport (4.2.11)
i18n (~> 0.7)
minitest (~> 5.1)
@@ -281,7 +280,6 @@ PLATFORMS
ruby
DEPENDENCIES
- activerecord-deprecated_finders
acts_as_api
andand
arvados (>= 1.3.1.20190301212059)
diff --git a/services/api/app/controllers/application_controller.rb b/services/api/app/controllers/application_controller.rb
index 6dbba1a24..7a9b7a67e 100644
--- a/services/api/app/controllers/application_controller.rb
+++ b/services/api/app/controllers/application_controller.rb
@@ -523,7 +523,7 @@ class ApplicationController < ActionController::Base
if @objects.respond_to? :except
list[:items_available] = @objects.
except(:limit).except(:offset).
- count(:id, distinct: true)
+ distinct.count(:id)
end
when 'none'
else
commit 6b79272e3b6193ccbb2bab29090a6c93efe6e2f2
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date: Mon Mar 18 15:49:51 2019 -0300
14873: Removes protected_attributes gem dependency.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>
diff --git a/services/api/Gemfile b/services/api/Gemfile
index 25e441bfc..ad27c2df1 100644
--- a/services/api/Gemfile
+++ b/services/api/Gemfile
@@ -6,7 +6,6 @@ source 'https://rubygems.org'
gem 'rails', '~> 4.2'
gem 'responders', '~> 2.0'
-gem 'protected_attributes'
group :test, :development do
gem 'factory_bot_rails'
diff --git a/services/api/Gemfile.lock b/services/api/Gemfile.lock
index 6e2fa2cd6..9f7f36ee0 100644
--- a/services/api/Gemfile.lock
+++ b/services/api/Gemfile.lock
@@ -188,8 +188,6 @@ GEM
rake (>= 0.8.1)
pg (0.21.0)
power_assert (1.1.1)
- protected_attributes (1.1.4)
- activemodel (>= 4.0.1, < 5.0)
public_suffix (3.0.3)
rack (1.6.11)
rack-test (0.6.3)
@@ -303,7 +301,6 @@ DEPENDENCIES
omniauth-oauth2 (~> 1.1)
passenger
pg (~> 0.18)
- protected_attributes
rails (~> 4.2)
rails-observers
responders (~> 2.0)
diff --git a/services/api/app/models/arvados_model.rb b/services/api/app/models/arvados_model.rb
index 2002e90ac..3d6e15025 100644
--- a/services/api/app/models/arvados_model.rb
+++ b/services/api/app/models/arvados_model.rb
@@ -46,6 +46,11 @@ class ArvadosModel < ActiveRecord::Base
# penalty.
attr_accessor :async_permissions_update
+ # Ignore listed attributes on mass assignments
+ def self.protected_attributes
+ []
+ end
+
class PermissionDeniedError < RequestError
def http_status
403
@@ -98,6 +103,7 @@ class ArvadosModel < ActiveRecord::Base
# "ActionController::Parameters.permit_all_parameters = true",
# because permit_all does not permit nested attributes.
if raw_params
+ raw_params.delete_if { |k, _| self.protected_attributes.include? k }
serialized_attributes.each do |colname, coder|
param = raw_params[colname.to_sym]
if param.nil?
diff --git a/services/api/app/models/job.rb b/services/api/app/models/job.rb
index 7508ead5d..420386cdc 100644
--- a/services/api/app/models/job.rb
+++ b/services/api/app/models/job.rb
@@ -12,7 +12,6 @@ class Job < ArvadosModel
extend CurrentApiClient
extend LogReuseInfo
serialize :components, Hash
- attr_protected :arvados_sdk_version, :docker_image_locator
serialize :script_parameters, Hash
serialize :runtime_constraints, Hash
serialize :tasks_summary, Hash
@@ -83,6 +82,10 @@ class Job < ArvadosModel
["components"]
end
+ def self.protected_attributes
+ [:arvados_sdk_version, :docker_image_locator]
+ end
+
def assert_finished
update_attributes(finished_at: finished_at || db_current_time,
success: success.nil? ? false : success,
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list