Tutorial

This tutorial provides you with a hands-on example on how to draw and configure a simple "To-Do" application.

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.

service added and renamed

Draw connection

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

drawing a connection between services

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.

private service configuration

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

Was this helpful?