Skip to content

Commit

Permalink
Merge pull request #13 from mlibrary/SEARCH-1599-update-dependencies
Browse files Browse the repository at this point in the history
Search 1599 update dependencies
  • Loading branch information
niquerio authored Apr 5, 2022
2 parents 4454ce5 + 01c3dd2 commit 7e9d3a7
Show file tree
Hide file tree
Showing 57 changed files with 626 additions and 647 deletions.
7 changes: 7 additions & 0 deletions .env-dev-values
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
MARIADB_ROOT_PASSWORD=pass
CIRCULATION_HISTORY_DATABASE_PASSWORD=circulation_history_db_password
DATABASE_HOST=database
CIRC_REPORT_PATH=/circ/report/path
PATRON_REPORT_PATH=/patron/report/path
ALMA_API_HOST=http://falma:4567
RAILS_LOG_TO_STDOUT=1
1 change: 1 addition & 0 deletions .github/workflows/build-from-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile.prod
push: true
tags: |
ghcr.io/mlibrary/${{ secrets.IMAGE_NAME }}:latest
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/manual-deploy-staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jobs:
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile.prod
push: true
tags: ghcr.io/mlibrary/${{ secrets.IMAGE_NAME }}:${{steps.tag_check.outputs.tag}}
- name: Deploy to ${{ env.environment }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/manual-deploy-testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile.prod
push: true
tags: ghcr.io/mlibrary/${{ secrets.IMAGE_NAME }}:${{steps.tag_check.outputs.tag}}
- name: Deploy to ${{ env.environment }}
Expand Down
79 changes: 35 additions & 44 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,52 +7,43 @@ jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Cache ruby gems
uses: actions/cache@v2
services:
mariadb:
image: mariadb:10
env:
cache-name: ruby-gems
with:
path: .gems
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- uses: satackey/[email protected]
# Ignore the failure of a step and avoid terminating the job.
continue-on-error: true
MARIADB_USER: circulation_history
MARIADB_PASSWORD: circulation_history_db_password
MARIADB_DATABASE: circulation_history_test
MARIADB_ROOT_PASSWORD: pass
ports: ["3306:3306"]
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3

- name: make coverage directory
run: mkdir -m777 coverage
- name: make tmp directory writeable
run: chmod -R 777 tmp
- name: make fixtures writeable
run: chmod -R 777 spec/fixtures
- name: make app/log/development.log writeable
run: |
mkdir -m777 log
touch log/development.log
chmod 777 log/development.log
- name: list files with permissions
run: |
ls -al
ls -al log
- name: Set up .env
run: cp .env-example .env
- name: Set up tests
steps:
- uses: actions/checkout@v2
- name: Create .env file
run: |
docker-compose build
docker-compose run web bundle install
- name: boot up database
run: docker-compose up -d database
- name: docker state
run: docker-compose ps
- name: wait for db
run: docker-compose run web bin/wait-for database:3306
- name: create databases
run: docker-compose run web bundle exec rails db:create
sed 's/DATABASE_HOST=database/DATABASE_HOST=127.0.0.1/' .env-dev-values > .env-actions
cat .env-example .env-actions > .env
- name: Load .env file
uses: xom9ikk/[email protected]
- name: Set up Ruby 3.1.1
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.1
bundler-cache: true
- name: Setup up node 16.14.2
uses: actions/setup-node@v2
with:
node-version: '16.14.2'
- name: Verify MariaDB connection
run: |
while ! mysqladmin ping -h"127.0.0.1" -P"3306" --silent; do
sleep 1
done
- name: Set up DB
run: bundle exec rails db:schema:load RAILS_ENV=test
- name: Run linter for Ruby
run: bundle exec standardrb
- name: Run tests
run: docker-compose run web bundle exec rspec
run: bundle exec rspec
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

# Ignore bundler config.
/.bundle
/.cache/

# Ignore all logfiles and tempfiles.
/log/*
Expand Down
25 changes: 7 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM ruby:2.7.2
ARG RUBY_VERSION=3.1
FROM ruby:${RUBY_VERSION}

ARG BUNDLER_VERSION=2.3
ARG UNAME=app
ARG UID=1000
ARG GID=1000
Expand All @@ -8,38 +11,24 @@ LABEL maintainer="[email protected]"
RUN apt-get update -yqq && apt-get install -yqq --no-install-recommends \
apt-transport-https

RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -

RUN apt-get update -yqq && apt-get install -yqq --no-install-recommends \
nodejs \
vim

#so wait-for works
RUN apt install -y netcat
vim-tiny

RUN gem install bundler:2.1.4
RUN gem install bundler:${BUNDLER_VERSION}


RUN groupadd -g ${GID} -o ${UNAME}
RUN useradd -m -d /app -u ${UID} -g ${GID} -o -s /bin/bash ${UNAME}
RUN mkdir -p /gems && chown ${UID}:${GID} /gems


COPY --chown=${UID}:${GID} Gemfile* /app/
USER $UNAME

ENV BUNDLE_PATH /gems

ENV ALMA_API_KEY YOUR_ALMA_API_KEY
ENV ALMA_API_HOST http://falma:4567
ENV CIRC_REPORT_PATH /circ/report/path
ENV PATRON_REPORT_PATH /patron/report/path
ENV MYSQL_ROOT_PASSWORD mysqlrootpassword
ENV DATABASE_HOST database
ENV PUSHMON_URL YOUR_PUSHMON_URL

WORKDIR /app
RUN bundle install

COPY --chown=${UID}:${GID} . /app

Expand Down
39 changes: 39 additions & 0 deletions Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
ARG RUBY_VERSION=3.1
FROM ruby:${RUBY_VERSION}

ARG BUNDLER_VERSION=2.3
ARG UNAME=app
ARG UID=1000
ARG GID=1000

LABEL maintainer="[email protected]"

RUN apt-get update -yqq && apt-get install -yqq --no-install-recommends \
apt-transport-https

RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -

RUN apt-get update -yqq && apt-get install -yqq --no-install-recommends \
nodejs \
vim-tiny

RUN gem install bundler:${BUNDLER_VERSION}

RUN groupadd -g ${GID} -o ${UNAME}
RUN useradd -m -d /app -u ${UID} -g ${GID} -o -s /bin/bash ${UNAME}
RUN mkdir -p /gems && chown ${UID}:${GID} /gems


COPY --chown=${UID}:${GID} Gemfile* /app/
USER $UNAME

ENV BUNDLE_PATH /gems
ENV BUNDLE_WITHOUT development:test

WORKDIR /app
RUN bundle _${BUNDLER_VERSION}_ install

COPY --chown=${UID}:${GID} . /app

CMD ["bin/rails", "s", "-b", "0.0.0.0"]

47 changes: 23 additions & 24 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
source 'https://rubygems.org'
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.7.2'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.1.1'
gem "rails", "~> 7.0.0"
# Use mysql as the database for Active Record
gem 'mysql2', '~> 0.5'
gem "mysql2", "~> 0.5"
# Use Puma as the app server
gem 'puma', '~> 5.0'
gem "puma", "~> 5.0"
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.7'
gem "jbuilder", "~> 2.7"
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
Expand All @@ -20,38 +18,39 @@ gem 'jbuilder', '~> 2.7'
# gem 'image_processing', '~> 1.2'

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.4', require: false
gem "bootsnap", ">= 1.4.4", require: false

# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
# gem 'rack-cors'

gem 'amazing_print'
gem 'rails_semantic_logger'
gem "amazing_print"
gem "rails_semantic_logger"

gem 'prometheus-client'
gem 'alma_rest_client',
git: 'https://github.com/mlibrary/alma_rest_client',
tag: '1.2.1'
gem "prometheus-client"
gem "alma_rest_client",
git: "https://github.com/mlibrary/alma_rest_client",
tag: "1.3.1"

group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
gem 'rspec-rails', '~> 4.0.2'
gem 'simplecov'
gem "byebug", platforms: [:mri, :mingw, :x64_mingw]
gem "rspec-rails"
gem "simplecov"
gem "standardrb"
end

group :test do
gem 'factory_bot_rails'
gem 'faker'
gem 'database_cleaner'
gem 'webmock'
gem "factory_bot_rails"
gem "faker"
gem "database_cleaner"
gem "webmock"
end

group :development do
gem 'listen', '~> 3.3'
gem "listen", "~> 3.3"
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
#gem 'spring'
# gem 'spring'
end

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

0 comments on commit 7e9d3a7

Please sign in to comment.