A python microservice framework
Overview
Quick start
Project files
OpenAPI specification
API objects
Server code
Deployment pipeline
Docker packaging
JWT authentication
Configuration
Error handling
Asynchronous execution
Database serialisation
Testing
Monitoring
PyMacaron microservices are designed to support multiple deployment targets. Currently, both AWS Beanstalk and Google Cloud Run are supported.
bin/pymdeploy implements the deployment pipeline of PyMacaron microservices, which consists of the following steps:
Execute unittests under ‘test/’ with nosetests. Stop if tests fail.
Generate a docker image in which the app starts inside gunicorn.
Start this image in a local docker instance and run acceptance tests from the ‘testaccept/’ directory against it. Stop if tests fail.
Push that image to a container registry, either docker.io or gcr.io.
Deploy the image to a cloud environment: either by creating a new Beanstalk environment on AWS, or by doint a rolling deploy to a staging environment in GKE or Google Cloud Run.
Run acceptance tests against the cloud environment. Stop if they fail.
Deploy the image to a live cloud environment: either by doing a blue/green deployment of the newly created Beanstalk environment on AWS, or by re-deploying the image to a live environment on GKE or Google Cloud Run.
Run acceptance tests again, this time against the live environment, as a final validation.
To execute the full deployment pipeline, do:
cd your-project-root
pymdeploy
For more usage examples, see ‘pymdeploy –help’.
See instructions here.
See instructions here.
See instructions here.
How can a pymacaron service know if it is being executed inside a container started by ‘pymtest’, or in a staging respectively live deployment on google cloud or aws? By looking at the ‘PYM_ENV’ environment variable, documented here.