Skip to content

Latest commit

 

History

History

echo-fastapi

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

echo-fastapi

Echo fastapi is a minimal Cloud Deployer called by subscriptions of all cloud deploy message types and echoing back the details of that message and the configurations passed to the execute() method.

User story

As an engineer, I want an example extension demonstrating usage of the python-extension library. It would also be useful if this example extension emitted pubsub message contents I can better understand the attribute conditions needed to build other extensions.

Configuration schema

enabled - a boolean that enables or disables the extension. If not present the extension is disabled.

Developing

  1. Install python and pip if necessary. Use pip to install poetry.

    pip install poetry
  2. Create your virtual env and install all dependencies via poetry

    poetry install
  3. Launch the service locally:

    poetry run uvicorn src.main:app --host 0.0.0.0 --port 8080 --reload
  4. Verify the healthcheck endpoint and send a test payload:

    http localhost:8080

Deploying

  1. authenticate to GCP:

    # follow URL and paste the secret
    gcloud auth login --update-adc
    # set a terraform recognized env var
    export GOOGLE_OAUTH_ACCESS_TOKEN=$(gcloud auth print-access-token)
  2. build the deployer container image using cloud build:

    gcloud builds submit \
        --project=${PROJECT_ID} \
        --region=us-central1 \
        --tag us-docker.pkg.dev/${PROJECT_ID}/cloud-deploy-extensions/echo-fastapi:latest .
  3. deploy all dependent infrastructure using resources in the terraform/cloud-deploy-extension directory at the repo root. Using the terragrunt-based demo at the repo root as an example:

    cd demo/terragrunt/echo-fastapi
    terragrunt apply