Blocks

A block represents a piece of infrastructure in your stack - like a running container, or a database, a Redis instance, a queue and so on.

Blocks can be created like this:

dgctl block add --type=container --name myApp

The above dgctl command has created a new "slot" for running a container; the dgctl.json file has been updated with new block details. To get the changes applied to your cloud provider's account, run dgctl generate and then dgctl provision

In dgclt.json

Each block is defined as an entry in the "blocks": [ ... ] list, with just 2 required params:

  • name - the name of the block

  • type - the type of the block

dgctl.json is just an "index" though - block configuration is done in the block folder

In the block directory

dgctl block add command creates an entry in dgctl.jsonfile and also create a directory to store block configuration, with the following structure:

├── myBlock
│   ├── config.json
│   └── overrides

The config.json file stores block's settings. For example, for a standard block of type container it might look like this:

{
    "target": "diggerhq/target-ecs-module@dev",
    "task_memory": 512,
    "task_cpu": 256,
    "container_port": 8000,
    "load_balancer": true,
    "internal": false,
    "health_check": "/",
    "health_check_matcher": "200-499",
    "launch_type": "FARGATE",
    "monitoring_enabled": false,
    "lb_monitoring_enabled": false
}

The target option defines the block's implementation. By default it points to a standard implementation of a given type by Digger. But it can be any github repo - you can fork it, or write your own from scratch.

Last updated