Deploying Applications

Deploying Applications

Deploying Applications

See our example repository at: https://github.com/nx1-io/cdk-ecs-application

To get started, fork or clone the repository into a new GitHub repository under your Organization.

Overview

This example deploys a Docker image to ECS under a NX1 environment.

Preparation

You will need:

Copy the Service Role ARN by clicking in the menu action as shown below:

image

Environment Configuration

Edit .cdk/cdk.config.json with your application and environment details:

  • name: Enter a name for your application
  • Under stages.dev.aws, update account_name, account and region with your environment details.
    • account_name: Usually the environment name, such as “Development” or “Production”
    • account: 12 digit AWS account ID
    • region: Short format of the AWS region your environment is using. Ex.: ap-southeast-1 or us-west-2.
  • Under stages.dev.route53, update domain and hostname
    • Update domain with the same domain you created in your environment in NX1
    • Update hostname with the hostname you wish to access your web app. Leave the default if in doubt.
  • You can leave the defaults on other settings.

Set the Service Role

Edit .github/workflows/dev-deploy.yml:

Around line 41, update:

role-to-assume: arn:aws:iam::932213710980:role/githubAccess

With the service role ARN obtained earlier.

Deploying

Push code to the main branch or the branch defined at the GitHub Workflow.

Under your GitHub repository, you should see a workflow similar to the screenshot below:

image

Click in the workflow and the last run to see the logs.

A successful deployment will look like this:

image