Skip to content

Call the functions with a bearer token and drop DigitalOcean - #331

Merged
oskarbarcz merged 1 commit into
mainfrom
remove-digitalocean
Nov 10, 2026
Merged

oskarbarcz merged 1 commit into
mainfrom
remove-digitalocean

Conversation

@oskarbarcz

@oskarbarcz oskarbarcz commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Why

The four functions drop DigitalOcean: they take the secret as Authorization: Bearer instead of OpenWhisk's X-Require-Whisk-Auth, and their contracts describe the Lambda Function URLs. This side follows, and the last DigitalOcean wording in the docs goes with it.

What changes

  • Clients: AerolopaClient, OsmClient, OceanicTracksClient and PostcardClient send Authorization: Bearer <secret>, and their specs assert it. Base URLs and secrets are unchanged: production still reads each function's /url and /secret from SSM.
  • Mocks: the functions-mock routes sit at the root (seatmap, layouts, pull, tracks, city) and require Authorization: Bearer very-secret-token. The *_FUNCTION_BASE_URL values in .env.dist lose the DigitalOcean package paths. The cabin-layout seed finds the seat map route by its new endpoint.
  • Contracts: aerolopa, osm and oceanic-tracks .openapi.json are the functions' 2.0.0 contracts, run through Prettier. postcard.openapi.json stays the trimmed mirror and is edited in place: the render goes to an asynchronous invocation, the hand-off modes are invocation and inline, the platform's 202 is gone, and 401 answers with UNAUTHORIZED under bearerAuth.
  • Types: UNAUTHORIZED joins the AeroLOPA, OSM, oceanic tracks and postcard error codes, and PostcardHandoffMode is invocation | inline.
  • Docs: the deploy lines in AGENTS.md and README name AWS, FRONTEND_BASE_URL lives in infra/locals.tf, and the providers are AWS Lambda functions. The OpenSpec change records keep their DigitalOcean wording as history.
  • Version: 3.80.5.

Merge together

These five pull requests switch the functions and the API to the bearer header, so merge them close together. Until all five are in, the two sides disagree on the header: the functions answer 401, and the API reports seat maps, airport pulls, oceanic tracks and postcards as unavailable.

After merging

Copy the four *_FUNCTION_BASE_URL lines from .env.dist into your .env and recreate app and mock.

Verification

  • In the compose environment: Prettier on the touched files, lint, typecheck, the provider unit tests (92) and the functional suite (1602 scenarios) pass against the new mocks.

🤖 Generated with Claude Code

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

OpenTofu plan for infra

Commit 24136ac · Plan: 1 to add, 1 to change, 1 to destroy.

Show plan
 OpenTofu used the selected providers to generate the following execution
 plan. Resource actions are indicated with the following symbols:
!  ~ update in-place (current -> planned)
!-/+ destroy and then create replacement
 
 OpenTofu will perform the following actions:
 
   # aws_ecs_service.app will be updated in-place
!  ~ resource "aws_ecs_service" "app" {
         id                                 = "arn:aws:ecs:eu-central-1:805830022748:service/mypreflight/flight-tracker-api"
         name                               = "flight-tracker-api"
         tags                               = {}
!      ~ task_definition                    = "arn:aws:ecs:eu-central-1:805830022748:task-definition/flight-tracker-api:7" -> (known after apply)
         # (19 unchanged attributes hidden)
 
         # (4 unchanged blocks hidden)
     }
 
   # aws_ecs_task_definition.app must be replaced
!-/+ resource "aws_ecs_task_definition" "app" {
!      ~ arn                      = "arn:aws:ecs:eu-central-1:805830022748:task-definition/flight-tracker-api:7" -> (known after apply)
!      ~ arn_without_revision     = "arn:aws:ecs:eu-central-1:805830022748:task-definition/flight-tracker-api" -> (known after apply)
!      ~ container_definitions    = jsonencode(
!          ~ [
                 {
                     command                = [
                         "tunnel",
                         "--no-autoupdate",
                         "--metrics",
                         "localhost:20241",
                         "--grace-period",
                         "20s",
                         "run",
                     ]
                     dependsOn              = [
                         {
                             condition     = "HEALTHY"
                             containerName = "flight-tracker-api"
                         },
                     ]
                     environment            = []
                     essential              = true
                     healthCheck            = {
                         command     = [
                             "CMD",
                             "cloudflared",
                             "tunnel",
                             "--metrics",
                             "localhost:20241",
                             "ready",
                         ]
                         interval    = 5
                         retries     = 6
                         startPeriod = 10
                         timeout     = 2
                     }
                     image                  = "cloudflare/cloudflared@sha256:4955524aeaa379e154023d5a027c250f7b35041a2e7e950cf13f144bc9b9c5ba"
                     linuxParameters        = {
                         capabilities = {
                             add  = []
                             drop = [
                                 "ALL",
                             ]
                         }
                     }
                     logConfiguration       = {
                         logDriver = "awslogs"
                         options   = {
                             awslogs-group         = "/ecs/flight-tracker-api"
                             awslogs-region        = "eu-central-1"
                             awslogs-stream-prefix = "cloudflared"
                         }
                     }
                     mountPoints            = []
                     name                   = "cloudflared"
                     portMappings           = []
                     readonlyRootFilesystem = true
                     secrets                = [
                         {
                             name      = "TUNNEL_TOKEN"
                             valueFrom = "arn:aws:ssm:eu-central-1:805830022748:parameter/mypreflight/api/cloudflare-tunnel-token"
                         },
                     ]
                     systemControls         = []
                     volumesFrom            = []
                 },
!              ~ {
!                  ~ image                  = "ghcr.io/mypreflight/flight-tracker-api:3.80.4" -> "ghcr.io/mypreflight/flight-tracker-api:3.80.5"
                     name                   = "flight-tracker-api"
                     # (11 unchanged attributes hidden)
                 },
             ] # forces replacement
         )
!      ~ enable_fault_injection   = false -> (known after apply)
!      ~ id                       = "flight-tracker-api" -> (known after apply)
!      ~ revision                 = 7 -> (known after apply)
-      - tags                     = {} -> null
         # (11 unchanged attributes hidden)
 
-      - volume {
-          - configure_at_launch = false -> null
-          - name                = "tmp" -> null
         }
+      + volume {
+          + configure_at_launch = (known after apply)
+          + name                = "tmp"
         }
 
         # (1 unchanged block hidden)
     }
 
 Plan: 1 to add, 1 to change, 1 to destroy.
 
 Changes to Outputs:
!  ~ app_image        = "ghcr.io/mypreflight/flight-tracker-api:3.80.4" -> "ghcr.io/mypreflight/flight-tracker-api:3.80.5"

Workflow run

@oskarbarcz oskarbarcz self-assigned this Nov 10, 2026
@oskarbarcz
oskarbarcz merged commit 6920d87 into main Nov 10, 2026
3 checks passed
@oskarbarcz
oskarbarcz deleted the remove-digitalocean branch November 10, 2026 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant