ConservationMetrics / mapgl-tile-renderer

Headless Node.js Maplibre-GL renderer for generating MBTiles with styled raster tiles.
MIT License
6 stars 3 forks source link

When Azure Storage Queue task is complete, update Postgres DB task row #27

Closed rudokemper closed 1 month ago

rudokemper commented 4 months ago

Feature Request

When mapgl-tile-renderer has finished creating an offline map, it needs to update a Postgres DB task row by populating columns with location in shared storage, filesize, & timestamp completed.

We can pause on this until the MapPacker web app has been created, and is set up to create a task row in the DB and sending a message to Azure Storage Queue; or, for testing and implementation purposes, we can manually create a row in a database table and send a message via ASQ, and get mapgl-tile-renderer working with that.

Some columns -- status, style, filename, filesize, expiration_date, num_attempts, work_begun, work_ended, error

As part of the same work, figure out if destinationQueueClient is needed - right now this is set to "jg-mp-test-out" as a leftover from our initial testing, but I'm not sure if we need to set this if we are (1) deleting the message from the source queue and (2) updating a Postgres DB row.

IamJeffG commented 4 months ago

We can do something like this:

  1. add a reference to the postgresql DB to the terraform module (after #33 is merged)
  2. in the terraform module, define an env variable to the container app containing a connection string to the database; this string is derived from the DB's terraform resource's properties.
  3. Javascript code reads the env variable to connect to the DB.

Step 2 and 3 are quite like https://github.com/ConservationMetrics/guardianconnector-views/blob/cc9bd86b31ac6237ff9ede9daf8cdcf31c3fea7c/api/index.ts#L22-L31

I see in other code (Views) you've passed host, user, password, etc as separate variables. How would you feel if we encoded it all in one go, the connectionString? (I haven't double-checked that it contains everything we need...)