Skip to main content

GitHub Action: deploy-ecspresso

Deploy on ECS with Escpresso

Introduction

This is template repository to create composite GitHub Actions. Feel free to use it as reference and starting point.

Usage

  name: Pull Request
on:
push:
branches: [ 'main' ]

jobs:
context:
runs-on: ubuntu-latest
steps:
- name: Example action
uses: cloudposse/example-github-action-deploy-ecspresso@main
id: example
with:
image: 1111111111111.dkr.ecr.us-east-2.amazonaws.com/cloudposse/example-app-on-ecs
image-tag: latest
region: us-east-2
operation: deploy
cluster: acme-plat-ue2-sandbox
application: acme-plat-ue2-sandbox-example-app-on-ecs
taskdef-path: taskdef.json

outputs:
result: ${{ steps.example.outputs.webapp-url }}

S3 Mirroring

This action supports synchronizing taskDefinitions to S3. It is designed to work in concert with Cloud Posse's ecs-service component, that will upload a task definition template to S3. This action will then pull that template from S3 and merge it with the local task definition from the repository. Finally, ecspresso will be called to deploy the merged task definition to ECS.

This action will then upload the task-definition.json that was rendered back to S3. The ecs-service component will use the task-definition.json file to deploy the application. This ensures future infrastructure deployments do not override application changes, such as image updates, environment variable changes, etc.

The Infrastructure repository then manages things like Volumes and EFS mounts, and the Application repository manages the application code and environment variables.

S3 Mirroring

Inputs

NameDescriptionDefaultRequired
applicationApplication nameN/Atrue
clusterCluster nameN/Atrue
debugDebug modefalsefalse
ecspresso-versionEcspresso versionv2.1.0false
imageDocker imageN/Atrue
image-tagDocker image tagN/Atrue
mirror_to_s3_bucketMirror task definition to s3 bucketN/Afalse
operationOperation (valid options - deploy, destroy)deploytrue
regionAWS RegionN/Atrue
taskdef-pathTask definition pathN/Atrue
timeoutEcspresso timeout5mfalse

Outputs

NameDescription
webapp-urlWeb Application url