Skip to content

Support the 12-factor FastAPI framework for charms #59

Description

@dwilding

After #45, we should consider whether the rock should support Charmcraft's 12-factor FastAPI framework. It would be nice to use the rock to demonstrate the benefits of the framework when developing a charm.

To support the framework, at minimum we'd need to:

  • Call the Pebble service fastapi - we can do this in #45.
  • Rename environment variables from DEMO_SERVER_DB_* to POSTGRESQL_DB_*.
  • Instead of hardcoding the database name, use os.environ.get("POSTGRESQL_DB_NAME", "names_db"). The framework sets POSTGRESQL_DB_NAME based on the app name.

See https://documentation.ubuntu.com/charmcraft/4.3/reference/extensions/fastapi-framework-extension/

The changes would have downstream impact - primarily the Kubernetes charm tutorial in Ops.

Metadata

Metadata

Assignees

No one assigned

    Labels

    rainy daySmall items done in ~10% of each week's time

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions