Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

modify dockerfile to use phusion passenger image #1

Draft
wants to merge 30 commits into
base: feature/docker-containerisation
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1a1d51b
Fix/app memory allocation (#1133)
Gubbsy Aug 4, 2023
b5da4f3
reordered reconnection report data (#1132)
JJD1990 Aug 7, 2023
2fc89d0
Feature/manifest to increase disk for uat prod (#1134)
ptrelease Aug 7, 2023
6308199
Fix/org name length 255 (#1135)
JJD1990 Aug 8, 2023
0728d2c
Fix/unticked mission (#1136)
JJD1990 Aug 9, 2023
9561121
added project title conditional to get main contact apps method (#1137)
etelish Aug 9, 2023
485fe97
Enabled session timeout (#1138)
ptrelease Aug 10, 2023
add0a9c
Feature/amend longer session (#1140)
ptrelease Aug 11, 2023
27f53a0
replaced email input field with label and override update_resource me…
etelish Aug 11, 2023
5734e94
Bump semver from 5.7.1 to 5.7.2 (#1120)
dependabot[bot] Aug 21, 2023
a244c9b
Bump puma from 4.3.12 to 5.6.7 (#1141)
dependabot[bot] Aug 22, 2023
42fda82
Fix/cc no not sure (#1142)
JJD1990 Aug 24, 2023
6ef4cc8
inital regex alteration to enforce domains in email validation (#1146)
JJD1990 Sep 20, 2023
82020dc
Feature/create ogranisation model spec (#1148)
JJD1990 Sep 25, 2023
313be4e
modify dockerfile to use phusion passenger image
dreamfall Sep 26, 2023
bc375a1
allow to monitor both running processes
dreamfall Sep 26, 2023
09dbb01
Create .tool-versions
matthewford Sep 26, 2023
0cc33d6
Remove CF utils gem and fix asset compilation in docker
matthewford Sep 26, 2023
686cc23
Update storage.yml
matthewford Sep 26, 2023
9028a94
Delete web-entrypoint.sh
matthewford Sep 26, 2023
f1e0eab
Fix DB host fallback preventing tests to run
Lubosky Sep 27, 2023
cd0bdb3
Add workflow to deploy application to Azure container
Lubosky Sep 27, 2023
3ea67e4
Merge branch 'feature/bitzesty-ci-containerisation' into feature/dock…
Lubosky Sep 27, 2023
d3e0010
Switch Docker image to use Foreman and Ruby base image
matthewford Sep 27, 2023
6e39cc0
Merge branch 'feature/docker-containerisation-phusion-image' of https…
matthewford Sep 27, 2023
bf461cc
Update Gemfile.lock
matthewford Sep 27, 2023
6a3eff9
Set node-version to 16.20.2
matthewford Sep 27, 2023
2e1b07d
Make workflow to deploy to `uat`
Lubosky Sep 27, 2023
d2185e4
Add workflow to deploy application to Azure container
Lubosky Sep 27, 2023
c3fc326
Switch from GitHub to Azure container registry
Lubosky Oct 3, 2023
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
56 changes: 22 additions & 34 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,49 +1,37 @@
# Replicates gitignore - but keeps .env for local development
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'
# See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files.

# Ignore git directory.
/.git/

# Ignore bundler config.
/.bundle

/db/*.sqlite3
/db/*.sqlite3-journal
# Ignore all default key files.
/config/master.key
/config/credentials/*.key

# Ignore all environment files.
/.env*
!/.env.example

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep

# Ignore uploaded files in development.
# Ignore pidfiles, but keep the directory.
/tmp/pids/*
!/tmp/pids/.keep

# Ignore storage (uploaded files in development and any SQLite databases).
/storage/*
!/storage/.keep
/tmp/storage/*
!/tmp/storage/.keep

# Ignore assets.
/node_modules/
/app/assets/builds/*
!/app/assets/builds/.keep
/public/assets
.byebug_history

# Ignore master key for decrypting credentials and more.
/config/master.key

/public/packs
/public/packs-test
/node_modules
/node_modules/.cache/
/yarn-error.log
yarn-debug.log*
.yarn-integrity

# Credentials - env is copied if present
# but env is never present in source control.
# so docker can only copy when running locally
.env
.dockersenv

# Ignore Mac specific files
.DS_Store

/package-lock.json

# Salesforce logs
lib/apis/salesforce/log
130 changes: 130 additions & 0 deletions .github/workflows/azure-deploy-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: Build, test & deploy to Azure Web App

env:
AZURE_WEBAPP_NAME: funding-frontend # Name set within Azure Web App
REGISTRY: ghcr.io

on:
workflow_dispatch:

permissions:
contents: read
packages: write

jobs:
test:
runs-on: ubuntu-latest
services:
db:
image: postgres:11-alpine
ports: ['5432:5432']
env:
POSTGRES_DB: funding_frontend_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 15s
--health-retries 5
redis:
image: redis
ports: ['6379:6379']
options: --entrypoint redis-server

steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.1
- uses: actions/setup-node@v2-beta
with:
node-version: '16'
- run: npm install -g yarn
- uses: nanasess/setup-chromedriver@master

- name: Build and run tests
env:
DATABASE_URL: 'postgresql://postgres:postgres@localhost:5432/funding_frontend_test'
BUNDLER_VERSION: 2.3.11
DOCKER_TLS_CERTDIR: ''
run: |
sudo apt update
sudo apt-get -yqq install postgresql postgresql-client libpq-dev xvfb unzip libcurl4 libcurl3-gnutls libcurl4-openssl-dev
gem install bundler
gem update --system && gem update bundler
yarn install
bundle install --jobs 4 --retry 3
RAILS_ENV=test bundle exec rake db:setup
RAILS_ENV=test RAILS_DISABLE_TEST_LOG=true bundle exec rspec

buildx:
runs-on: ubuntu-latest
needs: [test]
if: github.ref == 'refs/heads/master'

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ github.token }}

- name: Lowercase the repository name and username
run: echo "REPOSITORY=${GITHUB_REPOSITORY,,}" >> ${GITHUB_ENV}

- name: Build the container image and push it to the registry
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:${{ github.sha }}
file: ./Dockerfile

deploy:
runs-on: ubuntu-latest
needs: [buildx]

permissions:
contents: none

environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}

steps:
- name: Lowercase the repository name and username
run: echo "REPOSITORY=${GITHUB_REPOSITORY,,}" >> ${GITHUB_ENV}

- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
images: '${{ env.REGISTRY }}/${{ env.REPOSITORY }}:${{ github.sha }}'
116 changes: 116 additions & 0 deletions .github/workflows/azure-deploy-uat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: Build, test & deploy to Azure Web App

env:
AZURE_WEBAPP_NAME: uat

on:
workflow_dispatch:

permissions:
contents: read
packages: write

jobs:
test:
runs-on: ubuntu-latest
services:
db:
image: postgres:11-alpine
ports: ['5432:5432']
env:
POSTGRES_DB: funding_frontend_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 15s
--health-retries 5
redis:
image: redis
ports: ['6379:6379']
options: --entrypoint redis-server

steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.1
- uses: actions/setup-node@v2-beta
with:
node-version: '16.20.2'
- run: npm install -g yarn
- uses: nanasess/setup-chromedriver@master

- name: Build and run tests
env:
DATABASE_URL: 'postgresql://postgres:postgres@localhost:5432/funding_frontend_test'
BUNDLER_VERSION: 2.3.11
DOCKER_TLS_CERTDIR: ''
run: |
sudo apt update
sudo apt-get -yqq install postgresql postgresql-client libpq-dev xvfb unzip libcurl4 libcurl3-gnutls libcurl4-openssl-dev
gem install bundler
gem update --system && gem update bundler
yarn install
bundle install --jobs 4 --retry 3
RAILS_ENV=test bundle exec rake db:setup
RAILS_ENV=test RAILS_DISABLE_TEST_LOG=true bundle exec rspec

build-and-deploy:
runs-on: ubuntu-latest
needs: [test]
if: github.ref == 'refs/heads/master'

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Login via Azure CLI
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Lowercase the repository name and username
run: echo "REPOSITORY=${GITHUB_REPOSITORY,,}" >> ${GITHUB_ENV}

- name: Build and push image
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- run: |
docker build . -t ${{ secrets.REGISTRY_LOGIN_SERVER }}/${{ env.REPOSITORY }}/${{ env.AZURE_WEBAPP_NAME }}:${{ github.sha }}
docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/${{ env.REPOSITORY }}/${{ env.AZURE_WEBAPP_NAME }}:${{ github.sha }}

- name: Deploy to Azure Container Instance
uses: azure/aci-deploy@v1
with:
resource-group: ${{ secrets.RESOURCE_GROUP }}
dns-name-label: ${{ secrets.RESOURCE_GROUP }}${{ github.run_number }}
image: ${{ secrets.REGISTRY_LOGIN_SERVER }}/${{ env.REPOSITORY }}/${{ env.AZURE_WEBAPP_NAME }}:${{ github.sha }}
registry-login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
registry-username: ${{ secrets.REGISTRY_USERNAME }}
registry-password: ${{ secrets.REGISTRY_PASSWORD }}
name: ${{ env.AZURE_WEBAPP_NAME }}
location: uksouth
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:

- uses: actions/setup-node@v1
with:
node-version: '16.14.2'
node-version: '16.20.2'

- uses: ruby/setup-ruby@v1
with:
Expand Down
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16.20.2
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruby 3.1.4
Loading
Loading