diff --git a/Dockerfile b/Dockerfile index 40ab1e5d9..3e111096d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,13 +9,14 @@ RUN apt-get update -qq && \ libjemalloc2 \ libssl-dev \ nodejs \ - yarnpkg \ + npm \ postgresql-client \ default-jre-headless \ poppler-utils \ sudo graphviz --no-install-recommends \ libreoffice \ libfile-mimeinfo-perl && \ + npm install -g yarn && \ rm -rf /var/lib/apt/lists/* # heroku tools diff --git a/Dockerfile.production b/Dockerfile.production index bc4f02c6e..710e184fb 100644 --- a/Dockerfile.production +++ b/Dockerfile.production @@ -1,18 +1,15 @@ FROM ruby:2.6.3-buster MAINTAINER BioSistemika -RUN echo deb "http://http.debian.net/debian buster-backports main" >> /etc/apt/sources.list - # additional dependecies # libSSL-1.0 is required by wkhtmltopdf binary # libreoffice for file preview generation -RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - && \ - apt-get update -qq && \ +RUN apt-get update -qq && \ apt-get install -y \ libjemalloc2 \ libssl-dev \ nodejs \ - yarnpkg \ + npm \ groff-base \ awscli \ postgresql-client \ @@ -20,8 +17,9 @@ RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - && \ default-jre-headless \ poppler-utils \ sudo graphviz --no-install-recommends \ + libreoffice \ libfile-mimeinfo-perl && \ - apt-get install -y --no-install-recommends -t buster-backports libreoffice && \ + npm install -g yarn && \ rm -rf /var/lib/apt/lists/* ENV RAILS_ENV production diff --git a/Gemfile.lock b/Gemfile.lock index aba7edb11..08d862507 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,12 +1,12 @@ GIT remote: https://github.com/biosistemika/canaid - revision: 6c02dfe7e8354e130d543ec0b398ab6411892d13 + revision: c65ea0a2fae1edb368aa561e35a153c2cd3bccdd branch: master specs: - canaid (1.0.3) - devise (>= 3.4.1) + canaid (1.0.4) + devise (~> 4.6.2) docile (>= 1.1.0) - rails (>= 4) + rails (~> 5.2.3) GIT remote: https://github.com/biosistemika/jquery-scrollto-rails @@ -65,9 +65,9 @@ GEM erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - active_model_serializers (0.10.9) - actionpack (>= 4.1, < 6) - activemodel (>= 4.1, < 6) + active_model_serializers (0.10.10) + actionpack (>= 4.1, < 6.1) + activemodel (>= 4.1, < 6.1) case_transform (>= 0.2) jsonapi-renderer (>= 0.1.1.beta1, < 0.3) activejob (5.2.3) @@ -100,30 +100,30 @@ GEM ast (2.4.0) auto_strip_attributes (2.5.0) activerecord (>= 4.0) - autoprefixer-rails (9.6.0) + autoprefixer-rails (9.6.1) execjs autosize-rails (1.18.17) rails (>= 3.1) awesome_print (1.8.0) aws-eventstream (1.0.3) - aws-partitions (1.174.0) - aws-sdk-core (3.54.2) + aws-partitions (1.197.0) + aws-sdk-core (3.62.0) aws-eventstream (~> 1.0, >= 1.0.2) aws-partitions (~> 1.0) aws-sigv4 (~> 1.1) jmespath (~> 1.0) - aws-sdk-kms (1.21.0) - aws-sdk-core (~> 3, >= 3.53.0) + aws-sdk-kms (1.24.0) + aws-sdk-core (~> 3, >= 3.61.1) aws-sigv4 (~> 1.1) aws-sdk-rails (2.1.0) aws-sdk-ses (~> 1) railties (>= 3) - aws-sdk-s3 (1.42.0) - aws-sdk-core (~> 3, >= 3.53.0) + aws-sdk-s3 (1.46.0) + aws-sdk-core (~> 3, >= 3.61.1) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.1) - aws-sdk-ses (1.22.0) - aws-sdk-core (~> 3, >= 3.53.0) + aws-sdk-ses (1.25.0) + aws-sdk-core (~> 3, >= 3.61.1) aws-sigv4 (~> 1.1) aws-sigv4 (1.1.0) aws-eventstream (~> 1.0, >= 1.0.2) @@ -151,7 +151,7 @@ GEM activesupport (>= 3.0.0) uniform_notifier (~> 1.11) byebug (11.0.1) - capybara (3.23.0) + capybara (3.28.0) addressable mini_mime (>= 0.1.3) nokogiri (~> 1.8) @@ -171,8 +171,8 @@ GEM rails (>= 3.2) case_transform (0.2) activesupport - childprocess (0.9.0) - ffi (~> 1.0, >= 1.0.11) + childprocess (1.0.1) + rake (< 13.0) climate_control (0.2.0) cliver (0.3.2) coderay (1.1.2) @@ -202,22 +202,22 @@ GEM cucumber-tag_expressions (~> 1.1.0) gherkin (~> 5.0) cucumber-expressions (6.0.1) - cucumber-rails (1.7.0) - capybara (>= 2.3.0, < 4) + cucumber-rails (1.8.0) + capybara (>= 2.12, < 4) cucumber (>= 3.0.2, < 4) - mime-types (>= 1.17, < 4) + mime-types (>= 2.0, < 4) nokogiri (~> 1.8) railties (>= 4.2, < 7) cucumber-tag_expressions (1.1.1) cucumber-wire (0.0.1) database_cleaner (1.7.0) debug_inspector (0.0.3) - deface (1.4.0) + deface (1.5.0) nokogiri (>= 1.6) polyglot rails (>= 4.1) rainbow (>= 2.1.0) - delayed_job (4.1.5) + delayed_job (4.1.7) activesupport (>= 3.0, < 5.3) delayed_job_active_record (4.1.3) activerecord (>= 3.0, < 5.3) @@ -234,7 +234,7 @@ GEM diff-lcs (1.3) discard (1.1.0) activerecord (>= 4.2, < 7) - docile (1.3.1) + docile (1.3.2) doorkeeper (5.1.0) railties (>= 5) erubi (1.8.0) @@ -246,21 +246,22 @@ GEM factory_bot_rails (5.0.2) factory_bot (~> 5.0.2) railties (>= 4.2.0) - faker (1.9.3) + faker (2.1.0) i18n (>= 0.7) faraday (0.15.4) multipart-post (>= 1.2, < 3) + fastimage (2.1.5) ffi (1.11.1) figaro (1.1.1) thor (~> 0.14) - fugit (1.2.1) + fugit (1.3.1) et-orbi (~> 1.1, >= 1.1.8) raabro (~> 1.1) gherkin (5.1.0) globalid (0.4.2) activesupport (>= 4.2.0) hammerjs-rails (2.0.8) - hashdiff (0.4.0) + hashdiff (1.0.0) hashie (3.6.0) httparty (0.13.7) json (~> 1.8) @@ -270,11 +271,11 @@ GEM i18n-js (3.3.0) i18n (>= 0.6.6) iniparse (1.4.4) - jaro_winkler (1.5.2) + jaro_winkler (1.5.3) jbuilder (2.9.1) activesupport (>= 4.2.0) jmespath (1.4.0) - jquery-rails (4.3.3) + jquery-rails (4.3.5) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) @@ -283,13 +284,13 @@ GEM js_cookie_rails (2.2.0) railties (>= 3.1) json (1.8.6) - json-jwt (1.10.1) + json-jwt (1.10.2) activesupport (>= 4.2) aes_key_wrap bindata - json_matchers (0.11.0) + json_matchers (0.11.1) json_schema - json_schema (0.20.6) + json_schema (0.20.7) jsonapi-renderer (0.2.0) jwt (1.5.6) kaminari (1.1.1) @@ -321,15 +322,17 @@ GEM marcel (0.3.3) mimemagic (~> 0.3.2) method_source (0.9.2) - mime-types (1.25.1) + mime-types (3.2.2) + mime-types-data (~> 3.2015) + mime-types-data (3.2019.0331) mimemagic (0.3.3) - mini_magick (4.9.3) - mini_mime (1.0.1) + mini_magick (4.9.5) + mini_mime (1.0.2) mini_portile2 (2.4.0) minitest (5.11.3) momentjs-rails (2.17.1) railties (>= 3.1) - msgpack (1.3.0) + msgpack (1.3.1) multi_json (1.13.1) multi_test (0.1.2) multi_xml (0.6.0) @@ -338,8 +341,8 @@ GEM coffee-rails (>= 3.2.1) jquery-rails rails (>= 3.2.0) - newrelic_rpm (6.4.0.356) - nio4r (2.3.1) + newrelic_rpm (6.5.0.357) + nio4r (2.4.0) nokogiri (1.10.3) mini_portile2 (~> 2.4.0) nokogumbo (2.0.1) @@ -362,8 +365,8 @@ GEM actionpack (>= 4.2) omniauth (>= 1.3.1) orm_adapter (0.5.0) - overcommit (0.48.1) - childprocess (~> 0.6, >= 0.6.3) + overcommit (0.49.0) + childprocess (>= 0.6.3, < 2.0) iniparse (~> 1.4) paperclip (6.1.0) activemodel (>= 4.2.0) @@ -375,9 +378,7 @@ GEM parser (2.6.3.0) ast (~> 2.4.0) pg (1.1.4) - activerecord (>= 4.2) - activesupport (>= 4.2) - pg_search (2.2.0) + pg_search (2.3.0) activerecord (>= 4.2) activesupport (>= 4.2) phantomjs (2.1.1.0) @@ -394,11 +395,12 @@ GEM pry (~> 0.10) pry-rails (0.3.9) pry (>= 0.10.4) - public_suffix (3.1.0) - puma (3.12.1) + public_suffix (3.1.1) + puma (4.0.1) + nio4r (~> 2.0) raabro (1.1.6) rack (2.0.7) - rack-attack (6.0.0) + rack-attack (6.1.0) rack (>= 1.0, < 3) rack-proxy (0.6.5) rack @@ -424,7 +426,7 @@ GEM rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.0.4) + rails-html-sanitizer (1.1.0) loofah (~> 2.2, >= 2.2.2) rails_12factor (0.0.3) rails_serve_static_assets @@ -440,17 +442,17 @@ GEM rake (>= 0.8.7) thor (>= 0.19.0, < 2.0) rainbow (3.0.0) - rake (12.3.2) + rake (12.3.3) rb-fsevent (0.10.3) rb-inotify (0.10.0) ffi (~> 1.0) rdoc (6.1.1) - recaptcha (5.0.0) + recaptcha (5.1.0) json - regexp_parser (1.5.1) - responders (2.4.1) - actionpack (>= 4.2.0, < 6.0) - railties (>= 4.2.0, < 6.0) + regexp_parser (1.6.0) + responders (3.0.0) + actionpack (>= 5.0) + railties (>= 5.0) rgl (0.5.4) lazy_priority_queue (~> 0.1.0) stream (~> 0.5.2) @@ -474,15 +476,15 @@ GEM rspec-mocks (~> 3.8.0) rspec-support (~> 3.8.0) rspec-support (3.8.2) - rubocop (0.71.0) + rubocop (0.74.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) parser (>= 2.6) rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 1.7) - rubocop-performance (1.3.0) - rubocop (>= 0.68.0) + rubocop-performance (1.4.1) + rubocop (>= 0.71.0) ruby-graphviz (1.2.4) ruby-progressbar (1.10.1) ruby_dep (1.5.0) @@ -502,7 +504,7 @@ GEM sassc (2.0.1) ffi (~> 1.9) rake - sassc-rails (2.1.1) + sassc-rails (2.1.2) railties (>= 4.0.0) sassc (>= 2.0) sprockets (> 3.0) @@ -513,14 +515,14 @@ GEM railties (>= 4.0.0) sdoc (1.0.0) rdoc (>= 5.0) - shoulda-matchers (4.1.0) + shoulda-matchers (4.1.2) activesupport (>= 4.2.0) silencer (1.0.1) simple_token_authentication (1.15.1) actionmailer (>= 3.2.6, < 6) actionpack (>= 3.2.6, < 6) devise (>= 3.2, < 6) - simplecov (0.16.1) + simplecov (0.17.0) docile (~> 1.1) json (>= 1.8, < 3) simplecov-html (~> 0.10.0) @@ -555,10 +557,10 @@ GEM uniform_notifier (1.12.1) warden (1.2.8) rack (>= 2.0.6) - webmock (3.6.0) + webmock (3.6.2) addressable (>= 2.3.6) crack (>= 0.3.2) - hashdiff + hashdiff (>= 0.4.0, < 2.0.0) webpacker (4.0.7) activesupport (>= 4.2) rack-proxy (>= 0.6.1) diff --git a/app/services/active_storage/service/custom_s3_service.rb b/app/services/active_storage/service/custom_s3_service.rb index 08a75645d..71b1de966 100644 --- a/app/services/active_storage/service/custom_s3_service.rb +++ b/app/services/active_storage/service/custom_s3_service.rb @@ -21,8 +21,6 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -gem 'aws-sdk-s3', '~> 1.14' - require 'aws-sdk-s3' require 'active_support/core_ext/numeric/bytes' @@ -62,8 +60,6 @@ module ActiveStorage else instrument :download, key: key do object_for(key).get.body.string.force_encoding(Encoding::BINARY) - rescue Aws::S3::Errors::NoSuchKey - raise ActiveStorage::FileNotFoundError end end end @@ -74,8 +70,6 @@ module ActiveStorage .body .string .force_encoding(Encoding::BINARY) - rescue Aws::S3::Errors::NoSuchKey - raise ActiveStorage::FileNotFoundError end end @@ -160,8 +154,6 @@ module ActiveStorage chunk_size = 5.megabytes offset = 0 - raise ActiveStorage::FileNotFoundError unless object.exists? - while offset < object.content_length yield object.get(range: "bytes=#{offset}-#{offset + chunk_size - 1}") .body diff --git a/app/services/model_exporters/model_exporter.rb b/app/services/model_exporters/model_exporter.rb index 141572ce5..38975ec79 100644 --- a/app/services/model_exporters/model_exporter.rb +++ b/app/services/model_exporters/model_exporter.rb @@ -28,7 +28,9 @@ module ModelExporters tempfile.path, File.join(dir, a.file_name) ) - tempfile.close! + ensure + tempfile.close + tempfile.unlink end end diff --git a/config/webpack/environment.js b/config/webpack/environment.js index fcb290273..f81f5d64c 100644 --- a/config/webpack/environment.js +++ b/config/webpack/environment.js @@ -1,5 +1,5 @@ const { environment } = require('@rails/webpacker') -environment.loaders.delete('nodeModules'); +environment.loaders.delete('nodeModules') module.exports = environment diff --git a/db/migrate/20190613134100_convert_to_active_storage.rb b/db/migrate/20190613134100_convert_to_active_storage.rb index 0d651d7d4..5d7af21fa 100644 --- a/db/migrate/20190613134100_convert_to_active_storage.rb +++ b/db/migrate/20190613134100_convert_to_active_storage.rb @@ -62,7 +62,7 @@ class ConvertToActiveStorage < ActiveRecord::Migration[5.2] end def down - # raise ActiveRecord::IrreversibleMigration + raise ActiveRecord::IrreversibleMigration end private diff --git a/yarn.lock b/yarn.lock index 6e2fb076b..bcf99d269 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2449,16 +2449,6 @@ core-util-is@1.0.2, core-util-is@~1.0.0: resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= -cosmiconfig@^5.0.0: - version "5.2.1" - resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-5.2.1.tgz#040f726809c591e77a17c0a3626ca45b4f168b1a" - integrity sha512-H65gsXo1SKjf8zmrJ67eJk8aIRKV5ff2D4uKZIBZShbhGSpEmsQOPW/SKMKYhSTrqR7ufy6RP69rPogdaPh/kA== - dependencies: - import-fresh "^2.0.0" - is-directory "^0.3.1" - js-yaml "^3.13.1" - parse-json "^4.0.0" - cosmiconfig@^5.0.0, cosmiconfig@^5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-5.2.1.tgz#040f726809c591e77a17c0a3626ca45b4f168b1a" @@ -5221,7 +5211,7 @@ js-tokens@^3.0.2: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" integrity sha1-mGbfOVECEw449/mWvOtlRDIJwls= -js-yaml@^3.12.0, js-yaml@^3.13.0, js-yaml@^3.13.1, js-yaml@^3.9.0, js-yaml@^3.9.1: +js-yaml@^3.12.0, js-yaml@^3.13.0, js-yaml@^3.13.1, js-yaml@^3.9.1: version "3.13.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== @@ -5648,12 +5638,7 @@ loglevel-colored-level-prefix@^1.0.0: chalk "^1.1.3" loglevel "^1.4.1" -loglevel@^1.4.1: - version "1.6.3" - resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.6.3.tgz#77f2eb64be55a404c9fd04ad16d57c1d6d6b1280" - integrity sha512-LoEDv5pgpvWgPF4kNYuIp0qqSJVWak/dML0RY74xlzMZiT9w77teNAwKYKWBTYjlokMirg+o3jBwp+vlLrcfAA== - -loglevel@^1.6.3: +loglevel@^1.4.1, loglevel@^1.6.3: version "1.6.3" resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.6.3.tgz#77f2eb64be55a404c9fd04ad16d57c1d6d6b1280" integrity sha512-LoEDv5pgpvWgPF4kNYuIp0qqSJVWak/dML0RY74xlzMZiT9w77teNAwKYKWBTYjlokMirg+o3jBwp+vlLrcfAA== @@ -7715,16 +7700,7 @@ postcss@^6.0.0, postcss@^6.0.1, postcss@^6.0.11, postcss@^6.0.14, postcss@^6.0.1 source-map "^0.6.1" supports-color "^5.4.0" -postcss@^7.0.0, postcss@^7.0.1, postcss@^7.0.16, postcss@^7.0.17, postcss@^7.0.5: - version "7.0.17" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.17.tgz#4da1bdff5322d4a0acaab4d87f3e782436bad31f" - integrity sha512-546ZowA+KZ3OasvQZHsbuEpysvwTZNGJv9EfyCQdsIDltPSWHAeTQ5fQy/Npi2ZDtLI3zs7Ps/p6wThErhm9fQ== - dependencies: - chalk "^2.4.2" - source-map "^0.6.1" - supports-color "^6.1.0" - -postcss@^7.0.14, postcss@^7.0.2, postcss@^7.0.6: +postcss@^7.0.0, postcss@^7.0.1, postcss@^7.0.14, postcss@^7.0.16, postcss@^7.0.17, postcss@^7.0.2, postcss@^7.0.5, postcss@^7.0.6: version "7.0.17" resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.17.tgz#4da1bdff5322d4a0acaab4d87f3e782436bad31f" integrity sha512-546ZowA+KZ3OasvQZHsbuEpysvwTZNGJv9EfyCQdsIDltPSWHAeTQ5fQy/Npi2ZDtLI3zs7Ps/p6wThErhm9fQ== @@ -9689,11 +9665,6 @@ type-is@~1.6.17, type-is@~1.6.18: media-typer "0.3.0" mime-types "~2.1.24" -type@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/type/-/type-1.0.1.tgz#084c9a17fcc9151a2cdb1459905c2e45e4bb7d61" - integrity sha512-MAM5dBMJCJNKs9E7JXo4CXRAansRfG0nlJxW7Wf6GZzSOvH31zClSaHdIMWLehe/EGMBkqeC55rrkaOr5Oo7Nw== - typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" @@ -9955,12 +9926,10 @@ verror@1.10.0: core-util-is "1.0.2" extsprintf "^1.2.0" -vm-browserify@0.0.4: - version "0.0.4" - resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-0.0.4.tgz#5d7ea45bbef9e4a6ff65f95438e0a87c357d5a73" - integrity sha1-XX6kW7755Kb/ZflUOOCofDV9WnM= - dependencies: - indexof "0.0.1" +vm-browserify@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.0.tgz#bd76d6a23323e2ca8ffa12028dc04559c75f9019" + integrity sha512-iq+S7vZJE60yejDYM0ek6zg308+UZsdtPExWP9VZoCFCz1zkJoXFnAX7aZfd/ZwrkidzdUZL0C/ryW+JwAiIGw== vue-eslint-parser@^2.0.2: version "2.0.3" @@ -10283,7 +10252,7 @@ yallist@^2.1.2: resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI= -yallist@^3.0.0, yallist@^3.0.3: +yallist@^3.0.0, yallist@^3.0.2, yallist@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.0.3.tgz#b4b049e314be545e3ce802236d6cd22cd91c3de9" integrity sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==