diff --git a/lib/generators/dockerfile_generator.rb b/lib/generators/dockerfile_generator.rb index d993684..6fca669 100644 --- a/lib/generators/dockerfile_generator.rb +++ b/lib/generators/dockerfile_generator.rb @@ -16,7 +16,7 @@ class DockerfileGenerator < Rails::Generators::Base "compose" => false, "fullstaq" => false, "gemfile-updates" => true, - "jemalloc" => false, + "jemalloc" => true, "label" => {}, "link" => false, "litefs" => false, @@ -996,8 +996,8 @@ def deploy_env end if options.jemalloc? && !options.fullstaq? - env["LD_PRELOAD"] = "libjemalloc.so.2" - env["MALLOC_CONF"] = "dirty_decay_ms:1000,narenas:2,background_thread:true" + # env["LD_PRELOAD"] = "libjemalloc.so.2" + # env["MALLOC_CONF"] = "dirty_decay_ms:1000,narenas:2,background_thread:true" end if using_puppeteer? diff --git a/lib/generators/templates/docker-entrypoint.erb b/lib/generators/templates/docker-entrypoint.erb index 7661d26..802a988 100755 --- a/lib/generators/templates/docker-entrypoint.erb +++ b/lib/generators/templates/docker-entrypoint.erb @@ -4,6 +4,14 @@ #!/bin/bash -e <% end -%> +<% if options.jemalloc? -%> +# Enable jemalloc for reduced memory usage and latency. +if [ -z "${LD_PRELOAD+x}" ]; then + LD_PRELOAD=$(find /usr/lib -name libjemalloc.so.2 -print -quit) + export LD_PRELOAD +fi + +<% end -%> <% if options.swap && !File.exist?("fly.toml")-%> <% if run_as_root? or using_passenger? -%> <% @space = "" -%> diff --git a/test/results/alpine/Dockerfile b/test/results/alpine/Dockerfile index de5439e..eaf0aab 100644 --- a/test/results/alpine/Dockerfile +++ b/test/results/alpine/Dockerfile @@ -65,7 +65,7 @@ FROM base # Install packages needed for deployment RUN apk update && \ - apk add curl libpq postgresql-client && \ + apk add curl jemalloc libpq postgresql-client && \ rm -rf /var/cache/apk/* # Copy built artifacts: gems, application diff --git a/test/results/alpine/docker-entrypoint b/test/results/alpine/docker-entrypoint index 07ca730..1d79024 100644 --- a/test/results/alpine/docker-entrypoint +++ b/test/results/alpine/docker-entrypoint @@ -1,5 +1,11 @@ #!/bin/sh -e +# Enable jemalloc for reduced memory usage and latency. +if [ -z "${LD_PRELOAD+x}" ]; then + LD_PRELOAD=$(find /usr/lib -name libjemalloc.so.2 -print -quit) + export LD_PRELOAD +fi + # If running the rails server then create or migrate existing database if [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then ./bin/rails db:prepare diff --git a/test/results/api/Dockerfile b/test/results/api/Dockerfile index 2476fbb..ca14460 100644 --- a/test/results/api/Dockerfile +++ b/test/results/api/Dockerfile @@ -60,7 +60,7 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libsqlite3-0 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libsqlite3-0 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application diff --git a/test/results/bin_cd/Dockerfile b/test/results/bin_cd/Dockerfile index 29a0541..b41420c 100644 --- a/test/results/bin_cd/Dockerfile +++ b/test/results/bin_cd/Dockerfile @@ -45,7 +45,7 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libsqlite3-0 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libsqlite3-0 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application diff --git a/test/results/bun/Dockerfile b/test/results/bun/Dockerfile index 0348016..9be64a4 100644 --- a/test/results/bun/Dockerfile +++ b/test/results/bun/Dockerfile @@ -56,7 +56,7 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libsqlite3-0 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libsqlite3-0 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application diff --git a/test/results/cache/Dockerfile b/test/results/cache/Dockerfile index a09b83e..610e099 100644 --- a/test/results/cache/Dockerfile +++ b/test/results/cache/Dockerfile @@ -70,7 +70,7 @@ FROM base RUN --mount=type=cache,id=dev-apt-cache,sharing=locked,target=/var/cache/apt \ --mount=type=cache,id=dev-apt-lib,sharing=locked,target=/var/lib/apt \ apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libsqlite3-0 + apt-get install --no-install-recommends -y curl libjemalloc2 libsqlite3-0 # Copy built artifacts: gems, application COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}" diff --git a/test/results/ci/Dockerfile b/test/results/ci/Dockerfile index 14aa3fd..8d4c2a1 100644 --- a/test/results/ci/Dockerfile +++ b/test/results/ci/Dockerfile @@ -42,7 +42,7 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libsqlite3-0 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libsqlite3-0 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application diff --git a/test/results/env/Dockerfile b/test/results/env/Dockerfile index ace79bb..06153c2 100644 --- a/test/results/env/Dockerfile +++ b/test/results/env/Dockerfile @@ -46,7 +46,7 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libsqlite3-0 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libsqlite3-0 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application diff --git a/test/results/esbuild/Dockerfile b/test/results/esbuild/Dockerfile index 09ac943..872d051 100644 --- a/test/results/esbuild/Dockerfile +++ b/test/results/esbuild/Dockerfile @@ -59,7 +59,7 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libsqlite3-0 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libsqlite3-0 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application diff --git a/test/results/execjs_importmap/Dockerfile b/test/results/execjs_importmap/Dockerfile index bf90be5..b40637f 100644 --- a/test/results/execjs_importmap/Dockerfile +++ b/test/results/execjs_importmap/Dockerfile @@ -61,7 +61,7 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libsqlite3-0 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libsqlite3-0 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application diff --git a/test/results/execjs_node/Dockerfile b/test/results/execjs_node/Dockerfile index 800c640..1991487 100644 --- a/test/results/execjs_node/Dockerfile +++ b/test/results/execjs_node/Dockerfile @@ -69,7 +69,7 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libsqlite3-0 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libsqlite3-0 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application diff --git a/test/results/grover/Dockerfile b/test/results/grover/Dockerfile index d345a0f..4200799 100644 --- a/test/results/grover/Dockerfile +++ b/test/results/grover/Dockerfile @@ -62,7 +62,7 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y chromium chromium-sandbox curl libsqlite3-0 && \ + apt-get install --no-install-recommends -y chromium chromium-sandbox curl libjemalloc2 libsqlite3-0 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application diff --git a/test/results/idle/Dockerfile b/test/results/idle/Dockerfile index bc54741..8364165 100644 --- a/test/results/idle/Dockerfile +++ b/test/results/idle/Dockerfile @@ -55,7 +55,7 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libnginx-mod-http-passenger libsqlite3-0 nginx && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libnginx-mod-http-passenger libsqlite3-0 nginx && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # configure nginx and passenger diff --git a/test/results/idle/docker-entrypoint b/test/results/idle/docker-entrypoint index 67ec46b..ae37ee3 100644 --- a/test/results/idle/docker-entrypoint +++ b/test/results/idle/docker-entrypoint @@ -1,5 +1,11 @@ #!/bin/bash -e +# Enable jemalloc for reduced memory usage and latency. +if [ -z "${LD_PRELOAD+x}" ]; then + LD_PRELOAD=$(find /usr/lib -name libjemalloc.so.2 -print -quit) + export LD_PRELOAD +fi + # allocate swap space fallocate -l 512M /swapfile chmod 0600 /swapfile diff --git a/test/results/jemalloc/Dockerfile b/test/results/jemalloc/Dockerfile index 1947320..4ca3663 100644 --- a/test/results/jemalloc/Dockerfile +++ b/test/results/jemalloc/Dockerfile @@ -2,7 +2,7 @@ # Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile ARG RUBY_VERSION=xxx -FROM --platform=linux/amd64 ruby:$RUBY_VERSION-slim AS base +FROM ruby:$RUBY_VERSION-slim AS base # Rails app lives here WORKDIR /rails @@ -42,7 +42,7 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libjemalloc2 libsqlite3-0 && \ + apt-get install --no-install-recommends -y curl libsqlite3-0 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application @@ -57,9 +57,7 @@ RUN groupadd --system --gid 1000 rails && \ USER 1000:1000 # Deployment options -ENV DATABASE_URL="sqlite3:///data/production.sqlite3" \ - LD_PRELOAD="libjemalloc.so.2" \ - MALLOC_CONF="dirty_decay_ms:1000,narenas:2,background_thread:true" +ENV DATABASE_URL="sqlite3:///data/production.sqlite3" # Entrypoint prepares the database. ENTRYPOINT ["/rails/bin/docker-entrypoint"] diff --git a/test/results/jemalloc/docker-entrypoint b/test/results/jemalloc/docker-entrypoint new file mode 100644 index 0000000..ed31659 --- /dev/null +++ b/test/results/jemalloc/docker-entrypoint @@ -0,0 +1,8 @@ +#!/bin/bash -e + +# If running the rails server then create or migrate existing database +if [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then + ./bin/rails db:prepare +fi + +exec "${@}" diff --git a/test/results/label/Dockerfile b/test/results/label/Dockerfile index 00f69aa..2760754 100644 --- a/test/results/label/Dockerfile +++ b/test/results/label/Dockerfile @@ -44,7 +44,7 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libsqlite3-0 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libsqlite3-0 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application diff --git a/test/results/litefs/Dockerfile b/test/results/litefs/Dockerfile index 08a1c12..5d6321e 100644 --- a/test/results/litefs/Dockerfile +++ b/test/results/litefs/Dockerfile @@ -50,7 +50,7 @@ COPY config/litefs.yml /etc/litefs.yml # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y ca-certificates curl fuse3 libsqlite3-0 sudo && \ + apt-get install --no-install-recommends -y ca-certificates curl fuse3 libjemalloc2 libsqlite3-0 sudo && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application diff --git a/test/results/litefs/docker-entrypoint b/test/results/litefs/docker-entrypoint index 2b7669e..2b70932 100644 --- a/test/results/litefs/docker-entrypoint +++ b/test/results/litefs/docker-entrypoint @@ -1,5 +1,11 @@ #!/bin/bash -e +# Enable jemalloc for reduced memory usage and latency. +if [ -z "${LD_PRELOAD+x}" ]; then + LD_PRELOAD=$(find /usr/lib -name libjemalloc.so.2 -print -quit) + export LD_PRELOAD +fi + # mount litefs sudo -E litefs mount & diff --git a/test/results/litestream/Dockerfile b/test/results/litestream/Dockerfile index fab4761..7365dfa 100644 --- a/test/results/litestream/Dockerfile +++ b/test/results/litestream/Dockerfile @@ -46,7 +46,7 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libsqlite3-0 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libsqlite3-0 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application diff --git a/test/results/litestream/docker-entrypoint b/test/results/litestream/docker-entrypoint index 7f4c21e..485feb3 100644 --- a/test/results/litestream/docker-entrypoint +++ b/test/results/litestream/docker-entrypoint @@ -1,5 +1,11 @@ #!/bin/bash -e +# Enable jemalloc for reduced memory usage and latency. +if [ -z "${LD_PRELOAD+x}" ]; then + LD_PRELOAD=$(find /usr/lib -name libjemalloc.so.2 -print -quit) + export LD_PRELOAD +fi + # If running the rails server then create or migrate existing database if [ "${@: -5:1}" == "./bin/rake" ] && [ "${@: -4:1}" == litestream:run ] && [ "${@: -3:1}" == "./bin/thrust" ] && [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then ./bin/rails db:prepare diff --git a/test/results/minimal/Dockerfile b/test/results/minimal/Dockerfile index 4ca3663..c5d69c4 100644 --- a/test/results/minimal/Dockerfile +++ b/test/results/minimal/Dockerfile @@ -42,7 +42,7 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libsqlite3-0 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libsqlite3-0 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application diff --git a/test/results/mysql/Dockerfile b/test/results/mysql/Dockerfile index dc140f7..203824f 100644 --- a/test/results/mysql/Dockerfile +++ b/test/results/mysql/Dockerfile @@ -46,7 +46,7 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl default-mysql-client && \ + apt-get install --no-install-recommends -y curl default-mysql-client libjemalloc2 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application diff --git a/test/results/nginx/Dockerfile b/test/results/nginx/Dockerfile index 29bf693..fa65424 100644 --- a/test/results/nginx/Dockerfile +++ b/test/results/nginx/Dockerfile @@ -42,7 +42,7 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libsqlite3-0 nginx ruby-foreman && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libsqlite3-0 nginx ruby-foreman && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # configure nginx diff --git a/test/results/nginx/docker-entrypoint b/test/results/nginx/docker-entrypoint index 7c8bfe9..de9ae51 100644 --- a/test/results/nginx/docker-entrypoint +++ b/test/results/nginx/docker-entrypoint @@ -1,5 +1,11 @@ #!/bin/bash -e +# Enable jemalloc for reduced memory usage and latency. +if [ -z "${LD_PRELOAD+x}" ]; then + LD_PRELOAD=$(find /usr/lib -name libjemalloc.so.2 -print -quit) + export LD_PRELOAD +fi + # If running the production procfile then create or migrate existing database if [ "${@: -3:1}" == "foreman" ] && [ "${@: -2:1}" == "start" ] && [ "${@: -1:1}" == "--procfile=Procfile.prod" ]; then ./bin/rails db:prepare diff --git a/test/results/no_precompiled_gems/Dockerfile b/test/results/no_precompiled_gems/Dockerfile index 0016624..37d1388 100644 --- a/test/results/no_precompiled_gems/Dockerfile +++ b/test/results/no_precompiled_gems/Dockerfile @@ -43,7 +43,7 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libsqlite3-0 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libsqlite3-0 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application diff --git a/test/results/no_prep/Dockerfile b/test/results/no_prep/Dockerfile index 32b73b9..42cf85a 100644 --- a/test/results/no_prep/Dockerfile +++ b/test/results/no_prep/Dockerfile @@ -42,7 +42,7 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libsqlite3-0 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libsqlite3-0 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application diff --git a/test/results/no_prep/docker-entrypoint b/test/results/no_prep/docker-entrypoint index 9dd92e3..9268499 100644 --- a/test/results/no_prep/docker-entrypoint +++ b/test/results/no_prep/docker-entrypoint @@ -1,5 +1,11 @@ #!/bin/bash -e +# Enable jemalloc for reduced memory usage and latency. +if [ -z "${LD_PRELOAD+x}" ]; then + LD_PRELOAD=$(find /usr/lib -name libjemalloc.so.2 -print -quit) + export LD_PRELOAD +fi + # Add any container initialization steps here exec "${@}" diff --git a/test/results/parallel/Dockerfile b/test/results/parallel/Dockerfile index 4fe6909..5149f67 100644 --- a/test/results/parallel/Dockerfile +++ b/test/results/parallel/Dockerfile @@ -70,7 +70,7 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libsqlite3-0 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libsqlite3-0 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application diff --git a/test/results/postgresql/Dockerfile b/test/results/postgresql/Dockerfile index a7d8918..5546ceb 100644 --- a/test/results/postgresql/Dockerfile +++ b/test/results/postgresql/Dockerfile @@ -46,7 +46,7 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl postgresql-client && \ + apt-get install --no-install-recommends -y curl libjemalloc2 postgresql-client && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application diff --git a/test/results/precompile_defer/Dockerfile b/test/results/precompile_defer/Dockerfile index ec365e1..ef35700 100644 --- a/test/results/precompile_defer/Dockerfile +++ b/test/results/precompile_defer/Dockerfile @@ -34,7 +34,7 @@ RUN bundle exec bootsnap precompile app/ lib/ # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libsqlite3-0 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libsqlite3-0 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Run and own only the runtime files as a non-root user for security diff --git a/test/results/precompile_defer/docker-entrypoint b/test/results/precompile_defer/docker-entrypoint index 8826c8d..2b905ee 100755 --- a/test/results/precompile_defer/docker-entrypoint +++ b/test/results/precompile_defer/docker-entrypoint @@ -1,5 +1,11 @@ #!/bin/bash -e +# Enable jemalloc for reduced memory usage and latency. +if [ -z "${LD_PRELOAD+x}" ]; then + LD_PRELOAD=$(find /usr/lib -name libjemalloc.so.2 -print -quit) + export LD_PRELOAD +fi + # If running the rails server then create or migrate existing database if [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then ./bin/rails assets:precompile diff --git a/test/results/private_gemserver/Dockerfile b/test/results/private_gemserver/Dockerfile index 39cc091..f9ee6e8 100644 --- a/test/results/private_gemserver/Dockerfile +++ b/test/results/private_gemserver/Dockerfile @@ -45,7 +45,7 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libsqlite3-0 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libsqlite3-0 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application diff --git a/test/results/private_gemserver_with_cache/Dockerfile b/test/results/private_gemserver_with_cache/Dockerfile index 3dfda17..cd44e96 100644 --- a/test/results/private_gemserver_with_cache/Dockerfile +++ b/test/results/private_gemserver_with_cache/Dockerfile @@ -55,7 +55,7 @@ FROM base RUN --mount=type=cache,id=dev-apt-cache,sharing=locked,target=/var/cache/apt \ --mount=type=cache,id=dev-apt-lib,sharing=locked,target=/var/lib/apt \ apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libsqlite3-0 + apt-get install --no-install-recommends -y curl libjemalloc2 libsqlite3-0 # Copy built artifacts: gems, application COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}" diff --git a/test/results/redis/Dockerfile b/test/results/redis/Dockerfile index 9ebcd0b..b12fa3e 100644 --- a/test/results/redis/Dockerfile +++ b/test/results/redis/Dockerfile @@ -46,7 +46,7 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libsqlite3-0 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libsqlite3-0 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application diff --git a/test/results/rmagick/Dockerfile b/test/results/rmagick/Dockerfile index da66f02..40a716a 100644 --- a/test/results/rmagick/Dockerfile +++ b/test/results/rmagick/Dockerfile @@ -42,7 +42,7 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl imagemagick libsqlite3-0 && \ + apt-get install --no-install-recommends -y curl imagemagick libjemalloc2 libsqlite3-0 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application diff --git a/test/results/shrine/Dockerfile b/test/results/shrine/Dockerfile index 4ca3663..c5d69c4 100644 --- a/test/results/shrine/Dockerfile +++ b/test/results/shrine/Dockerfile @@ -42,7 +42,7 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libsqlite3-0 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libsqlite3-0 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application diff --git a/test/results/sidekiq/Dockerfile b/test/results/sidekiq/Dockerfile index a7d8918..5546ceb 100644 --- a/test/results/sidekiq/Dockerfile +++ b/test/results/sidekiq/Dockerfile @@ -46,7 +46,7 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl postgresql-client && \ + apt-get install --no-install-recommends -y curl libjemalloc2 postgresql-client && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application diff --git a/test/results/solid_queue_postgres/Dockerfile b/test/results/solid_queue_postgres/Dockerfile index a7d8918..5546ceb 100644 --- a/test/results/solid_queue_postgres/Dockerfile +++ b/test/results/solid_queue_postgres/Dockerfile @@ -46,7 +46,7 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl postgresql-client && \ + apt-get install --no-install-recommends -y curl libjemalloc2 postgresql-client && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application diff --git a/test/results/solid_queue_sqlite3/Dockerfile b/test/results/solid_queue_sqlite3/Dockerfile index c6d7a14..fe38c4c 100644 --- a/test/results/solid_queue_sqlite3/Dockerfile +++ b/test/results/solid_queue_sqlite3/Dockerfile @@ -46,7 +46,7 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libsqlite3-0 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libsqlite3-0 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application diff --git a/test/results/sqlite3/Dockerfile b/test/results/sqlite3/Dockerfile index 9ebcd0b..b12fa3e 100644 --- a/test/results/sqlite3/Dockerfile +++ b/test/results/sqlite3/Dockerfile @@ -46,7 +46,7 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libsqlite3-0 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libsqlite3-0 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application diff --git a/test/results/swap/Dockerfile b/test/results/swap/Dockerfile index 6ea969a..88f2594 100644 --- a/test/results/swap/Dockerfile +++ b/test/results/swap/Dockerfile @@ -42,7 +42,7 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libsqlite3-0 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libsqlite3-0 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application diff --git a/test/results/swap/docker-entrypoint b/test/results/swap/docker-entrypoint index 16a4235..9ea5a49 100644 --- a/test/results/swap/docker-entrypoint +++ b/test/results/swap/docker-entrypoint @@ -1,5 +1,11 @@ #!/bin/bash -e +# Enable jemalloc for reduced memory usage and latency. +if [ -z "${LD_PRELOAD+x}" ]; then + LD_PRELOAD=$(find /usr/lib -name libjemalloc.so.2 -print -quit) + export LD_PRELOAD +fi + if [ $UID -eq 0 ]; then # allocate swap space fallocate -l 512M /swapfile diff --git a/test/results/thruster/Dockerfile b/test/results/thruster/Dockerfile index 4721412..1c23abb 100644 --- a/test/results/thruster/Dockerfile +++ b/test/results/thruster/Dockerfile @@ -46,7 +46,7 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libsqlite3-0 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libsqlite3-0 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application diff --git a/test/results/trilogy/Dockerfile b/test/results/trilogy/Dockerfile index 2b7a1bb..d0f5aa0 100644 --- a/test/results/trilogy/Dockerfile +++ b/test/results/trilogy/Dockerfile @@ -46,7 +46,7 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl default-mysql-client libsqlite3-0 && \ + apt-get install --no-install-recommends -y curl default-mysql-client libjemalloc2 libsqlite3-0 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application diff --git a/test/results/vite/Dockerfile b/test/results/vite/Dockerfile index f6dda62..49a17d6 100644 --- a/test/results/vite/Dockerfile +++ b/test/results/vite/Dockerfile @@ -53,7 +53,7 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libsqlite3-0 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libsqlite3-0 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application diff --git a/test/results/windows/Dockerfile b/test/results/windows/Dockerfile index 054a14b..8860bd4 100644 --- a/test/results/windows/Dockerfile +++ b/test/results/windows/Dockerfile @@ -46,7 +46,7 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libsqlite3-0 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libsqlite3-0 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application diff --git a/test/results/yjit/Dockerfile b/test/results/yjit/Dockerfile index 5682597..ff5e34e 100644 --- a/test/results/yjit/Dockerfile +++ b/test/results/yjit/Dockerfile @@ -42,7 +42,7 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libsqlite3-0 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libsqlite3-0 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application diff --git a/test/test_config.rb b/test/test_config.rb index 7e440ac..68bb84c 100644 --- a/test/test_config.rb +++ b/test/test_config.rb @@ -5,7 +5,7 @@ class TestConfig < TestBase @rails_options = "--minimal" - @generate_options = "--fullstaq --link --force" + @generate_options = "--fullstaq --no-jemalloc --link --force" def app_setup IO.write "config/dockerfile.yml", @@ -19,6 +19,6 @@ def test_config assert_equal true, options["yjit"] assert_equal true, options["fullstaq"] assert_equal true, options["link"] - assert_nil options["jemalloc"] + assert_equal false, options["jemalloc"] end end diff --git a/test/test_fullstaq.rb b/test/test_fullstaq.rb index 749659c..cf00f1a 100644 --- a/test/test_fullstaq.rb +++ b/test/test_fullstaq.rb @@ -4,7 +4,7 @@ class TestFullstaq < TestBase @rails_options = "--minimal" - @generate_options = "--fullstaq" + @generate_options = "--no-jemalloc --fullstaq" def test_fullstaq check_dockerfile diff --git a/test/test_jemalloc.rb b/test/test_jemalloc.rb index 38b2f7d..261fc02 100644 --- a/test/test_jemalloc.rb +++ b/test/test_jemalloc.rb @@ -4,9 +4,10 @@ class TestJemalloc < TestBase @rails_options = "--minimal" - @generate_options = "--jemalloc --platform=linux/amd64" + @generate_options = "--no-jemalloc" def test_jemalloc check_dockerfile + check_entrypoint end end