Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build and deploy using Heroku containers #2514

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Deploy
on:
push:
branches: [ 'staging', 'heroku-docker' ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Heroku CLI
run: |
curl https://cli-assets.heroku.com/install.sh | sh
- name: Login to Heroku container registry
run: |
cat >~/.netrc <<EOF
machine api.heroku.com
login ${{ secrets.HEROKU_API_EMAIL }}
password ${{ secrets.HEROKU_API_KEY }}
machine git.heroku.com
login ${{ secrets.HEROKU_API_EMAIL }}
password ${{ secrets.HEROKU_API_KEY }}
EOF

heroku container:login
- name: Push containers to Heroku
run: |
heroku container:push web worker --recursive \
--app staging-partner-tools \
--arg BUNDLE_GEM__FURY__IO=${{ secrets.BUNDLE_GEM__FURY__IO }},BUNDLE_GITHUB__COM=${{ secrets.BUNDLE_GITHUB__COM }},BUNDLE_GEMS__RAILSLTS__COM=${{ secrets.BUNDLE_GEMS__RAILSLTS__COM }}
- name: Release containers to Heroku
run: 'heroku container:release web worker --app staging-partner-tools'
32 changes: 32 additions & 0 deletions Dockerfile.web
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM ruby:2.7.7

RUN apt-get update -qq && apt-get install -y build-essential nodejs npm

RUN mkdir /myapp
WORKDIR /myapp

ARG BUNDLE_GEM__FURY__IO
ARG BUNDLE_GEMS__RAILSLTS__COM
ARG BUNDLE_GITHUB__COM

ENV BUNDLE_GEM__FURY__IO ${BUNDLE_GEM__FURY__IO}
ENV BUNDLE_GEMS__RAILSLTS__COM ${BUNDLE_GEMS__RAILSLTS__COM}
ENV BUNDLE_GITHUB__COM ${BUNDLE_GITHUB__COM}

ENV RAILS_ENV production
ENV ALGOLIA_APP_ID NA
ENV ALGOLIA_API_KEY NA
ENV FRONTEND_HTTP_REQUEST_TIMEOUT 10
ENV BUNDLE_WITHOUT test:development

COPY Gemfile* .ruby-version ./
RUN gem install bundler:1.17.3
RUN bundle install -j4 --retry 5
RUN npm install -g bower
COPY . /myapp

RUN rm -rf vendor/assets/bower_components
RUN bundle exec bowndler update --allow-root --production
RUN bundle exec rake assets:precompile

CMD puma
32 changes: 32 additions & 0 deletions Dockerfile.worker
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM ruby:2.7.7

RUN apt-get update -qq && apt-get install -y build-essential nodejs npm

RUN mkdir /myapp
WORKDIR /myapp

ARG BUNDLE_GEM__FURY__IO
ARG BUNDLE_GEMS__RAILSLTS__COM
ARG BUNDLE_GITHUB__COM

ENV BUNDLE_GEM__FURY__IO ${BUNDLE_GEM__FURY__IO}
ENV BUNDLE_GEMS__RAILSLTS__COM ${BUNDLE_GEMS__RAILSLTS__COM}
ENV BUNDLE_GITHUB__COM ${BUNDLE_GITHUB__COM}

ENV RAILS_ENV production
ENV ALGOLIA_APP_ID NA
ENV ALGOLIA_API_KEY NA
ENV FRONTEND_HTTP_REQUEST_TIMEOUT 10
ENV BUNDLE_WITHOUT test:development

COPY Gemfile* .ruby-version ./
RUN gem install bundler:1.17.3
RUN bundle install -j4 --retry 5
RUN npm install -g bower
COPY . /myapp

RUN rm -rf vendor/assets/bower_components
RUN bundle exec bowndler update --allow-root --production
RUN bundle exec rake assets:precompile

CMD bundle exec rake jobs:work
38 changes: 20 additions & 18 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
ruby IO.read('.ruby-version').strip

source 'https://rubygems.org'
source 'https://gem.fury.io/h_app288206558'

# force Bundler to use SSL
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
Expand All @@ -26,6 +25,24 @@ source "https://gems.railslts.com" do
gem 'railslts-version', require: false
end

source 'https://gem.fury.io/h_app288206558' do
gem 'advice_plans', '~> 4.1.1'
gem 'agreements', '~> 2.5.0'
gem 'cream', '2.1.8'
gem 'cutback_calculator', '~> 0.13.0'
gem 'debt_and_mental_health', '~> 1.6.0'
gem 'debt_advice_locator'
gem 'debt_free_day_calculator'
gem 'debt_test', '~> 1.9.0'
gem 'decision_trees', '~> 2.3.0'
gem 'feedback', '~> 0.5.1'
gem 'mas-cms-client', '1.20.1'
gem 'mortgage_calculator', '~> 4.6.0'
gem 'payday_loans_intervention', '~> 1.9.0'
gem 'postcode_anywhere-email_validation'
gem 'quiz', '~> 1.4.0'
end

gem 'activerecord-session_store'

##############################################################
Expand All @@ -47,6 +64,7 @@ gem 'faraday', '0.9.2'
gem 'faraday-conductivity'
gem 'faraday_middleware'
gem 'kss'
gem 'lograge'
gem 'link_header'
gem 'mail'
gem 'mailjet'
Expand All @@ -56,8 +74,8 @@ gem 'nokogiri'
gem 'nunes'
gem 'opening_hours'
gem 'rollbar'
gem 'postcode_anywhere-email_validation', :source => 'https://gem.fury.io/h_app288206558'
gem 'psych', '>= 2.0.5' # https://www.ruby-lang.org/en/news/2014/03/29/heap-overflow-in-yaml-uri-escape-parsing-cve-2014-2525/
gem 'puma'
gem 'rack', github: 'rails-lts/rack', branch: 'lts-1-6-stable'
gem 'rack-rewrite'
gem 'recaptcha', require: 'recaptcha/rails'
Expand All @@ -76,28 +94,12 @@ gem 'websocket-extensions', '>= 0.1.5'
# ========
# Dependencies
gem 'adal', github: 'moneyadviceservice/azure-activedirectory-library-for-ruby'
gem 'cream', '2.1.8'
gem 'dough-ruby', github: 'moneyadviceservice/dough', branch: 'PostMessages_v5.45'
gem 'mas-cms-client', '1.20.1'
# Tools
gem 'action_plans', github: 'moneyadviceservice/action_plans', ref: '071e3c3c'
gem 'advice_plans', '~> 4.1.1'
gem 'agreements', '~> 2.5.0'
gem 'budget_planner', github: 'moneyadviceservice/budget_planner', ref: 'd72d455e'
gem 'cost_calculator_builder', github: 'moneyadviceservice/cost_calculator_builder', ref: 'a6a0ddf'
gem 'cutback_calculator', '~> 0.13.0'
gem 'debt_advice_locator', github: 'moneyadviceservice/debt-advice-locator', ref: '878f1b1'
gem 'debt_and_mental_health', '~> 1.6.0'
gem 'debt_free_day_calculator', github: 'moneyadviceservice/debt_free_day_calculator', ref: 'cc7d907'
gem 'debt_test', '~> 1.9.0'
gem 'decision_trees', '~> 2.3.0'
gem 'feedback', '~> 0.5.1'
gem 'lograge'
gem 'mortgage_calculator', '~> 4.6.0'
gem 'payday_loans_intervention', '~> 1.9.0'
gem 'pensions_calculator', github: 'moneyadviceservice/pensions_calculator', ref: '12db3f55'
gem 'puma'
gem 'quiz', '~> 1.4.0', source: 'https://gem.fury.io/h_app288206558'
gem 'savings_calculator', github: 'moneyadviceservice/savings_calculator', ref: '1ccfd87'
gem 'timelines', github: 'moneyadviceservice/timelines', ref: 'c5ee622'
gem 'wpcc', github: 'moneyadviceservice/wpcc', ref: '45a0a46'
Expand Down
100 changes: 44 additions & 56 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -51,47 +51,6 @@ GIT
friendly_id (>= 5.1.0)
rails (>= 4, < 5)

GIT
remote: https://github.com/moneyadviceservice/debt-advice-locator.git
revision: 878f1b1e5c765c15537328a78ccdd60d175b5dd9
ref: 878f1b1
specs:
debt_advice_locator (4.2.2)
active_attr
active_model_serializers (< 0.10.0)
addressable
bcrypt
coffee-rails
dough-ruby (~> 5)
draper (< 3)
geokit-rails
kaminari
mas-templating (~> 1.0.0)
rails (>= 4, < 5)
redcarpet
sass-rails (= 4.0.5)
uk_postcode
validate_url (= 1.0.0)

GIT
remote: https://github.com/moneyadviceservice/debt_free_day_calculator.git
revision: cc7d9078a2e0d5e023d13a151363ab90c7aac49e
ref: cc7d907
specs:
debt_free_day_calculator (4.2.0)
autoprefixer-rails (< 9)
bigdecimal (~> 1.3.0)
debt_finance_calculator (~> 1.1.0)
dough-ruby (~> 5.45)
draper (< 3)
email_validator (~> 1.4.0)
i18n-js (= 3.0.0.mas)
mas-fonts
meta-tags
rails (>= 4, < 5)
roadie (< 3)
sass-rails

GIT
remote: https://github.com/moneyadviceservice/dough.git
revision: 5b8851d343bdcc8b03ddf4e92c3c4655cc4a20c2
Expand Down Expand Up @@ -187,10 +146,10 @@ GEM
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
active_attr (0.16.0)
actionpack (>= 3.0.2, < 7.2)
activemodel (>= 3.0.2, < 7.2)
activesupport (>= 3.0.2, < 7.2)
active_attr (0.17.1)
actionpack (>= 3.0.2, < 8.1)
activemodel (>= 3.0.2, < 8.1)
activesupport (>= 3.0.2, < 8.1)
active_model_serializers (0.9.13)
activemodel (>= 3.2)
concurrent-ruby (~> 1.0)
Expand Down Expand Up @@ -321,6 +280,22 @@ GEM
sass-rails
database_cleaner (1.6.2)
date (3.3.4)
debt_advice_locator (4.2.2)
active_attr
active_model_serializers (< 0.10.0)
addressable
bcrypt
coffee-rails
dough-ruby (~> 5)
draper (< 3)
geokit-rails
kaminari
mas-templating (~> 1.0.0)
rails (>= 4, < 5)
redcarpet
sass-rails (= 4.0.5)
uk_postcode
validate_url (= 1.0.0)
debt_and_mental_health (1.6.0)
bcrypt
dough-ruby (~> 5.36)
Expand All @@ -332,6 +307,19 @@ GEM
sass-rails
debt_finance_calculator (1.1.0.8)
bigdecimal (> 1.2.3)
debt_free_day_calculator (4.2.0)
autoprefixer-rails (< 9)
bigdecimal (~> 1.3.0)
debt_finance_calculator (~> 1.1.0)
dough-ruby (~> 5.45)
draper (< 3)
email_validator (~> 1.4.0)
i18n-js (= 3.0.0.mas)
mas-fonts
meta-tags
rails (>= 4, < 5)
roadie (< 3)
sass-rails
debt_test (1.9.0)
autoprefixer-rails
dough-ruby (~> 5.0)
Expand Down Expand Up @@ -802,9 +790,9 @@ DEPENDENCIES
activerecord-session_store
activesupport!
adal!
advice_plans (~> 4.1.1)
advice_plans (~> 4.1.1)!
aes!
agreements (~> 2.5.0)
agreements (~> 2.5.0)!
attr_encrypted (~> 3.1)
autoprefixer-rails
better_errors
Expand All @@ -818,16 +806,16 @@ DEPENDENCIES
chronic
codeclimate-test-reporter (= 0.6.0)
cost_calculator_builder!
cream (= 2.1.8)
cream (= 2.1.8)!
csslint_ruby
cucumber-rails
cutback_calculator (~> 0.13.0)
cutback_calculator (~> 0.13.0)!
database_cleaner
debt_advice_locator!
debt_and_mental_health (~> 1.6.0)
debt_and_mental_health (~> 1.6.0)!
debt_free_day_calculator!
debt_test (~> 1.9.0)
decision_trees (~> 2.3.0)
debt_test (~> 1.9.0)!
decision_trees (~> 2.3.0)!
delayed_job_active_record
devise (~> 4.7.1)
devise-encryptable
Expand All @@ -842,7 +830,7 @@ DEPENDENCIES
faraday (= 0.9.2)
faraday-conductivity
faraday_middleware
feedback (~> 0.5.1)
feedback (~> 0.5.1)!
foreman
html_validation
jshint_ruby
Expand All @@ -852,17 +840,17 @@ DEPENDENCIES
lograge
mail
mailjet
mas-cms-client (= 1.20.1)
mas-cms-client (= 1.20.1)!
meta-tags (~> 2.4)
mortgage_calculator (~> 4.6.0)
mortgage_calculator (~> 4.6.0)!
mysql2
net-http
net-imap
net-smtp
nokogiri
nunes
opening_hours
payday_loans_intervention (~> 1.9.0)
payday_loans_intervention (~> 1.9.0)!
pensions_calculator!
postcode_anywhere-email_validation!
pry-byebug
Expand Down
Loading
Loading