Skip to content

[ruby] Remove excessive Rails versions #4954

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 55 commits into from
Jul 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
0253c7f
Remove excessive Rails versions
Strech Jul 16, 2025
13e7e06
Remove unnecessary Sinatra weblogs
Strech Jul 16, 2025
1b9c374
Clean rails42
Strech Jul 16, 2025
45dd1fd
Clean rails52
Strech Jul 16, 2025
183e259
Update manifest
Strech Jul 16, 2025
b677c86
Move usd-sinatra to Sinatra 4.1
Strech Jul 16, 2025
f254ec3
Remove obsolete files in Rails 5.2
Strech Jul 16, 2025
ce603e6
Migrate docker into Rails 7.2 and Sinatra 2.2
Strech Jul 16, 2025
553a668
Clean Rails 6.1
Strech Jul 16, 2025
876629c
Clean Rails 7.2
Strech Jul 16, 2025
9c53982
Clean Rails 8.0
Strech Jul 16, 2025
3cb876f
Add temporary readme about all rails
Strech Jul 16, 2025
52a9957
Add log/library to the Rails 7.2
Strech Jul 16, 2025
1d03c2d
Add otel and debugger in Rails 7.2
Strech Jul 16, 2025
3422ed9
Update the readme
Strech Jul 16, 2025
feed215
Simplify Dockerfile for Rails 7.2 weblog
y9v Jul 16, 2025
065e09b
Remove install_ddtrace.sh from rails72 Dockerfile
y9v Jul 16, 2025
37f3889
Update Dockerfile for Rails 8.0 weblog
y9v Jul 16, 2025
432f369
Fix install_ddtrace
y9v Jul 16, 2025
a61b732
Fix install_ddtrace.sh script
y9v Jul 16, 2025
fef96a8
A bit of cleaning for Rails 7.2 Dockerfile
Strech Jul 16, 2025
8155b2c
Fix Dockerfile for Rails 6.1 weblog
y9v Jul 16, 2025
2b86bda
Fix Dockerfile for Rails 5.2 weblog
y9v Jul 16, 2025
de35dad
Fix Dockerfile for Rails 4.2 weblog
y9v Jul 16, 2025
e519b51
Add bundle update datadog to install_ddtrace.sh
y9v Jul 17, 2025
1b039ce
Update Rails 7.2 Gemfile.lock
Strech Jul 17, 2025
fc7a68f
Fix Gemfiles for Rails weblogs
y9v Jul 17, 2025
30d6592
Update gemfile.lock files for Rails weblogs
y9v Jul 17, 2025
d99a1da
Fix Dockerfile for Rails 4.2 and 5.2 weblogs
y9v Jul 17, 2025
9c22fba
Fix Rails 4.2 weblog dockerfile
y9v Jul 17, 2025
dc3595a
Lock new puma version
Strech Jul 17, 2025
4b4363d
Standardize puma and debugging gems
Strech Jul 17, 2025
210d7ae
Lock gemfiles sinatra/rack
Strech Jul 17, 2025
2a2a3b1
Lock puma for rest of rails
Strech Jul 17, 2025
e2e0f99
Add secret key for Devise on Rails 4.2 weblog
y9v Jul 17, 2025
b7ec5f1
Remove libsqlite3-dev installation for Rails 7.2 Dockerfile
y9v Jul 17, 2025
f1401f6
Fix GraphQL 2.3 weblog Dockerfile
y9v Jul 17, 2025
a9eba9e
Update GraphQL 2.3 gemfile
y9v Jul 17, 2025
82ad4ad
Use Ruby 3.4 for GraphQL weblog
y9v Jul 17, 2025
505aa43
Improve Dockerfile for rack weblog
y9v Jul 17, 2025
792d3d5
Fix sinatra weblogs Dockerfiles
y9v Jul 17, 2025
e0340f5
Fix Rails Dockerfile for UDS protocol tests
y9v Jul 17, 2025
90a66a1
Make Rails 4.2 app.sh file executable
y9v Jul 18, 2025
cabfddd
Restore install_ddtrace script for Ruby
y9v Jul 18, 2025
333dd8c
Merge branch 'main' into appsec-cleanup-ruby-weblogs
Strech Jul 18, 2025
6c4c78a
Remove dev dependency require
Strech Jul 21, 2025
aff36a4
Re-lock Rails 7.2
Strech Jul 21, 2025
39bbca2
Re-lock libddwaf for Rails 7.2 on multi-platform
Strech Jul 22, 2025
6aecb66
Update libddwaf dependency for Rails 4.2 weblog
y9v Jul 23, 2025
1072cf0
Fix Dockerfile for Rails 4.2 weblog
y9v Jul 23, 2025
07d6877
Update libddwaf for Rails 6.2 weblog
y9v Jul 23, 2025
3c5850f
Fix Dockerfile for Rails 6.1 weblog
y9v Jul 24, 2025
e610c1f
Fix OpenTelemetry tests for Rails 7.2 weblog
y9v Jul 24, 2025
11bb4f0
Add empty Opentelemetry configuration block to Rails 7.2
y9v Jul 24, 2025
f78ba22
Merge branch 'main' into appsec-cleanup-ruby-weblogs
y9v Jul 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 6 additions & 6 deletions .github/workflows/run-docker-mode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ jobs:
- rack
# - sinatra14
# - sinatra20
- sinatra21
- sinatra22
# - rails50
# - rails51
# - rails52
# - rails60
# - rails61
# - rails70
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think leaving e.g. rails70 commented out while rails71 is deleted is confusing, no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the comments itself confusing, but we can clean it all

