Skip to content
This repository was archived by the owner on Jan 3, 2023. It is now read-only.

Development Environment

Emily edited this page Nov 17, 2019 · 4 revisions

In order to allow development of these tools across multiple different operating systems and environments, Docker was used. Docker is a containerisation tool which allows software environments (called containers) to be defined through configuration files, and allows developers to launch environments matching these environments exactly (in the form of virtual machines) to be spun up using a single command.

The Docker configuration used for this project can be found here, however a summary of the important information and snippets of the docker-compose.yml file are outlined below.

Database

A PostgreSQL database (described further in the architecture section) was used for this project.

services:
  db:
    container_name: psql
    restart: always
    image: psql
    build:
      context: ./db
    volumes:
      - ./db/data/:/var/lib/postgresql/data
      - ./db/config.conf:/etc/postgresql.conf

The above configuration sets up a container for this PostgreSQL database, giving it a name, and defining where data relating to the database should be stored.

GraphQL

GraphQL was also used in this project as a wrapper around this database. GraphQL is a query language which allows queries to be made to a wide variety of databases using JSON-style queries. This is configured within the environment as follows:

  graphql:
    container_name: graphql
    restart: always
    image: graphile/postgraphile
    depends_on:
      - db
    ports:
      - 5000:5000
    links:
      - db

This configures the graphql container to run on port 5000, and links it to the PostgreSQL database (with the database as a dependency).

Redis

A Redis database was also used in the project. This Redis database is an in-memory database used by the express middlemare servers to send requests to the backend processes (this is described in more detail in the section on architecture).

  redis:
    container_name: redis
    restart: always
    image: redis
    ports:
      - 6379:6379
    volumes:
      - ./db/redis/data/:/data

Application Configuration

A separate configuration was also added for each application within this project. The MoSS web portal is configured as follows:

  moss:
    container_name: moss
    restart: always
    image: moss
    build:
      context: ./middleware/moss
    depends_on:
      - graphql
      - redis
    environment:
      DEV: auth:*
      GRAPHQL_SERVER: graphql
      REDIS_SERVER: redis
    expose:
      - 3050
    ports:
      - 4050:3050
    links:
      - graphql
      - redis

It has GraphQL and Redis as dependencies (as it uses both of these services). The DEV: auth:* is used for debug mode, and is explained further in the section on authentication handling.

Allocate is configured similarly, except it exposes port 3051, and runs on ports 4051:3051.

Floodgate (the queue) is also configured similarly, except does not depend on Redis. It also port 3050, and runs on ports 4050:3050.

Egress

The main dashboard itself is configured to depend on all the applications described above, and is configured as follows:

  dashboard:
    container_name: dashboard
    restart: always
    image: server
    build:
      context: ./frontend
    depends_on:
      - queue
      - moss
      - allocate
    environment:
      VUE_APP_QUEUE_PORT: 4000
      VUE_APP_MOSS_PORT: 4050
      VUE_APP_ALLOC_PORT: 4051
    ports:
      - 5678:8080
    links:
      - queue
      - moss
      - allocate

This Docker setup allows the applications to be launched by running the single docker-compose up command. If changes are made to the configuration or any of the applications, the source can be rebuilt by instead running docker-compose up --build. This allows for easier development as part of a group.

Clone this wiki locally