New

Mapping Applications to Compute Instances

  • 19 April 2021
  • 0 replies
  • 53 views

This article applies to YAML blueprints. For details on blueprints defined in Terraform modules, see Using Terraform Blueprints in Torque, and for Helm blueprints, see Using Helm Blueprints in Torque.

Torque makes it easy to declare that an application should be deployed to multiple instances or configure all applications to run on the same instance. 

In this article: 

Deploying to Multiple Instances

To specify the number of instances the app should deploy to, simply add the 'instances' property as shown below:

#blueprint.yaml
---
kind: blueprint
spec_version: 1
...
applications:
- acme_webserver:
instances: 3
- acme_database

In the example above, the webserver would be launched on multiple instances. These can be virtual machines or containers, depending on the cloud used in this blueprint. The 'acme_database' app gets the default number of instances (which is one instance).

Deploying Multiple Applications to a Single Instance

To save up on compute resources you can deploy several applications to a shared instance. To do that, we need to name that target instance and make sure the applications are pointing at the same named instance:

#blueprint.yaml
---
kind: blueprint
spec_version: 1
...
applications:
- acme_webserver:
target: all_in_one
- acme_database:
target: all_in_one

In the example above, both database and webserver will be deployed to the same VM (or pod in the case of Kubernetes), which is referred to as 'all_in_one'.

Combining the Two Strategies 

Note that the same application cannot declare both a 'target' property and an 'instances' property at the same time. An application can either be deployed to a single instance (default), deploy multiple instances (via the 'instances' property) or share an instance with another application (using the 'target' property). However, you can combine different strategies for different applications. For example:

#blueprint.yaml
---
kind: blueprint
spec_version: 1
...
applications:
- acme_webserver:
instances: 3
- acme_appserver:
target: all_in_one
- acme_database:
target: all_in_one

0 replies

Be the first to reply!

Reply