-
Notifications
You must be signed in to change notification settings - Fork 14
[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
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 13e7e06
Remove unnecessary Sinatra weblogs
Strech 1b9c374
Clean rails42
Strech 45dd1fd
Clean rails52
Strech 183e259
Update manifest
Strech b677c86
Move usd-sinatra to Sinatra 4.1
Strech f254ec3
Remove obsolete files in Rails 5.2
Strech ce603e6
Migrate docker into Rails 7.2 and Sinatra 2.2
Strech 553a668
Clean Rails 6.1
Strech 876629c
Clean Rails 7.2
Strech 9c53982
Clean Rails 8.0
Strech 3cb876f
Add temporary readme about all rails
Strech 52a9957
Add log/library to the Rails 7.2
Strech 1d03c2d
Add otel and debugger in Rails 7.2
Strech 3422ed9
Update the readme
Strech feed215
Simplify Dockerfile for Rails 7.2 weblog
y9v 065e09b
Remove install_ddtrace.sh from rails72 Dockerfile
y9v 37f3889
Update Dockerfile for Rails 8.0 weblog
y9v 432f369
Fix install_ddtrace
y9v a61b732
Fix install_ddtrace.sh script
y9v fef96a8
A bit of cleaning for Rails 7.2 Dockerfile
Strech 8155b2c
Fix Dockerfile for Rails 6.1 weblog
y9v 2b86bda
Fix Dockerfile for Rails 5.2 weblog
y9v de35dad
Fix Dockerfile for Rails 4.2 weblog
y9v e519b51
Add bundle update datadog to install_ddtrace.sh
y9v 1b039ce
Update Rails 7.2 Gemfile.lock
Strech fc7a68f
Fix Gemfiles for Rails weblogs
y9v 30d6592
Update gemfile.lock files for Rails weblogs
y9v d99a1da
Fix Dockerfile for Rails 4.2 and 5.2 weblogs
y9v 9c22fba
Fix Rails 4.2 weblog dockerfile
y9v dc3595a
Lock new puma version
Strech 4b4363d
Standardize puma and debugging gems
Strech 210d7ae
Lock gemfiles sinatra/rack
Strech 2a2a3b1
Lock puma for rest of rails
Strech e2e0f99
Add secret key for Devise on Rails 4.2 weblog
y9v b7ec5f1
Remove libsqlite3-dev installation for Rails 7.2 Dockerfile
y9v f1401f6
Fix GraphQL 2.3 weblog Dockerfile
y9v a9eba9e
Update GraphQL 2.3 gemfile
y9v 82ad4ad
Use Ruby 3.4 for GraphQL weblog
y9v 505aa43
Improve Dockerfile for rack weblog
y9v 792d3d5
Fix sinatra weblogs Dockerfiles
y9v e0340f5
Fix Rails Dockerfile for UDS protocol tests
y9v 90a66a1
Make Rails 4.2 app.sh file executable
y9v cabfddd
Restore install_ddtrace script for Ruby
y9v 333dd8c
Merge branch 'main' into appsec-cleanup-ruby-weblogs
Strech 6c4c78a
Remove dev dependency require
Strech aff36a4
Re-lock Rails 7.2
Strech 39bbca2
Re-lock libddwaf for Rails 7.2 on multi-platform
Strech 6aecb66
Update libddwaf dependency for Rails 4.2 weblog
y9v 1072cf0
Fix Dockerfile for Rails 4.2 weblog
y9v 07d6877
Update libddwaf for Rails 6.2 weblog
y9v 3c5850f
Fix Dockerfile for Rails 6.1 weblog
y9v e610c1f
Fix OpenTelemetry tests for Rails 7.2 weblog
y9v 11bb4f0
Add empty Opentelemetry configuration block to Rails 7.2
y9v f78ba22
Merge branch 'main' into appsec-cleanup-ruby-weblogs
y9v File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 whilerails71
is deleted is confusing, no?There was a problem hiding this comment.
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