Skip to content

seroanalytics/seroviz

Repository files navigation

serovizlogo250

Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. 🔨 Build 🔎 Test codecov Docker Image Version GitHub License

Client-side React application for visualising serological data.

Development

Install dependencies with npm install. Then the following scripts are available.

npm start

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.

For the app to work, the serovizr API must be running on port 8888; this can be started using scripts/run-dev-dependencies.sh.

The page will reload if you make edits.
You will also see any lint errors in the console.

npm test

Runs unit tests using jest.

npm run itest

Runs integration tests using jest. This requires the serovizr API to be running; this can be started using scripts/run-dev-dependencies.sh.

npm run build

Builds the app for production to the build folder.

npm run generate-types

Auto-generates typescript types based on the serovizr API JSON schema specifications. Generated types are saved into src/generated.d.ts.

Deployment

Docker

The app is deployed using a Dockerised nginx server which also proxies the serovizr API. See the proxy/README.md for details.

  • To build the Docker image run .scripts/build.
  • To push an image to DockerHub run ./scripts/push
  • To start a copy of the app locally with a self-signed SSL certificate run ./scripts/run.

Secrets

Secrets (at the moment this is just the real SSL private key and certificate) are stored in HashiCorp Cloud Vault. To access the secrets in Vault, you need to create an account with HashiCorp Cloud and ask Alex to add you to the organization.

To deploy the app, ensure that you have the hcp CLI installed on your machine. Installation instructions here.

Deploying the app

The app is deployed onto an EC2 instance called seroviz. You will need to ask Alex for AWS console access, and to add your IP to the inbound security rules for ssh access.

Then:

  1. Retrieve hcp service principal credentials by running on your own machine (after hcp auth login):

    hcp vs secrets open production_id --app=seroviz
    hcp vs secrets open production_secret --app=seroviz
  2. ssh onto the server

  3. Navigate to the seroviz directory

  4. Run:

    ./scripts/clear-docker.sh
    ./scripts/deploy

    The deploy script will prompt you for the client id and secret from step 1.

    You can also export these as environment variables which may be more convenient in case deployment fails for any reason and has to be re-run:

    CLIENT_ID=<client_id>
    CLIENT_SECRET=<client_secret>

Setting up a new EC2 instance

(unless otherwise specified, all steps are run on the remote machine)

  • Install git:
    sudo yum -y install git
  • Install Docker, following instructions here.
  • Install the hcp cli for secret retrieval by following the instructions for Amazon Linux.
  • On your own machine, install the hcp cli if you haven't already, and retrieve the production service principal id and secret, stored at production_id and production_secret:
    hcp vs secrets open production_id --app=seroviz
    hcp vs secrets open production_secret --app=seroviz
  • On the remote server, clone this GitHub repo using https:
    git clone https://github.com/seroanalytics/seroviz.git
  • Follow the instructions above to deploy the app

Domain name

The domain name seroanalytics.org is registered with NameCheap. Contact Alex if you need to add or change a DNS record.