Skip to content

Latest commit

 

History

History
86 lines (61 loc) · 3.43 KB

README.md

File metadata and controls

86 lines (61 loc) · 3.43 KB
GitHub Sponsors Data Engineering with Enrique Catalá LinkedIn Enrique Catalá Bañuls Twitter @enriquecatala Data Engineering: Canal youtube de Enrique Catalá

Microsoft DataPlatform MVP Enrique Catalá

fastapi-helloworld

Very basic API rest for kubernetes demo purposes

NOTE: This image has been pushed to https://hub.docker.com/r/enriquecatala/fastapi-helloworld

Test

Check your api documentation

  1. Go to http://localhost:5000/docs

Test your methods: Navigate to IP:PORT(/one/hello | /two/hello) For example:

  1. Go to http://localhost:5000/one/hello

Setup the container

No special setup required, but the container will return the HELLOWORLD_ENV in the output call. You can edit that variable to check values

Kubernetes

If you wanto to deploy, here you have a deployment example. Please change this accordingly:

    env:
        - name: HELLOWORLD_ENV
          value: "Pon aqui lo que te de la gana :)"

Docker

In case you are using docker-compose.yml

    environment:
      - HELLOWORLD_ENV=Pon aqui lo que te de la gana :)

Create your own container

Build container

docker-compose build

Run the container locally

docker-compose up

CI/CD with GitHub Actions

Just push :)

Setup

First of all, you need to create a new repository in GitHub. Then you need to create a service principal in Azure. For example:

az ad sp create-for-rbac --name "github-actions-financeai-dev" --role contributor --scopes "/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>" --sdk-auth

With the output, just create this Azure credential for GitHub Actions:

{
  "clientId": "<client id>",
  "clientSecret": "<client secret>",
  "subscriptionId": "<subscription id>",
  "tenantId": "<tenant id>",
  "activeDirectoryEndpointUrl": "https://login.microsoftonline.com",
  "resourceManagerEndpointUrl": "https://management.azure.com/",
  "activeDirectoryGraphResourceId": "https://graph.windows.net/",
  "sqlManagementEndpointUrl": "https://management.core.windows.net:8443/",
  "galleryEndpointUrl": "https://gallery.azure.com/",
  "managementEndpointUrl": "https://management.core.windows.net/"
}

NOTE: For more information please read this and this