Skip to content

Containerized deployment, load testing, and troubleshooting for example applications

Notifications You must be signed in to change notification settings

TimSpence/observability-adventures

Repository files navigation

py-webapp-hosting

Background

A naive example of a python web app hosted in gunicorn.

Usage

This is not a production-ready application

Use this app to tune and benchmark in non-production environments.

Docker

Building

docker-compose build myapp

Running

docker-compose up

Running with Grafana

Alternatively you can run the service with a Grafana integration:

docker-compose -f docker-compose.yml -f docker-compose-grafana-prometheus.yml up

and stop the services like this:

docker-compose -f docker-compose.yml -f docker-compose-grafana-prometheus.yml down

Running with Datadog

Alternatively you can run the service with a Grafana integration. This will require a Datadog API key.

Copy .env.example to a new file named .env, uncomment the line containing DD_API_KEY, and add your key.

Start the services with this command:

docker-compose -f docker-compose-datadog.yml up

and stop the services like this:

docker-compose -f docker-compose-datadog.yml down

Testing

NOTE: the service handles requests for these domains:

  1. example.com
  2. www.example.com
  3. grafana.example.com

Be sure to add both domain names to /etc/hosts file or other domain name resolver.

curl http://example.com/
curl http://example.com/slow-endpoint

Acknowledgements

Roadmap

  • ☑️ move configuration out of build and mount into container instead
  • ☑️ provide docker-compose.yml
  • ☑️ route requests with flask
  • ☑️ pin versions to avoid accidental upgrades
  • ☑️ add health check
  • ☑️ add reverse proxy
  • ☑️ add simulated slow upstream server
  • ☑️ add simulated buggy endpoint
  • ☑️ integrate Grafana
  • ◻️ add example with process control delegated to supervisord

About

Containerized deployment, load testing, and troubleshooting for example applications

Resources

Stars

Watchers

Forks

Packages

No packages published