10000 GitHub - python-microservices/microservices-scaffold at 2.0.0
[go: up one dir, main page]

Skip to content

python-microservices/microservices-scaffold

Repository files navigation

microservices-scaffold

Python Microservice Scaffold is an example of how to structure a Flask Microservice Project. This Scaffold is build over PyMS package. PyMS is a Microservice chassis pattern like Spring Boot (Java) or Gizmo (Golang). PyMS is a collection of libraries, best practices and recommended ways to build microservices with Python which handles cross-cutting concerns:

  • Externalized configuration
  • Logging
  • Health checks
  • Metrics (TODO)
  • Distributed tracing

Build Status Coverage Status Requirements Status Updates Python 3

How to run the scaffold

Instalation

virtualenv --python=python[3.6|3.7|3.8] venv
source venv/bin/activate
pip install -r requirements.txt

Run your python script

python manage.py runserver

Check the result

Your default endpoint will be in this url:

http://127.0.0.1:5000/template/

This URL is setted in your config.yml:

ms:
  DEBUG: false
  TESTING: false
  APP_NAME: Template
  APPLICATION_ROOT : /template # <!---

You can acceded to a swagger ui in the next url:

http://127.0.0.1:5000/template/ui/

This PATH is setted in your config.yml:

pyms:
  swagger:
    path: "swagger"
    file: "swagger.yaml"
    url: "/ui/" # <!---

Read more info in the documentation page: https://microservices-scaffold.readthedocs.io/en/latest/

Docker

You can dockerize this microservice wit this steps:

  • Create and push the image

    docker build -t template -f Dockerfile .

  • Run the image:

    docker run -d -p 5000:5000 template

Kubernetes

You can run this microservice in a Kubernetes cluster with:

kubectl apply -f service.yaml

See a simple tutorial in the doc

How to contrib

See https://github.com/python-microservices/pyms/blob/master/CONTRIBUTING.md

Update docs

sphinx-build -b html docs/ _build

0