Skip to content

Basic Express service with MongoDB, deployed on Kubernetes.

License

Notifications You must be signed in to change notification settings

AsadHasan/express-mongo-kubernetes

Repository files navigation

Express Mongo Service

A basic API, built using Express server and MongoDB database (with Mongoose ORM), bootstrapped using Google Typescript Style-guide. It contains following endpoints:

  1. GET /testcases: Returns list of existing test cases.
  2. POST /test-case: Creates a test case, based on following request body:
{
    "name": string,
    "summary": string,
    "description": string
}

To deploy and run

Use either of following 2 options:

  1. Docker-compose (for local dev): Run docker-compose run --rm express (requires docker-compose)
  2. Kubernetes (Requires Helm and an available Kubernetes cluster):
    1. Package a Helm chart: helm package helm/ -d charts/ (creates chart in new ./charts directory)
    2. Install the Helm chart: helm install express-mongo-release charts/express-mongo-0.0.1.tgz (creates Helm release express-mongo-release on available cluster. Caveat: Have tested this only on minikube locally, not on any cloud (AWS, GCP etc) cluster!)

Testing

Basic end-to-end tests exist in tests folder, that can be run via the npm run e2e-tests script (requires docker-compose). Tests call the API via Axios and run via ts-jest.

CI

Docker image and Helm chart being published via GitHub Actions.

Issues

Helm chart has been created (via Kompose). It can be packaged and installed on Kubernetes, however Mongo does not store data in a persistent volume or similar.