Scale by Environment

We have several Rancher “environments” in Dev, Prod, and DR. Apps in these environments may need more or less scale based on their load, which varies by environment. Is there a way to specify a scale for apps by environment? So let’s say 1 in Dev, 2 in DR, and 3 in Prod? Is this something we can add to the rancher-compose or docker-compose?

@Dennis_LaFreniere, you can set the scale for an application inside of the rancher-compose.yml, but, as far as I know, there is no way to put a specific scale per environment, without having different yaml’s for different environments.

Here is an example for setting the scale of my-container in a yaml.


version: '2'
        scale: 1

Hmm. I’m used to Puppet where we can specify a configuration by instance. It would be nice if we could add a question to the rancher-compose for scale that is required, but the scale is coded into the rancher-compose so that won’t work. Is there an external service that would be able to monitor the scale of apps and adjust them accordingly? I saw a reference to Prometheus here:

If you set up a private Catalog and add a Template for your application you can put in a question for the scale in the template. Then you use the ${variable_name} type syntax in the rancher-compose file and it will evaluate to the answer of the question. Then you just have to spin up the template in your different environments with a different value for scale.

I’ve used the configuration you suggested. But this only works when I
initially spin up the app. When I upgrade the stack using the “upgrade
available” button, the questions show up for scale but the numbers used
have no effect on the scale during upgrade, only when the app is initially
spun up. This is a problem.

That’s unfortunate. It must be that Rancher figures that it shouldn’t override the scale of a service when upgrading just in case something else, like a webhook, changed it on purpose. I can’t think of any solution other than setting the scale manually, which is lame. :frowning_face: