Usage
Prepend any "dgctl" command with following docker command
docker run -v /<PATH_TO_YOUR_APP_FOLDER>:/app -v /<PATH_TO_AWS_CONFIGURATION>:/root/.aws -ti dockerdiggerorg/dgctl
For example to run init
docker run -v /Users/digger/infra:/app -v /Users/digger/.aws:/root/.aws -ti dockerdiggerorg/dgctl init
git clone https://github.com/diggerhq/a-nodeapp
cd a-nodeapp
Create
infra
directory at the top level of your repository and cd into it:mkdir infra && cd infra
Now run the init command:
dgctl init
This should create the following file structure under the
infra
folder:.
├── default_network
│ ├── config.json
│ └── overrides
├── dgctl.json
└── overrides
dgctl block add --type=container myApp
A new block will be added into
dgctl.json
and a new myApp
directory will be created next to it:.
├── default_network
│ ├── config.json
│ └── overrides
├── dgctl.json
├── myApp
│ ├── config.json
│ └── overrides
└── overrides
dgctl generate --platform=AWS
A new
generated
folder will be created, containing a complete set of Terraform templates needed to run your stack on AWS.
├── README.md
├── default_network
│ ├── main.tf
│ ├── outputs.tf
│ ├── variables.tf
│ └── vpc.tf
├── main.tf
└── myApp
├── cluster.tf
├── ecr.tf
├── ecs.tf
├── ecs_task_execution_policy.json
├── ecs_task_policy.json
├── lb.tf
├── main.tf
├── outputs.tf
├── securitygroup.tf
├── variables.tf
└── vpc.tf
If you are not familiar with Terraform - don't worry, you don't need to learn it! Terraform is used as an "assembly language" that Digger compiles into. You can add your own Terraform or customise it completely, but you don't have to; it works as-is.
dgctl provision
It will ask for your AWS key pair and save it in
~/.aws/credentials
if you don't have it thereThen it will provision your infrastructure using
terraform
under the hood (plan
and apply
)This may take a few minutes ☕
dgctl block deploy myApp --context=../
Or you can
cd ..
and run dgctl block deploy myApp --context=.
from the parent directoryThis will run
docker build
, docker push
and update the task definition in AWS ECSYou can customise the script in the
config.json
file of a corresponding blockThe
block deploy
command is only a convenience shortcut; it is not meant to be used in production scenarios. In CI pipelines we recommend using docker
and aws
commands directly. ECR repository URL can be obtained by running dgctl block info
command.
TODO: get rid of cd'ing into infra directory. The CLI should create infra dir and operate from the root dir instead.
Last modified 9d ago