Skip to content

Commit

Permalink
ruby test matrix [INPLAT-41] (#3347)
Browse files Browse the repository at this point in the history
  • Loading branch information
emmettbutler authored Nov 6, 2024
1 parent df55b74 commit 2a24480
Show file tree
Hide file tree
Showing 18 changed files with 599 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ onboarding_ruby:
SCENARIO: [ CONTAINER_AUTO_INJECTION_INSTALL_SCRIPT]
DEFAULT_VMS: ["True","False"]
- ONBOARDING_FILTER_ENV: [dev, prod]
ONBOARDING_FILTER_WEBLOG: [test-app-ruby,test-app-ruby-container]
ONBOARDING_FILTER_WEBLOG: [test-app-ruby,test-app-ruby-multicontainer,test-app-ruby-multialpine]
SCENARIO: [INSTALLER_AUTO_INJECTION]
DEFAULT_VMS: ["True","False"]
- ONBOARDING_FILTER_ENV: [dev, prod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ gem "sqlite3", "~> 1.4"
# Use the Puma web server [https://github.com/puma/puma]
gem "puma", "~> 5.0"

gem 'mutex_m', '~> 0.2.0'
gem 'base64', '~> 0.1.0'
gem 'bigdecimal', '~> 1.2', '>= 1.2.7'

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

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
weblog:
name: test-app-ruby-multialpine
install:
- os_type: linux
copy_files:
- name: copy-multicontainer-run-script
local_path: utils/build/virtual_machine/weblogs/common/create_and_run_app_multicontainer.sh
- name: copy-docker-compose-file
local_path: utils/build/virtual_machine/weblogs/ruby/test-app-ruby-multialpine/docker-compose.yml
- name: copy-ruby-app
local_path: lib-injection/build/docker/ruby
- name: copy-ruby3_2-app-dockerfile
local_path: utils/build/virtual_machine/weblogs/ruby/test-app-ruby-multialpine/Dockerfile.ruby_3_2-alpine
- name: copy-ruby3_1-app-dockerfile
local_path: utils/build/virtual_machine/weblogs/ruby/test-app-ruby-multialpine/Dockerfile.ruby_3_1-alpine
- name: copy-ruby3_0-app-dockerfile
local_path: utils/build/virtual_machine/weblogs/ruby/test-app-ruby-multialpine/Dockerfile.ruby_3_0-alpine
- name: copy-ruby2_7-app-dockerfile
local_path: utils/build/virtual_machine/weblogs/ruby/test-app-ruby-multialpine/Dockerfile.ruby_2_7-alpine
- name: copy-reverseproxy-dockerfile
local_path: utils/build/virtual_machine/weblogs/ruby/test-app-ruby-multialpine/Dockerfile.reverseproxy
- name: copy-reverseproxy-conf
local_path: utils/build/virtual_machine/weblogs/ruby/test-app-ruby-multialpine/nginx.conf
remote-command: sh create_and_run_app_multicontainer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
weblog:
name: test-app-ruby-multicontainer
install:
- os_type: linux
copy_files:
- name: copy-multicontainer-run-script
local_path: utils/build/virtual_machine/weblogs/common/create_and_run_app_multicontainer.sh
- name: copy-docker-compose-file
local_path: utils/build/virtual_machine/weblogs/ruby/test-app-ruby-multicontainer/docker-compose.yml
- name: copy-ruby-app
local_path: lib-injection/build/docker/ruby
- name: copy-ruby3_2-app-dockerfile
local_path: utils/build/virtual_machine/weblogs/ruby/test-app-ruby-multicontainer/Dockerfile.ruby_3_2
- name: copy-ruby3_1-app-dockerfile
local_path: utils/build/virtual_machine/weblogs/ruby/test-app-ruby-multicontainer/Dockerfile.ruby_3_1
- name: copy-ruby3_0-app-dockerfile
local_path: utils/build/virtual_machine/weblogs/ruby/test-app-ruby-multicontainer/Dockerfile.ruby_3_0
- name: copy-ruby2_7-app-dockerfile
local_path: utils/build/virtual_machine/weblogs/ruby/test-app-ruby-multicontainer/Dockerfile.ruby_2_7
- name: copy-reverseproxy-dockerfile
local_path: utils/build/virtual_machine/weblogs/ruby/test-app-ruby-multicontainer/Dockerfile.reverseproxy
- name: copy-reverseproxy-conf
local_path: utils/build/virtual_machine/weblogs/ruby/test-app-ruby-multicontainer/nginx.conf
remote-command: sh create_and_run_app_multicontainer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM public.ecr.aws/nginx/nginx:stable-perl

COPY nginx.conf /etc/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM public.ecr.aws/docker/library/ruby:2.7-alpine

ENV DEBIAN_FRONTEND=noninteractive

# Set timezone to UTC by default
RUN ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime

# Upgrade RubyGems and Bundler
RUN gem update --system 3.4.1
RUN gem install bundler -v '~> 2.3.26'
RUN mkdir -p "$GEM_HOME" && chmod -R 777 "$GEM_HOME"
ENV BUNDLE_SILENCE_ROOT_WARNING 1

# Setup directory
RUN mkdir /app
WORKDIR /app

# Add files
COPY lib_injection_rails_app /app

# Install gems
RUN bundle install

# Set entrypoint
ENTRYPOINT ["/bin/bash", "-c"]

CMD ["bin/rails server -b 0.0.0.0 -p 18080"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM public.ecr.aws/docker/library/ruby:3.0-alpine

ENV DEBIAN_FRONTEND=noninteractive

# Set timezone to UTC by default
RUN ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime

# Upgrade RubyGems and Bundler
RUN gem update --system 3.4.1
RUN gem install bundler -v '~> 2.3.26'
RUN mkdir -p "$GEM_HOME" && chmod -R 777 "$GEM_HOME"
ENV BUNDLE_SILENCE_ROOT_WARNING 1

# Setup directory
RUN mkdir /app
WORKDIR /app

# Add files
COPY lib_injection_rails_app /app

# Install gems
RUN bundle install

# Set entrypoint
ENTRYPOINT ["/bin/bash", "-c"]

CMD ["bin/rails server -b 0.0.0.0 -p 18080"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM public.ecr.aws/docker/library/ruby:3.1-alpine

ENV DEBIAN_FRONTEND=noninteractive

# Set timezone to UTC by default
RUN ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime

# Upgrade RubyGems and Bundler
RUN gem update --system 3.4.1
RUN gem install bundler -v '~> 2.3.26'
RUN mkdir -p "$GEM_HOME" && chmod -R 777 "$GEM_HOME"
ENV BUNDLE_SILENCE_ROOT_WARNING 1

# Setup directory
RUN mkdir /app
WORKDIR /app

# Add files
COPY lib_injection_rails_app /app

# Install gems
RUN bundle install

# Set entrypoint
ENTRYPOINT ["/bin/bash", "-c"]

CMD ["bin/rails server -b 0.0.0.0 -p 18080"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM public.ecr.aws/docker/library/ruby:3.2-alpine

ENV DEBIAN_FRONTEND=noninteractive

# Set timezone to UTC by default
RUN ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime

# Upgrade RubyGems and Bundler
RUN gem update --system 3.4.1
RUN gem install bundler -v '~> 2.3.26'
RUN mkdir -p "$GEM_HOME" && chmod -R 777 "$GEM_HOME"
ENV BUNDLE_SILENCE_ROOT_WARNING 1

# Setup directory
RUN mkdir /app
WORKDIR /app

# Add files
COPY lib_injection_rails_app /app

# Install gems
RUN bundle install

# Set entrypoint
ENTRYPOINT ["/bin/bash", "-c"]

CMD ["bin/rails server -b 0.0.0.0 -p 18080"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
version: '2'

services:
reverseproxy:
image: reverseproxy:latest
ports:
- 5985:8080
restart: always
build:
context: .
dockerfile: Dockerfile.reverseproxy
healthcheck:
test: "curl -f http://localhost:8080"

ruby_3_2:
env_file: "scenario_app.env"
image: system-tests/ruby_3_2:latest
restart: always
build:
context: .
dockerfile: Dockerfile.ruby_3_2-alpine
healthcheck:
test: "curl -f http://localhost:18080"

ruby_3_1:
env_file: "scenario_app.env"
image: system-tests/ruby_3_1:latest
restart: always
build:
context: .
dockerfile: Dockerfile.ruby_3_1-alpine
healthcheck:
test: "curl -f http://localhost:18080"

ruby_3_0:
env_file: "scenario_app.env"
image: system-tests/ruby_3_0:latest
restart: always
build:
context: .
dockerfile: Dockerfile.ruby_3_0-alpine
healthcheck:
test: "curl -f http://localhost:18080"

ruby_2_7:
env_file: "scenario_app.env"
image: system-tests/ruby_2_7:latest
restart: always
build:
context: .
dockerfile: Dockerfile.ruby_2_7-alpine
healthcheck:
test: "curl -f http://localhost:18080"
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
worker_processes 1;

events { worker_connections 1024; }


http {

log_format compression '$remote_addr - $remote_user [$time_local] '
'"$request" $status $upstream_addr '
'"$http_referer" "$http_user_agent" "$gzip_ratio"';

upstream ruby_3_2_app {
server ruby_3_2:18080;
}
upstream ruby_3_1_app {
server ruby_3_1:18080;
}
upstream ruby_3_0_app {
server ruby_3_0:18080;
}
upstream ruby_2_7_app {
server ruby_2_7:18080;
}
server {
listen 8080;
access_log /var/log/nginx/access.log compression;

location / {
default_type application/json;
return 200 "{
'app_type':'multicontainer',
'apps':[{
'runtime':'3.2',
'type':'alpine',
'url':'/ruby_3_2/'
},{
'runtime':'3.1',
'type':'alpine',
'url':'/ruby_3_1/'
},{
'runtime':'3.0',
'type':'alpine',
'url':'/ruby_3_0/'
},{
'runtime':'2.7',
'type':'alpine',
'url':'/ruby_2_7/'
}
]
}";
}

location /ruby_3_2/ {
proxy_pass http://ruby_3_2_app/;
proxy_redirect off;
}
location /ruby_3_1/ {
proxy_pass http://ruby_3_1_app/;
proxy_redirect off;
}
location /ruby_3_0/ {
proxy_pass http://ruby_3_0_app/;
proxy_redirect off;
}
location /ruby_2_7/ {
proxy_pass http://ruby_2_7_app/;
proxy_redirect off;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM public.ecr.aws/nginx/nginx:stable-perl

COPY nginx.conf /etc/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
FROM public.ecr.aws/docker/library/ruby:2.7

ENV DEBIAN_FRONTEND=noninteractive

# Install prerequisites
RUN set -ex && \
echo "===> Installing dependencies" && \
apt-get -y update && \
apt-get install -y --force-yes --no-install-recommends \
curl wget tar gzip gnupg apt-transport-https ca-certificates tzdata locales && \
\
echo "===> Installing database libraries" && \
apt-get install -y --force-yes --no-install-recommends sqlite3 && \
\
echo "===> Installing dev tools" && \
mkdir -p /usr/share/man/man1 && \
apt-get install -y --force-yes --no-install-recommends \
sudo git openssh-client rsync vim \
net-tools netcat-traditional parallel unzip zip bzip2 && \
\
echo "===> Cleaning up" && \
rm -rf /var/lib/apt/lists/*;

# Set timezone to UTC by default
RUN ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime

# Upgrade RubyGems and Bundler
RUN gem update --system 3.4.1
RUN gem install bundler -v '~> 2.3.26'
RUN mkdir -p "$GEM_HOME" && chmod -R 777 "$GEM_HOME"
ENV BUNDLE_SILENCE_ROOT_WARNING 1

# Setup directory
RUN mkdir /app
WORKDIR /app

# Add files
COPY lib_injection_rails_app /app

# Install gems
RUN bundle install

# Set entrypoint
ENTRYPOINT ["/bin/bash", "-c"]

CMD ["bin/rails server -b 0.0.0.0 -p 18080"]
Loading

0 comments on commit 2a24480

Please sign in to comment.