Applications and services can depend on one another and thus must be configured and set up in a specific order. For example, often the application server must be dependent on the database application. In practical terms this means we only want to start the application server once the database is up and running, and reported as healthy.
Specifying dependencies is straightforward:
#blueprint.yaml
---
kind: blueprint
spec_version: 1
...
applications:
- acme_appserver:
depends_on:
- acme_database
- acme_database
In the above example, when the sandbox is created, the 'acme_database' application will be set up first and configured. All 'acme_appserver' instances are deployed but the application will be configured and launched only once the database server is ready and reported as healthy.
You can create a hierarchy of dependent applications and services. According to these constraints, CloudShell Colony will automatically calculate the correct order in which the applications and services should be configured and launched after the instances are ready. For example, in this scenario:
#blueprint.yaml
---
kind: blueprint
spec_version: 1
...
applications:
- output-publisher
- acme_dashboard:
depends_on:
- acme_appserver
- acme_bi_engine:
- acme_database
- acme_appserver:
depends_on:
- acme_database
- acme_database
depends_on:
- s3
services:
- s3:
input values:
- BUCKET_NAME
- ROLE_ARN: $ROLE_ARN
- SANDBOX_ID: $colony.environment.id
- FROM_PUBLISHER_1: $colony.applications.output-publisher.outputs.output1
depends_on:
- output-publisher
In this example, the 'acme_database' depends on the 's3' service, which depends on the application 'output-publisher'. Colony will first launch 'output-publisher', then 'acme_database', and then launch both the 'acme_appserver' and the 'acme_bi_engine' in parallel once the database is reported as healthy. Finally, once the 'acme_appserver' application is healthy, the 'acme_dashboard' application will be configured and run.
Comments
1 comment
Very helpful article
Please sign in to leave a comment.