Tutorial

Draw and configure a simple Todo app

App source code here: https://gitlab.com/opscanvas-public/todo.

New diagram

  • Name: todo-app

  • Cloud: AWS

  • Managed services: 1x RDS Postgres

Add private service

Drag service onto the canvas. Name it Todo-API.

Draw connection

Draw a line connecting the Todo-API to the Postgres database.

Configure private service

You can use the todo API available in our public ECR registry. To do so, fill out the service configuration form with the following variables:

  • Listen port: 8000

  • Is private: false (un-ticked)

  • Image reference: registry.dev.opscanvas.io/test/todo-api:1.0.0

  • Username: test

  • Password: TestOpsCanvas1

It will take a few seconds for the image to be copied over.

Add environment variables

The Todo API is a python app built with FastAPI and asyncpg, it is configured with 6 environment variables:

  • DB_HOST (Text) -> rds_postgres:db_host (select from dropdown)

  • DB_NAME (Text) -> rds_postgres:db_name(select from dropdown)

  • DB_PORT(Number) -> rds_postgres:port(select from dropdown)

  • DB_USER (Text) -> rds_postgres:db_username(select from dropdown)

  • ROOT_PATH (Text) -> /todo-api

  • DB_PASSWORD (Secret) -> rds_postgres:db_password(select from dropdown)

When OpsCanvas launches your application it creates a Kubernetes cluster and installs your private services into that. It configures load balancers to route traffic to services based on their name.

The ROOT_PATH variable is used by FastAPI to route requests to the OpenAPI documentation for the service.

Last updated