Skip to content

ithaka/jaip-backend-public-mirror

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JAIP Backend

This repository Capstan-deploys the JAIP Backend, so that it is service-locatable by the JAIP frontend.

Development Setup

Requirements

  1. We use yarn for dependency management. Install this tool before developing in this codebase.
  2. This project requires a postgres database. A Prisma schema is included. See the Database section of this guide for more information on identifying the appropriate DATABASE_URL.
  3. Development in this project requires access to the ITHAKA CLI tool and the ITHAKA VPN in order to take advantage of the Polaris sidecar for service discovery.

Install Dependencies

$ yarn install

Environment

Check the example.env file to see the required environment variables used in local development (e.g., for a database connection). Add a .env file in the project's root directory containing appropriate values, as described in the example.

Database

The database URL is kept in AWS Parameter Store, and is used to connect to the database. The correct values are available at /test/labs/jaip/jaip-backend/database_url and /prod/labs/jaip/jaip-backend/database_url. Generally, you should only need to use the test database, but it is occasionally useful to use production data locally, especially when handling bug reports. In that case change the ENVIRONMENT to prod and the DATABASE_URL to the production database URL. Using production data will also require a change to the ITHAKA sidecar command used for service discovery (use ithaka sidecar polaris --env prod). Obviously, be extremely cautious when working with production data.

There are only two databases for this application: test and prod. There is no development database at present. For most purposes, the test database should be fine for local development.

Development

  1. Start the Polaris sidecar. Generally, use
ithaka sidecar polaris

If it is necessary to work with production data, use

ithaka sidecar polaris --env prod
  1. Start the local server
yarn dev
  1. Verify the server is running at localhost:8080/api/v2/healthcheck. This should confirm that the server, Polaris service discovery, and the database connection are all running. Expected response:
{
    "server":true,
    "service_discovery":true,
    "db":true
}

Testing

Jest unit tests are run in Gitlab as part of the CI/CD pipeline with the command yarn test:ci. To test locally, use yarn test.

Building & Deployment

Deployment is handled by Gitlab CI. There are test, deploy, and undeploy jobs defined in the .gitlab-ci.yml file, found in the project root.

The application is deployed to the ITHAKA POW platform known as Capstan. Capstan is a POW sanctioned Kubernetes cluster with first-class support for logging (to captains-log), metrics via prometheus, viewed in grafana, and visual graphs (argo) of each deployed application on the platform. It also provides high reliability and scalability with the help of Kubernetes.

Environment Specific Configurations

You can find these in the k8s directory at the project root.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •