alan-turing-institute / RCTab

An Azure subscription management, reporting, and usage monitoring system
MIT License
3 stars 3 forks source link

Auto deployment #15

Open joseph-palmer opened 1 year ago

joseph-palmer commented 1 year ago

When a new image is released by a new software release, users will not automatically get this update and will need to manually restart the app that has been updated.

We should provide a means of notifying users of a new update.

joseph-palmer commented 1 year ago

One way to do this for the API could be to add logic to the CLI that checks the version of the API in use against the latest docker image version by querying docker hub with wget -q -O - "https://hub.docker.com/v2/repositories/turingrc/rctab-api/tags" | grep -o '"name": *"[^"]*' | grep -o '[^"]*$'. If they don't match, we could alert the user from the CLI and could even trigger a restart of their API programmatically.

The function apps are more tricky because we don't, AFAIK, have a record anywhere of the version in use.

joseph-palmer commented 1 year ago

Proposal for the function apps

  1. In the API, add a database table called 'function-versions' that contains a single value.
  2. In the API, add an endpoint to fetch the function-versions value and an endpoint to post the function-versions value
  3. In one of the function apps, check the current version against the recorded version via the endpoint. If different, update the table 'function-versions'.
  4. In the CLI, add a check to fetch the function version from the endpoint and check it against the latest docker image, as we do with the API.

This will allow us to notify users via RCTab.

@Iain-S do you think would be an appropriate solution?