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 can be deployed to GKE clusters using the pymacaron-gcp addon.
You will need to have:
Installed the google SDK.
Run ‘gcloud init’
Run ‘gcloud auth configure-docker’
Created two GKE clusters in your Google project: one having the name of your app suffixed with ‘–staging’ (ex: ‘helloworld-staging’) and one with ‘–live’ (ex: ‘helloworld-live’)
Configure the live cluster using the tool of your choice. PyMacaron will configure the staging cluster for you.
Installed ‘pymacaron-gcp’: pip install pymacaron-gcp
PyMacaron does not create the staging cluster. You should do it yourself and
name it ‘
PyMacaron does however configure the staging cluster, by creating a deployment, adding a service and an ingress on the first deploy, then updating the deployment on all further deploys.
PyMacaron does not create nor configure the live cluster. It only does a
rolling deploy towards it by applying a deployment named
‘
You should therefore create the cluster yourself using whatever tool you want,
but make sure that all resources you deploy share the app name
‘
When deploying to GKE, ‘pymdeploy’ goes through the following specific deployment steps:
Deploy the docker image as a new deployment to a google GKE cluster named after your app’s name suffixed with ‘-staging’. Optionally add a service and an ingress to expose the staging environment to internet.
Run the acceptance tests against the staging environment. Stop if tests fail.
Re-deploy the docker image as a new deployment to the live GKE cluster.
To be able to deploy against GKE, the following key-values must be present in your project’s pym-config.yaml:
docker_repo: <PROJECT_ID> # The ID of your gcp project
deploy_target: gke
See here for details on ‘pym-config.yaml’.