Skip to content

Run and debug backend Flask applications

Filippo Ledda edited this page Feb 26, 2021 · 1 revision

Local debug

In order to debug your application locally you can run __main__.py to run as a plain flask application.

Depending on what your application uses of the infrastructure you may need to define some environmental variables and files.

The main file that the cloudharness applications will look for is /opt/cloudharness/resources/allvalues.yaml. This value is a copy of values.yaml that is generated by harness-deployment as deployment/helm/values.yaml. Can copy/link that file to /opt/cloudharness/resources/allvalues.yaml or set the environmental variable CH_VALUES_PATH to use a different path.

In-cluster debug with VS code

Remote debug can be achieved through Skaffold by using the Cloud Code extension for Visual studio code. All required configurations for Skaffold and VS code are generated by the harness-deployment command.

  1. Setup kubectl to use your remote cluster or minikube*. Set the default namespace to be the same namespace you are making the deployment (the same specified on running harness-deployment)
  2. Install Skaffold: see https://skaffold.dev/docs/install/
  3. Install Cloud Code extension on VS Code: https://cloud.google.com/code/docs/vscode/quickstart-local-dev#installing
  4. Launch the "CloudHarness: run/debug configuration" image

Build/deploy with skaffold

Skaffold configuration is generated by harness-deployment.

Can build and deploy with Skaffold with:

skaffold dev --namespace=[NAMESPACE] (local minikube)

skaffold dev --namespace=osb2 --default-repo=[DOCKER_REGISTRY] (external cluster or forwarded minikube)