diff --git a/.github/workflows/run_tests_CI.yml b/.github/workflows/run_tests_CI.yml index 0cc7d72eb..8b6157fd1 100644 --- a/.github/workflows/run_tests_CI.yml +++ b/.github/workflows/run_tests_CI.yml @@ -27,7 +27,7 @@ jobs: - Gemfile - Gemfile.next ruby: - - 2.6 + - 2.7 spec-commands: - 'spec/controllers/api/v1/[a-m]*.rb spec/counters spec/operations spec/serializers spec/workers' - 'spec/controllers/api/v1/[n-s]*.rb' diff --git a/Dockerfile b/Dockerfile index 2e388f65a..b6695ec2c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,4 @@ -# debian stretch has libjemalloc1 https://packages.debian.org/stretch/libjemalloc1 -FROM ruby:2.6-slim-stretch +FROM ruby:2.7-slim WORKDIR /rails_app @@ -8,15 +7,19 @@ RUN apt-get update && apt-get -y upgrade && \ build-essential \ # git is required for installing gems from git repos git \ - # libjemalloc1 (v3) provides big memory savings vs jemalloc v5+ (default on debian buster) - libjemalloc1 \ + # install jemalloc (v5) for memory savings + libjemalloc2 \ libpq-dev \ nodejs \ tmpreaper \ && \ apt-get clean -ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.1 +# configure jemalloc v5 with v3 behaviours (trade ram usage over performance) +# https://twitter.com/nateberkopec/status/1442894624935137288 +# https://github.com/code-dot-org/code-dot-org/blob/5c8b24674d1c2f7e51e85dd32124e113dc423d84/cookbooks/cdo-jemalloc/attributes/default.rb#L10 +ENV MALLOC_CONF="narenas:2,background_thread:true,thp:never,dirty_decay_ms:1000,muzzy_decay_ms:0" +ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2 # set a default RAILS_ENV for the build scripts # this is required for the `rake assets:precompile` script @@ -28,6 +31,7 @@ ADD ./Gemfile /rails_app/ ADD ./Gemfile.lock /rails_app/ RUN bundle config --global jobs `cat /proc/cpuinfo | grep processor | wc -l | xargs -I % expr % - 1` +RUN gem update --system RUN bundle install --without development test ADD ./ /rails_app diff --git a/Dockerfile.dev b/Dockerfile.dev index 43b0490a4..d32b626ac 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,4 +1,4 @@ -FROM ruby:2.6-slim-buster +FROM ruby:2.7-slim-buster WORKDIR /rails_app @@ -8,14 +8,18 @@ RUN apt-get update && apt-get -y upgrade && \ # git is required for installing gems from git repos git \ libpq-dev \ - # debian buster has v11 by default + # debian buster and comes with pg client v11 by default postgresql-client-11 \ tmpreaper +# set MRI memory allocator to mimic jemalloc memory savings +ENV MALLOC_ARENA_MAX=2 + ADD ./Gemfile /rails_app/ ADD ./Gemfile.lock /rails_app/ RUN bundle config --global jobs `cat /proc/cpuinfo | grep processor | wc -l | xargs -I % expr % - 1` +RUN gem update --system RUN bundle install ADD ./ /rails_app