Skip to content

Commit

Permalink
Merge pull request #318 from zooniverse/rails-dual-boot
Browse files Browse the repository at this point in the history
Rails dual boot
  • Loading branch information
yuenmichelle1 committed May 23, 2024
2 parents 41575de + 90f3a11 commit e72d51a
Show file tree
Hide file tree
Showing 9 changed files with 575 additions and 10 deletions.
19 changes: 17 additions & 2 deletions .github/workflows/run_tests_CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,27 @@ jobs:
--health-interval 10s
--health-timeout 5s
--health-retries 5
continue-on-error: true
strategy:
matrix:
gemfile:
- Gemfile
- Gemfile.next
ruby:
- 2.5
- 2.6
exclude:
- gemfile: Gemfile
ruby: 2.6
- gemfile: Gemfile.next
ruby: 2.5

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.5
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Install PG Client
run: |
Expand Down
3 changes: 2 additions & 1 deletion .guardrails/ignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
docker-compose.yml
config/database.yml
config/secrets.yml
config/secrets.yml
docker-compose-rails-next.yml
33 changes: 33 additions & 0 deletions Dockerfile.rails-next
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM ruby:2.6-slim-buster

WORKDIR /rails_app

RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache

RUN --mount=type=cache,id=talk-apt-cache,target=/var/cache/apt --mount=type=cache,id=talk-apt-lib,target=/var/lib/apt \
apt-get update && \
apt-get install --no-install-recommends -y \
build-essential \
git \
libpq-dev \
tmpreaper

ARG RAILS_ENV=production
ENV RAILS_ENV=$RAILS_ENV

ADD ./Gemfile.next /rails_app/
ADD ./Gemfile.next.lock /rails_app/

# ensure we use the rails-next gemfile setup to ensure we boot the upgraded libaries
ENV BUNDLE_GEMFILE=Gemfile.next

RUN bundle config --global jobs `cat /proc/cpuinfo | grep processor | wc -l | xargs -I % expr % - 1`
RUN if [ "$RAILS_ENV" = "development" ]; then bundle install; else bundle install --without development test; fi

ADD ./ /rails_app

RUN (git log --format="%H" -n 1 > /rails_app/public/commit_id.txt && rm -rf .git)

EXPOSE 81

CMD [ "/rails_app/docker/start.sh" ]
23 changes: 19 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
def next?
File.basename(__FILE__) == "Gemfile.next"
end
source 'https://rubygems.org'

if next?
gem 'rails', '5.0.7.2'
gem 'schema_plus_pg_indexes', '~> 0.2.1'
gem 'spring', '~> 2.0.2', group: :development
else
gem 'rails', '~> 4.2'
gem 'schema_plus_pg_indexes', '~> 0.1.12'
gem 'spring', '~> 1.7.1', group: :development
end

gem 'aws-sdk', '~> 2.3.7'
gem 'faraday'
gem 'faraday_middleware'
Expand All @@ -12,25 +25,27 @@ gem 'pg', '~> 0.21'
gem 'puma'
gem 'pundit', '~> 1.1.0'
gem 'rack-cors', '~> 1.0.5'
gem 'rails', '~> 4.2'
gem 'redis', '~> 3.3.0'
gem 'restpack_serializer', git: 'https://github.com/zooniverse/restpack_serializer.git', branch: 'talk-api-version', ref: '637aaaf85e'
gem 'schema_plus_pg_indexes', '~> 0.1.12'
gem 'sidekiq', '< 6'
gem 'sidekiq-congestion', '~> 0.1.0'
gem 'sidetiq', '~> 0.7.2'
gem 'spring', '~> 1.7.1', group: :development
gem 'zoo_stream', '~> 1.0'

group :test, :development do
if next?
gem 'rspec-rails', '~> 4.1.2'
else
gem 'rspec-rails', '~> 3.4.2'
end
gem 'benchmark-ips'
gem 'factory_girl_rails', '~> 4.7.0'
gem 'guard', '~> 2.14.0'
gem 'guard-rspec', '~> 4.6.5'
gem 'pry', '~> 0.11.3'
gem 'rspec-its', '~> 1.2.0'
gem 'rspec-rails', '~> 3.4.2'
gem 'spring-commands-rspec', '~> 1.0.4'
gem 'ten_years_rails'
gem 'timecop'
end

Expand Down
26 changes: 25 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ GEM
codeclimate-test-reporter (0.5.0)
simplecov (>= 0.7.1, < 1.0.0)
coderay (1.1.2)
colorize (0.8.1)
concurrent-ruby (1.1.6)
congestion (0.1.0)
connection_pool (>= 2.0)
Expand All @@ -87,6 +88,8 @@ GEM
crass (1.0.6)
diff-lcs (1.2.5)
docile (1.1.5)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
erubis (2.7.0)
factory_girl (4.7.0)
activesupport (>= 3.0.0)
Expand Down Expand Up @@ -118,6 +121,9 @@ GEM
hashdiff (0.3.7)
hitimes (1.3.0)
honeybadger (4.5.6)
http-accept (1.7.0)
http-cookie (1.0.5)
domain_name (~> 0.5)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
ice_cube (0.14.0)
Expand Down Expand Up @@ -159,13 +165,17 @@ GEM
mail (2.7.1)
mini_mime (>= 0.1.1)
method_source (0.9.0)
mime-types (3.5.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2024.0507)
mini_mime (1.1.2)
mini_portile2 (2.6.1)
minitest (5.14.4)
modware (0.1.3)
key_struct (~> 0.4)
multipart-post (2.1.1)
nenv (0.3.0)
netrc (0.11.0)
newrelic_rpm (6.12.0.367)
nio4r (2.5.8)
nokogiri (1.12.5)
Expand Down Expand Up @@ -221,6 +231,11 @@ GEM
ffi (>= 0.5.0)
redis (3.3.5)
request_store (1.3.1)
rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rspec (3.4.0)
rspec-core (~> 3.4.0)
rspec-expectations (~> 3.4.0)
Expand Down Expand Up @@ -291,13 +306,21 @@ GEM
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
ten_years_rails (0.2.0)
actionview
activesupport
colorize (>= 0.8.1)
rest-client (>= 2.0.2)
thor (1.1.0)
thread_safe (0.3.6)
timecop (0.8.1)
timecop (0.9.8)
timers (4.1.2)
hitimes
tzinfo (1.2.10)
thread_safe (~> 0.1)
unf (0.1.4)
unf_ext
unf_ext (0.0.9.1)
webmock (3.4.2)
addressable (>= 2.3.6)
crack (>= 0.3.2)
Expand Down Expand Up @@ -339,6 +362,7 @@ DEPENDENCIES
simplecov (~> 0.11.2)
spring (~> 1.7.1)
spring-commands-rspec (~> 1.0.4)
ten_years_rails
timecop
webmock (~> 3.4)
zoo_stream (~> 1.0)
Expand Down
1 change: 1 addition & 0 deletions Gemfile.next
Loading

0 comments on commit e72d51a

Please sign in to comment.