During the lifecycle of an application, we will usually encounter the scenarios of upgrading the version of the application, rolling back the active version or promoting the application from dev to staging and then to production. Truefoundry faciliates these flows and categorizes them into 3 workflows: Updating, Rolling back and Promoting.
- Updating: Modifying the existing code or configuration of a service to introduce new features, fix bugs, or enhance performance.
- Rolling Back: Reverting a service to a previous, known-good state in case of unexpected issues or performance degradation.
- Promoting: Moving a service from a lower environment (e.g., development or staging) to a higher environment (e.g., production) for being consumed by end users.
To update a service in TrueFoundry, simply deploy the service with the desired changes, maintaining the same service name and workspace. TrueFoundry will automatically detect the update and create a new version.
Alternatively, you can update your Machine Learning Service using the
Edit button to modify your Service's configuration, following the instructions below. This will also create and deploy a new version with your changes.
TrueFoundry retains a comprehensive history of your service's deployed versions. You can easily redeploy a previous stable state, following the steps outlined in the demo below:
This action will create a new version with the configuration of the redeployed version, effectively rolling back the service to its previous state. For e.g. if the current version is v10, and you rollback to v5, a new version v11 will be created with the same spec as v5.
Usually, there will be multiple environments for an application for different stages of testing. While most companies maintain 3 environments: dev, staging, and production, your company might have fewer or more environments depending on the requirements. Independent of the number of environments, the problem statement of promoting an application from one environment to the other remains the same. Let's say we are promoting a service from staging to production. A few things to keep in mind are:
- The docker image URI of current production should be overwritten by the image URI currently running in staging.
- Settings like autoscaling and replicas in production shouldn't be overwritten with what is there in staging.
- Settings like readiness probe, and liveness probe should be changed with what is running actively in staging.
- We need to make sure environment variables are consistent among staging and production. If a new environment variable is added to staging, and we forget to add it to production while promoting, it can be disastrous.
TrueFoundry promote flow takes these factors into account and shows the correct diff to the user while promoting to avoid manual errors.
Let's say you've developed an initial version of a ML service for an ongoing project. This service has been deployed to your team's development workspace. After making some refinements, your development service is ready to move to production. The production environment can be another workspace on the same cluster or on a different cluster. To promote this to a production environment, make sure you have the production workspace ready and then follow the steps below:
Please remember to make modifications in the prod service after promoting
- Environment Variables: You might need to modify the environment variables to access different DBs, etc.
- Resource Scaling: To handle production traffic, you might need to change the number of replicas or configure autoscaling.
The journey doesn't end once the service is deployed in production. You will constantly make changes to the service in development environment and then promote again when you want to upgrade production again.
When you promote again, TrueFoundry will analyze the configuration differences between your enhanced development service and the existing production service. It will highlight the things that are going to be changed in the current production environment like docker image uri, environment variables, liveness/readiness probes and ignore the parts like autoscaling that are going to be retained in the production service. This helps avoid manual errors during the promote flow.
By leveraging Promote Flow, you can confidently introduce enhancements to your production service without compromising its stability and security.
Updated 3 months ago