Our standard deployment process for other apps is here
fAIr differs slightly, because we have:
- Versioning of both software, as well as AI models.
- A dedicated dev instance EC2 for easier development with all components.
Currently model development happens in the fAIr-models repo, but this
might eventually move to the fAIr monorepo.
The model flow works like this:
- Each model dir has a
stac-item.json. These point at the movingdev-inferenceimage tag, and only seed a STAC the first time it starts up (on dev, or a brand new prod). - After that the STAC database is the source of truth, updated through the Django admin.
- A CI matrix workflow builds an image for each dir under
./modelswhen its contents change, tagged with the git SHA. - In the Django admin we give a SHA a version (
vX.Y.Z-rc.N, thenvX.Y.Z) and register it in the STAC, pinned to the image digest ('rc' release candidates are used for staging, before full production tagging). - A
BaseModeltable holds the model name and its status. The version details live entirely in the STAC though.
Note
The Environment
- Single EC2, lightweight k3s cluster.
- Manually updated / synced with dev.
- Model registration in STAC etc is all manual.
- Users work on models in development, versioned as
-devwith a specific SHA tag too. - Development model image (deps + code) is pushed to GHCR.
- On the dev EC2 they run a script to update the dev STAC and knative records.
- Any changes to the frontend / API are manually synced to the dev EC2 instance.
- The dev model can be tested on the dev instance, using the dev STAC, ZenML, knative services.
Note
The Environment
- Runs all the same components as production, but
start up via PR from
staging-->main. - The components run inside the
fair-stagingnamespace of the Kubernetes cluster, under domainhttps://stage.ai.hotosm.org. - Does not run it's own
knativecontroller, instead using the cluster-wide instance.
- When we want to stabilise and push out a new model, or updates to the API / website, we use the staging setup.
- First a PR must be raised on the fAIr repo from
staging-->main. This will set uphttps://stage.ai.hotosm.orgwith ZenML / STAC / Knative registration. - On boot the staging STAC is seeded (read-only) from the current production STAC, so it mirrors live.
- CI has already built the model image, tagged by SHA. In the Django admin,
give that SHA a candidate version (
vX.Y.Z-rc.N), register it in the staging STAC, and test it. - Once it looks good, register the model in production (Step 3) before merging
the PR to
main. Merging shuts the staging env down.
Note
The Environment
- Runs through tagged releases on Github, where ArgoCD picks up the latest helm chart tag and deploys.
- A new tagged version is made from the latest
maincode. - This triggers a redeploy of the fAIr website / API.
- In the production Django admin, give the tested SHA a release version
(
vX.Y.Z), register its STAC item pinned to the digest, and make it live. The image is already in GHCR, so it is available straight away.