Skip to content

DevOps: Updating Ruby version

Emmanuel Nwakire edited this page Jan 15, 2025 · 3 revisions

Part 1 - Test application level changes locally

In local development:

  • Install the desired Ruby version with your Ruby version manager (rvm, rbenv, etc.)
  • Update the ruby version at the top of the Gemfile and run bundle install . Resolve any clashing dependencies. Confirm the Ruby version has changed in .ruby-version and Gemfile.lock
  • Update the Ruby version in CI config file
  • Run the tests to confirm there are no other breaking changes

Part 2 - Push new Ruby image to AWS ECR

  • Create a PR adding a Dockerfile for the new Ruby version in agilesix/Dockerfiles and get review
  • Follow instructions (DevOps: Update VA AWS ECR image ) to build new and tag Ruby image and push to VAEC ECR.

Part 3 - Confirm the new image works in DEV

On the ec2 server, change the Dockerfile image name and the Gemfile Ruby version:

cd diffusion-marketplace
vi Dockerfile 
vi Gemfile

sudo docker-compose build app 
sudo docker system prune -f

Restart the app:

./scripts/start_appcontainer.sh

Part 4 - Merge PR and Finish deployment

Update the PR with the following and merge into master after code review:

  • Update the image version in the Dockerfile
  • Change Ruby version in README
  • Update image version in Jenkins deploy scripts - both on the server and in the scripts/jenkins folder

Deploy to each environment and test using the normal deploy workflow.

Part 5 - Update secondary Jenkins scripts

  • Review all Jenkins tasks and update them to use the appropriate CONTAINER_ID.

Part 6 - Update remaining documentation

Part 7 - Current DockerFile for updating Ruby Image

ARG RELEASE=bullseye
FROM ruby:3.3.6-slim-${RELEASE} as rubyimg

# Install necessary packages and clean up
RUN apt-get update &&  \
    apt-get upgrade -y && \
    apt-get install -y systemd wget git libncurses5-dev libssl-dev autoconf patch build-essential rustc libyaml-dev  \
    libreadline6-dev zlib1g-dev libgmp-dev libffi-dev libgdbm6 libgdbm-dev libdb-dev uuid-dev ca-certificates sudo gnupg curl && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# Add VA root Certificate Authority (CA) to the trusted certs
COPY install-certs.sh .
RUN bash install-certs.sh && update-ca-certificates

# Install PostgreSQL 13
RUN apt-get update && \
    apt-get install -y lsb-release && \
    echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \
    apt-get install -y postgresql-common && \
    yes '' | /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh && \
    apt-get install -y postgresql-13

# Install Node.js using the NodeSource setup script
ARG NODE_MAJOR_VERSION=22
RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_MAJOR_VERSION}.x | bash - && \
    apt-get install -y nodejs
    
# Install ImageMagick
RUN apt-get update && \
    apt-get install -y libpng-dev libjpeg-dev libltdl-dev libfftw3-dev libdjvulibre-dev file pkg-config && \
    git clone https://github.com/ImageMagick/ImageMagick.git ImageMagick && \
    cd ImageMagick && \
    ./configure --with-png=yes && \
    make && \
    make install && \
    ldconfig /usr/local/lib && \
    magick -version
CMD [ "irb" ]

Clone this wiki locally