Auto deploy should support scaling
Description
Auto deploy currently hard-codes 1 replica for each environment. We should let people scale their pods, at least manually, but ideally via GitLab.
Proposal
Read in a project variable, PRODUCTION_SCALE
, and use that variable to set the number of replicas for the production
environment. Until we have environment-specific variables, look up $(CI_ENVIRONMENT_SLUG)_SCALE
, with default to 1 if not specified. Also, $(CI_ENVIRONMENT_SLUG)_$(CI_ENVIRONMENT_TRACK)_SCALE
for canary deploys to the same environment, which defaults to 1. I'm not sure what we should do for canary deploys when both are missing, since a canary of 1 on a total fleet of 1 doesn't make sense. Maybe make it 1 canary + 1 stable while canary is in effect.
This will require users to manually trigger a redeploy after updating the variable.
Also note that this is different than other vendors, such as Heroku, where scale is not an environment variable. Also, since we don't store variables with deployments, a redeploy of an old build will take current variables, so scale would remain constant. This makes the difference with Heroku to be less of a concern, but brings up other concerns for other variables and immutability of releases, etc.
Links / references
Documentation blurb
(Write the start of the documentation of this feature here, include:
- Why should someone use it; what's the underlying problem.
- What is the solution.
- How does someone use this
During implementation, this can then be copied and used as a starter for the documentation.)