- rails71
- rails72
runs-on: ubuntu-latest
permissions:
packages: write
Expand Down Expand Up @@ -170,14 +170,14 @@ jobs:
- rack
# - sinatra14
# - sinatra20
- sinatra21
- sinatra22
# - rails50
# - rails51
# - rails52
# - rails60
# - rails61
# - rails70
- rails71
- rails72
scenario:
- DEFAULT
# - APPSEC_DISABLED
Expand Down Expand Up @@ -289,14 +289,14 @@ jobs:
- rack
# - sinatra14
# - sinatra20
- sinatra21
- sinatra22
# - rails50
# - rails51
# - rails52
# - rails60
# - rails61
# - rails70
- rails71
- rails72
runs-on: ubuntu-latest
needs:
- test
Expand Down
208 changes: 68 additions & 140 deletions manifests/ruby.yml

Large diffs are not rendered by default.

73 changes: 56 additions & 17 deletions utils/build/docker/ruby/README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,65 @@
# System test apps for Ruby
# Rules

## Updating lockfiles
We add new weblog **only** when it makes sense. For instance, when it's a next major
release or an important breaking change that is so significant, that it must be
addressed as a separate weblog.

In every major release, we try to keep the most recent patch version of the framework,
with a caveat covered in previous sentence.

```
# example with rails71
Otherwise, please use `dd-trace-rb` repository tests to cover a specific permutation.

The Ruby version must be the most recent version of the major release, unless it's
a specific version is required by the framework.

# Permutations

Some weblogs contain additional enpoints and gem versions that are not present in
other weblogs. For instance, Rails 7.2 has `/otel_drop_in_default_propagator_extract`
and `/kafka/` endpoints.

Rails 7.2
* `/otel_drop_in_default_propagator_extract` with `opentelemetry-{sdk,api}` gem
* `/otel_drop_in_default_propagator_inject` with `opentelemetry-{sdk,api}` gem
* `/read_file`
* `/log/library`
* `/kafka/*` with `ruby-kafka` gem
* `/debugger/*`

# get base image to use same ruby version
cat rails71.Dockerfile | perl -ne '/^FROM (.*)/ and print "$1\n"'
Rails 8.0
* `/kafka/*` with `rdkafka` gem
* `/debugger/*`

# go into app
cd rails71
# Updating Gemfile.lock

# conservative lock update (like bundle install)
docker run --rm -it -v "${PWD}":"${PWD}" -w "${PWD}" ghcr.io/datadog/images-rb/engines/ruby:3.2 bundle lock
In order to update the lockfile, we use the following commands inside the container:

# full lock update (like bundle update)
docker run --rm -it -v "${PWD}":"${PWD}" -w "${PWD}" ghcr.io/datadog/images-rb/engines/ruby:3.2 bundle lock --update
1. To update the lockfile to the most recent version of the framework, run:
```bash
$ bundle lock --update
```
2. To add the target platform to the lockfile, run one of the following commands:
```bash
$ bundle lock --add-platform x86_64-linux-gnu
$ bundle lock --add-platform arm64-darwin
$ bundle lock --add-platform aarch64-linux-gnu
$ bundle lock --add-platform x86_64-darwin
```

# adding a target platform with same deps as local platform
docker run --rm -it -v "${PWD}":"${PWD}" -w "${PWD}" ghcr.io/datadog/images-rb/engines/ruby:3.2 bundle lock --add-platform x86_64-linux-gnu
docker run --rm -it -v "${PWD}":"${PWD}" -w "${PWD}" ghcr.io/datadog/images-rb/engines/ruby:3.2 bundle lock --add-platform aarch64-linux-gnu
docker run --rm -it -v "${PWD}":"${PWD}" -w "${PWD}" ghcr.io/datadog/images-rb/engines/ruby:3.2 bundle lock --add-platform x86_64-darwin
docker run --rm -it -v "${PWD}":"${PWD}" -w "${PWD}" ghcr.io/datadog/images-rb/engines/ruby:3.2 bundle lock --add-platform arm64-darwin
The ruby version is specified in the `Dockerfile` file. And to run the commands,
you need to be inside the container, like this:

```bash
$ cd utils/build/docker/ruby/rails72
$ docker run --rm -it -v "${PWD}":"${PWD}" -w "${PWD}" ghcr.io/datadog/images-rb/engines/ruby:3.2 bash
```

## Ruby 2.5 tips & tricks

For Ruby 2.5 and Rails 4.2 we need to use bundler < 2.

```bash
$ docker run --rm -it -v "${PWD}":"${PWD}" -w "${PWD}" ghcr.io/datadog/images-rb/engines/ruby:2.5 bash
$ root@c262f9bc5bd8: gem install -N bundler:1.17.3
$ root@c262f9bc5bd8: rm $(ruby -e 'puts Gem.default_specifications_dir')/bundler-2.*.gemspec
```
23 changes: 10 additions & 13 deletions utils/build/docker/ruby/graphql23.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
FROM ghcr.io/datadog/images-rb/engines/ruby:3.2

RUN apt-get update && apt-get install -y nodejs npm
FROM ghcr.io/datadog/images-rb/engines/ruby:3.4

RUN mkdir -p /app
WORKDIR /app

# Install gem dependencies prior to copying the entire application
COPY utils/build/docker/ruby/graphql23/Gemfile .
COPY utils/build/docker/ruby/graphql23/Gemfile.lock .
RUN sed -i -e '/gem .ddtrace./d' Gemfile && bundle config set --local without test development && bundle install
ENV RAILS_ENV="production"
ENV RAILS_MASTER_KEY="9d319c57ec128e905d9e2ce5742bf2de"
ENV BUNDLE_WITHOUT="development test"
ENV DD_TRACE_HEADER_TAGS="user-agent"

COPY utils/build/docker/ruby/rails72/Gemfile* ./
RUN bundle install

COPY utils/build/docker/ruby/graphql23/ .

COPY utils/build/docker/ruby/install_ddtrace.sh binaries* /binaries/
RUN /binaries/install_ddtrace.sh

ENV DD_TRACE_HEADER_TAGS=user-agent
ENV RAILS_ENV=production
ENV RAILS_MASTER_KEY=9d319c57ec128e905d9e2ce5742bf2de
RUN bundle exec rails db:create db:migrate db:seed
RUN bundle exec rails db:prepare

RUN echo "#!/bin/bash\nbundle exec puma -b tcp://0.0.0.0 -p 7777 -w 1" > app.sh
RUN chmod +x app.sh
CMD [ "./app.sh" ]
57 changes: 13 additions & 44 deletions utils/build/docker/ruby/graphql23/Gemfile
Original file line number Diff line number Diff line change
@@ -1,48 +1,17 @@
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
source 'https://rubygems.org'

ruby "~> 3.2.0"
ruby '~> 3.4.0'
gem 'rails', '~> 7.1.1'
gem 'sqlite3', '~> 1.4'
gem 'graphql', '~> 2.3'
gem 'puma', '~> 6.0'
gem 'bootsnap', require: false
# AppSec related dependencies
gem 'devise', '~> 4.9.0'

# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 7.1.1"
group :development do
gem 'pry-byebug'
end

# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem "sprockets-rails"

# Use sqlite3 as the database for Active Record
gem "sqlite3", "~> 1.4"

# Use the Puma web server [https://github.com/puma/puma]
gem "puma", "~> 6.0"

# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
gem "importmap-rails"

# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
gem "turbo-rails"

# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
gem "stimulus-rails"

# Use Redis adapter to run Action Cable in production
# gem "redis", "~> 4.0"

# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
# gem "kredis"

# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
# gem "bcrypt", "~> 3.1.7"

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]

# Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", require: false

gem 'devise'

gem 'pry'
gem 'dogstatsd-ruby'
gem 'ddtrace', '~> 1.0.0.a', require: 'ddtrace/auto_instrument'

gem "graphql", "~> 2.3"
gem 'datadog', '~> 2.0', require: 'datadog/auto_instrument'
Loading