Skip to content

kovenock/mle-simple-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple App Example

Example of setting up a cloud native application using FastAPI, Docker, Pytest, GitHub Actions, and Kubernetes.

Create virtual environment

conda env create -f environment.yml

Run app in dev mode

fastapi dev main.py

Test in dev mode

curl -X 'POST' \
  'http://127.0.0.1:8000/' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "test item",
  "description": "test",
  "value": 100
}'

Run tests

pytest tests

Build docker image

docker build -t simple-app .

Start docker container

docker run -d --name simple-app-container -p 80:80 simple-app

Test containerized application

curl -X 'POST' \
  'http://localhost:80/' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "test item",
  "description": "test",
  "value": 100
}'

GitHub Actions

Several tests will run when there is a push or pull request to the git main branch. These are defined in ./github/workflows/ and include:

  • run pytests (see ./tests/)
  • build and test docker container

Next Steps

  1. Set up local Kubernetes cluster using Minikube. Deploy containerized app.
  2. Update set up to include more than one microservice.

About

Simple App Example

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published