Skip to content

Commit

Permalink
update ruby to 2.7.6
Browse files Browse the repository at this point in the history
  • Loading branch information
eitoball committed Apr 13, 2022
1 parent 56e9024 commit 40a6e18
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 39 deletions.
60 changes: 37 additions & 23 deletions .circleci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,57 @@ FROM public.ecr.aws/amazonlinux/amazonlinux:2

RUN /usr/bin/amazon-linux-extras install -y \
postgresql11 \
python3.8 \
ruby2.6
RUN /usr/bin/yum install -y \
gcc \
gcc-c++ \
git \
make \
postgresql-devel \
rpm-build \
ruby-devel \
rubygem-io-console \
shadow-utils \
sudo \
util-linux \
xorg-x11-server-Xvfb \
zlib-devel
python3.8

RUN /usr/bin/yum install -y deltarpm && \
/usr/bin/yum update -y && \
/usr/bin/yum install -y \
gcc \
gcc-c++ \
git \
libffi-devel \
libpq-devel \
make \
openssl-devel \
python38-devel \
readline-devel \
rpm-build \
shadow-utils \
sudo \
util-linux \
xorg-x11-server-Xvfb \
zlib-devel

RUN curl -sSL -o /tmp/dockerize.tgz https://github.com/jwilder/dockerize/releases/download/v0.6.1/dockerize-linux-amd64-v0.6.1.tar.gz && \
tar -xzf /tmp/dockerize.tgz -C /usr/local/bin && \
rm /tmp/dockerize.tgz

RUN curl -sSL -o /tmp/ruby-2.7.6.tar.gz https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.6.tar.gz \
&& tar -xzf /tmp/ruby-2.7.6.tar.gz \
&& cd ruby-2.7.6 \
&& ./configure \
&& make -j4 \
&& make install \
&& cd .. \
&& rm -rf ruby-2.7.6 /tmp/ruby-2.7.6.tar.gz

RUN curl -sLO https://rpm.nodesource.com/setup_14.x && \
bash setup_14.x && \
rm setup_14.x && \
yum install -y nodejs

RUN curl -sLO https://dl.yarnpkg.com/rpm/yarn.repo && \
mv yarn.repo /etc/yum.repos.d/ && \
yum install -y yarn

ADD ./docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

RUN rm /usr/bin/python && ln -s /usr/bin/python3.8 /usr/bin/python
RUN python3.8 -m pip install cryptography==3.3.2 awscli awsebcli

RUN /usr/sbin/adduser -m circleci&& usermod -aG wheel circleci
RUN /usr/bin/sed -i -e "s/^# %wheel/%wheel/" /etc/sudoers
# RUN /usr/sbin/adduser -m circleci&& usermod -aG wheel circleci
# RUN /usr/bin/sed -i -e "s/^# %wheel/%wheel/" /etc/sudoers

USER circleci
ENV PATH /home/circleci/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
RUN sudo /usr/bin/pip3.8 install --upgrade pip
RUN sudo /usr/local/bin/pip3.8 install awscli awsebcli
# USER circleci

ENTRYPOINT ["/docker-entrypoint.sh"]
9 changes: 5 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ version: 2
jobs:
build:
docker:
- image: safecast/api-build:2.6.8-amazonlinux2
- image: safecast/api-build:2.7.5-amazonlinux2
environment:
RAILS_ENV: test
AWS_DEFAULT_REGION: us-west-2
EB_APP_NAME: api
PYTHON_BIN: python3.8
- image: mdillon/postgis:11
environment:
POSTGRES_USER: safecast
Expand All @@ -19,15 +20,15 @@ jobs:
- checkout
- restore_cache:
keys:
- v4-safecastapi-{{ checksum "Gemfile.lock" }}
- v4-safecastapi-
- v5-safecastapi-{{ checksum "Gemfile.lock" }}
- v5-safecastapi-
- run:
name: Bundle Install
command: |
gem install bundler -v 2.2.29
bundle install --path vendor/bundle --jobs 2 --retry 3
- save_cache:
key: v4-safecastapi-{{ checksum "Gemfile.lock" }}
key: v5-safecastapi-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle
- run:
Expand Down
Empty file modified .circleci/docker-entrypoint.sh
100644 → 100755
Empty file.
4 changes: 3 additions & 1 deletion .elasticbeanstalk/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ PACKAGE="${VERSION}.zip"

cp config/database.yml.beanstalk config/database.yml

.elasticbeanstalk/package.py "${PACKAGE}"
PYTHON_BIN=${PYTHON_BIN:-python}

${PYTHON_BIN} .elasticbeanstalk/package.py "${PACKAGE}"

aws s3 cp --no-progress ".elasticbeanstalk/app_versions/${PACKAGE}" "s3://${S3_BUCKET_NAME}/${EB_APP_NAME}/"

Expand Down
8 changes: 8 additions & 0 deletions .platform/hooks/postdeploy/01_set_proxy_timeout_value.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

VISIBILITY_TIMEOUT=$(/opt/elasticbeanstalk/bin/get-config meta -k sqsdconfig | jq -r .visibility_timeout)
if [ -n "$VISIBILITY_TIMEOUT" ]; then
echo "proxy_read_timeout ${VISIBILITY_TIMEOUT}s;" > /etc/nginx/conf.d/worker.conf
else
echo "proxy_read_timeout 600s;" > /etc/nginx/conf.d/web.conf
fi

This file was deleted.

2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.6.8
2.7.6
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:2.6.8
FROM public.ecr.aws/docker/library/ruby:2.7.6

RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main" >> /etc/apt/sources.list.d/pgdg.list
RUN curl -q https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
Expand All @@ -13,7 +13,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \

WORKDIR /src
ADD Gemfile Gemfile.lock .ruby-version /src/
RUN gem install bundler -v 2.2.29 # Ruby 2.6 running on 64bit Amazon Linux 2/3.3.7
RUN bundle install --jobs=4 --retry=3

CMD [ "bundle", "exec", "rails", "server", "-b", "0.0.0.0" ]
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source 'https://rubygems.org'

ruby '2.6.8'
ruby '2.7.6'

gem 'rails', '~> 6.0.3.7'

Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ DEPENDENCIES
webmock

RUBY VERSION
ruby 2.6.8-p205
ruby 2.7.6-p219

BUNDLED WITH
2.2.29

0 comments on commit 40a6e18

Please sign in to comment.