Skip to content

Running

peder2911 edited this page Jun 3, 2021 · 12 revisions

Running ViEWS 3

Prerequisites:

  • docker => 19.03.8
  • docker-compose >= 1.28.6
  • Azure SP credentials

ViEWS 3 is a system of services. Each service runs in a separate process, and communicates with other services over HTTP. The system runs in Docker, and can easily be put up using the provided Docker Compose file.

Although service based architectures have a lot of advantages, both in terms of performance, maintainability and concern isolation, they can also be a bit tricky to develop on. Not to worry! This step by step guide shows you how.

Security

ViEWS 3 uses Azure both for storing Docker Images, and for storing cached data. The Azure resources are not generally accessible, and require authentication to reach. You authenticate to Azure by providing an auth-file to the running containers.

To make the containers aware of the auth-file, create a file named .env in the directory containing the views 3 meta repo containing the following line:

AUTH_FILE=../path/../to/../auth/../file.env

This passes the authentication information on to each container, allowing them to communicate with Azure.

Running

Clone the prio-data/views3 repository. Then, inside the repo folder, do

docker-compose pull

This fetches the latest version of the images for each of the services. Once you have these, and you've placed the SP file in the ./sp folder, you can run

docker-compose up

Congratulations! You now have ViEWS3 running locally on your computer.

Developing

To develop on the services comprising ViEWS 3, you need to rebuild and replace services with changes. First of all, you need the code for all of the services. If you have already cloned the prio-data/views3 meta-repository, enter it and run:

git submodule init
git pull --recurse-submodules

This downloads the repository for each service. You make changes to a service by editing the code within one of the repositories. Once you have edited some code, and want to see how it works in concert with the other services, run:

docker-compose build

Then to start the composition, you run

docker-compose up

A very practical one-liner that rebuilds and restarts only the services that have changed is:

docker-compose build && docker-compose up --no-deps -d

This lets you quickly iterate on services, seeing how they work after a quick compile-step.

Publishing changes

The process of updating ViEWS3 on the server is as follows:

  1. Changes are committed to github
  2. A new docker image is built and pushed to our internal Docker registry
  3. Images are pulled on our server (docker-compose pull)
  4. The services are restarted (docker-compose restart)

Currently, the service principal we're using doesn't have push rights, so pushing a new image to prioreg cannot be done by everyone. If you need to get in updates without this privilege, you could log onto hermes, clone the integration repo with --recurse-submodules, and run docker-compose build. Then when you run docker-compose up, you'll be running with fresh images.