Skip to content

Commit

Permalink
ci: introduce compose to launch full setup
Browse files Browse the repository at this point in the history
  • Loading branch information
macite committed Dec 22, 2021
1 parent eb8d780 commit a985ecf
Show file tree
Hide file tree
Showing 6 changed files with 167 additions and 88 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: create-doubtfire-deployment
on:
push:
tags:
- 'v*'
branches:
- '*.x'
- 'development'
- 'main'
deployment:
workflow_dispatch:
jobs:
docker-overseer:
environment: deployment-secrets
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
if: github.event_name != 'pull_request'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Setup meta for overseer
id: docker_meta
uses: docker/metadata-action@v3
with:
images: lmsdoubtfire/overseer
tags: |
type=ref,event=tag
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Build and push overseer
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ RUN bundle install
# RUN mkdir /home/overseer/work-dir
# && chown -R 1001:999 /home/overseer/work-dir \
# && chmod -R 777 /home/overseer/work-dir

COPY . /app/

CMD bundle exec ruby ./app.rb
53 changes: 0 additions & 53 deletions development.Dockerfile

This file was deleted.

46 changes: 46 additions & 0 deletions development.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#
# Rails environment
#
RAILS_ENV=development

TZ=Australia/Melbourne

# Database settings
DF_DEV_DB_ADAPTER=mysql2
DF_DEV_DB_HOST=doubtfire-dev-db
DF_DEV_DB_DATABASE=doubtfire-dev
DF_DEV_DB_USERNAME=dfire
DF_DEV_DB_PASSWORD=pwd

# Database and auth related secrets
DF_SECRET_KEY_BASE=test-secret-key-test-secret-key!
DF_SECRET_KEY_ATTR=test-secret-key-test-secret-key!
DF_SECRET_KEY_DEVISE=test-secret-key-test-secret-key!

# Student work location (in container)
DF_STUDENT_WORK_DIR=/student-work

# Institution settings
DF_INSTITUTION_HOST=http://localhost:3000
DF_INSTITUTION_PRODUCT_NAME=OnTrack

# Overseer
OVERSEER_ENABLED=1
RABBITMQ_HOSTNAME=doubtfire-mq
RABBITMQ_USERNAME=secure_credentials
RABBITMQ_PASSWORD=secure_credentials

# Mail settings
DF_MAIL_DELIVERY_METHOD=test

# Authentication settings
DF_AUTH_METHOD=database

# AAF settings - for testing on local host
DF_AAF_ISSUER_URL=https://rapid.test.aaf.edu.au
DF_AAF_AUDIENCE_URL=http://localhost:3000
DF_AAF_CALLBACK_URL=http://localhost:3000/api/auth/jwt
DF_AAF_IDENTITY_PROVIDER_URL=https://signon-uat.deakin.edu.au/idp/shibboleth
DF_AAF_UNIQUE_URL=https://rapid.test.aaf.edu.au/jwt/authnrequest/research/Ag4EJJhjf0zXHqlKvKZEbg
DF_AAF_AUTH_SIGNOUT_URL=https://sync-uat.deakin.edu.au/auth/logout
DF_SECRET_KEY_AAF=v4~LMFLzzwRGZdju\5QBa@FiHIN9
23 changes: 0 additions & 23 deletions docker-compose.development.yml

This file was deleted.

82 changes: 70 additions & 12 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,75 @@
version: "3"
version: '3'
services:
app:
container_name: overseer
image: akashagarwal7/overseer:production-1.0
command: bundle exec ruby ./app.rb
doubtfire-api:
container_name: web-doubtfire-api
image: lmsdoubtfire/doubtfire-api:6.0.x-dev
ports:
- "3000:3000"
volumes:
- ../data/tmp:/doubtfire/tmp
- ../data/student-work:/student-work
depends_on:
- dev-db
- doubtfire-mq
env_file: development.env

overseer-receive:
image: lmsdoubtfire/doubtfire-api:6.0.x-dev
env_file: development.env
volumes:
- ../data/tmp:/doubtfire/tmp
- ../data/student-work:/student-work
command: /bin/bash -c "bundle exec rake register_q_assessment_results_subscriber"

overseer-worker-1:
build: .
env_file: development.env
environment:
DOCKER_HOST: host.docker.internal
CONTAINER_NAME: overseer-container-1
HOST_XFS_VOLUME: /stage/ontrack-overseer-1
volumes:
# Docker socket path - required.
- ${DOCKER_SOCKET_PATH}:/var/run/docker.sock
# Host path for writing the output of execution - required.
- ${HOST_XFS_VOLUME}:/home/overseer/work-dir
# TODO: Test by mounting an actual XFS volume.
# /stage/ontrack-overseer-[1-4]
- ../data/overseer-instances/1:/home/overseer/work-dir
# Path for reading OnTrack files from - required.
# Is maped directly to itself as the path will be a part of the messages
# TODO: Map this directly to a constant path that can be written to,
# as the path will be a part of the messages
# received from OnTrack via RabbitMQ.
# OnTrack will have to provide correct FACL
# for overseer to write to it directly.
- ${ONTRACK_VOLUME}:${ONTRACK_VOLUME}
# TODO: Make the path rw by overseer in docker image.
- ../data/student-work:/student-work
command: /bin/bash -c "bundle exec ruby ./app.rb"

dev-db:
container_name: doubtfire-dev-db
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: db-root-password
MYSQL_DATABASE: doubtfire-dev
MYSQL_USER: dfire
MYSQL_PASSWORD: pwd
volumes:
- ../data/database:/var/lib/mysql

doubtfire-web:
container_name: doubtfire-web
image: lmsdoubtfire/doubtfire-web:6.0.x-dev
command: /bin/bash -c 'npm install; npm start'
ports:
- "4200:4200"
depends_on:
- doubtfire-api

doubtfire-mq:
container_name: df-prod-mq
image: rabbitmq:3.8-management
ports:
- 15672:15672
volumes:
- ../data/rabbitmq/data/:/var/lib/rabbitmq
- ../data/rabbitmq/log/:/var/log/rabbitmq
environment:
RABBITMQ_DEFAULT_USER: secure_credentials
RABBITMQ_DEFAULT_PASS: secure_credentials

0 comments on commit a985ecf

Please sign in to comment.