Skip to content

Commit

Permalink
Merge pull request #32 from nasa/CUMULUS-1-update-to-node-12
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc authored Jun 26, 2020
2 parents f9c78b0 + e73829d commit 6f9a8a5
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10.16.3
12.18.0
45 changes: 35 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,28 @@

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this
project adheres to [Semantic Versioning](http://semver.org/).

## [v.1.6.0]
## [Unreleased]

## [v.1.7.0]

### BREAKING CHANGES

## BREAKING CHANGES
- Now uses Node version 12.18.1

- **CUMULUS-1896** - Updates to the [cumulus-message-adapter-js](https://github.com/nasa/cumulus-message-adapter-js) library and Cumulus core required an update to this image to utilize async handlers. See [Node.js Lambda documentation](https://docs.aws.amazon.com/lambda/latest/dg/nodejs-handler.html) for more information on async handlers. Users utilizing this module should update their lambdas to utilize an async handler style.
## [v.1.6.0]

### BREAKING CHANGES

- **CUMULUS-1896** - Updates to the
[cumulus-message-adapter-js](https://github.com/nasa/cumulus-message-adapter-js)
library and Cumulus core required an update to this image to utilize async
handlers. See
[Node.js Lambda documentation](https://docs.aws.amazon.com/lambda/latest/dg/nodejs-handler.html)
for more information on async handlers. Users utilizing this module should
update their lambdas to utilize an async handler style.

## [v1.5.1]

Expand All @@ -24,7 +38,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
### BREAKING CHANGES

- **CUMULUS-1629**
- Update image python to python3. This version of cumulus-ecs-task is *required* for [Cumulus message adapter](https://github.com/nasa/cumulus-message-adapter) >= 1.2.0.
- Update image python to python3. This version of cumulus-ecs-task is
*required* for
[Cumulus message adapter](https://github.com/nasa/cumulus-message-adapter)
>= 1.2.0.
## [v1.4.0]

Expand All @@ -38,8 +55,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p

### Added
- **CUMULUS-1418**
- Added ability to use lambda layers if they are configured for the target lambda
- Added logic to allow CMA to utilize default `cumulus-message-adapter` location, else expect it in /opt/
- Added ability to use lambda layers if they are configured for the target
lambda
- Added logic to allow CMA to utilize default `cumulus-message-adapter`
location, else expect it in /opt/

## [v1.2.5]

Expand Down Expand Up @@ -102,16 +121,22 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Upgrade node version to node 8.11

## [v1.0.2] - 2018-03-30
- increase activity queue timeout to 65 seconds as suggested here: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/StepFunctions.html#getActivityTask-property
- increase activity queue timeout to 65 seconds as suggested here:
https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/StepFunctions.html#getActivityTask-property

## [v1.0.1] - 2018-03-23
- fixes the validation error that happens when error strings are too long for stepfunctions.sendTaskFailure()
- fixes the validation error that happens when error strings are too long for
stepfunctions.sendTaskFailure()

## [v1.0.0] - 2018-03-08

### Added
- Initial release
[Unreleased]: https://github.com/nasa/cumulus-ecs-task/compare/v1.5.0...HEAD

[Unreleased]: https://github.com/nasa/cumulus-ecs-task/compare/v1.7.0...HEAD
[v1.7.0]: https://github.com/nasa/cumulus-ecs-task/compare/v1.6.0...v1.7.0
[v1.6.0]: https://github.com/nasa/cumulus-ecs-task/compare/v1.5.1...v1.6.0
[v1.5.1]: https://github.com/nasa/cumulus-ecs-task/compare/v1.5.0...v1.5.1
[v1.5.0]: https://github.com/nasa/cumulus-ecs-task/compare/v1.4.0...v1.5.0
[v1.4.0]: https://github.com/nasa/cumulus-ecs-task/compare/v1.3.0...v1.4.0
[v1.3.0]: https://github.com/nasa/cumulus-ecs-task/compare/v1.2.5...v1.3.0
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:10-alpine
FROM node:12.18.0-alpine

RUN npm install -g npm@latest

Expand Down
52 changes: 37 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,48 @@
[![CircleCI](https://circleci.com/gh/nasa/cumulus-ecs-task.svg?style=svg)](https://circleci.com/gh/nasa/cumulus-ecs-task)
[![npm version](https://badge.fury.io/js/%40cumulus%2Fcumulus-ecs-task.svg)](https://badge.fury.io/js/%40cumulus%2Fcumulus-ecs-task)

Use this Docker image to run a Node.js Lambda function in AWS [ECS](https://aws.amazon.com/ecs/).
Use this Docker image to run a Node.js Lambda function in AWS
[ECS](https://aws.amazon.com/ecs/).

## About

cumulus-ecs-task is a Docker image that can run Lambda functions as ECS services.
cumulus-ecs-task is a Docker image that can run Lambda functions as ECS
services.

When included in a Cumulus workflow and deployed to AWS, it will download a specified Lambda function, and act as an activity in a Step Functions workflow.
When included in a Cumulus workflow and deployed to AWS, it will download a
specified Lambda function, and act as an activity in a Step Functions workflow.

## Compatibility

This only works with Node.js Lambda functions, and requires that the Lambda function it is running has a dependency of at least v1.0.1 of [cumulus-message-adapter-js](https://github.com/cumulus-nasa/cumulus-message-adapter-js).
This only works with Node.js Lambda functions, and requires that the Lambda
function it is running has a dependency of at least v1.0.1 of
[cumulus-message-adapter-js](https://github.com/cumulus-nasa/cumulus-message-adapter-js).

## Usage

Like other Cumulus libraries, cumulus-ecs-task is designed to be deployed to AWS using [kes](https://github.com/developmentseed/kes) to manage Cloudformation config. This documentation assumes you're working with a Cumulus deployment and that you have files and directory structure similar to what's found in the [cumulus template repository](https://github.com/cumulus-nasa/template-deploy).
Like other Cumulus libraries, cumulus-ecs-task is designed to be deployed to AWS
using [kes](https://github.com/developmentseed/kes) to manage Cloudformation
config. This documentation assumes you're working with a Cumulus deployment and
that you have files and directory structure similar to what's found in the
[cumulus template repository](https://github.com/cumulus-nasa/template-deploy).

### Options

This library has two options:

- `activityArn` **required**
- The arn of the activity in a step functions workflow. Used to receive messages for that activity and send success/failure responses.
- The arn of the activity in a step functions workflow. Used to receive
messages for that activity and send success/failure responses.
- `lambdaArn` **required**
- The arn of the lambda function you want to run in ECS.

### Workflow config

For examples of how to integrate this image with Cumulus, please see the [documentation](https://nasa.github.io/cumulus/docs/workflows/developing-workflow-tasks#ecs-activities) and our [example workflow](https://github.com/nasa/cumulus/blob/master/example/cumulus-tf/ecs_hello_world_workflow.tf) in source.
For examples of how to integrate this image with Cumulus, please see the
[documentation](https://nasa.github.io/cumulus/docs/workflows/developing-workflow-tasks#ecs-activities)
and our
[example workflow](https://github.com/nasa/cumulus/blob/master/example/cumulus-tf/ecs_hello_world_workflow.tf)
in source.

## Development

Expand Down Expand Up @@ -58,9 +72,11 @@ docker run -e AWS_ACCESS_KEY_ID='<aws-access-key>' \

### To test a workflow while developing locally

You can execute workflows on AWS that test the version of cumulus-ecs-task that you're developing on locally.
You can execute workflows on AWS that test the version of cumulus-ecs-task that
you're developing on locally.

First, make sure that the ECS cluster for your deployment has zero tasks running that might respond to a workflow's requests.
First, make sure that the ECS cluster for your deployment has zero tasks running
that might respond to a workflow's requests.

That way only your local version will respond to your workflow.

Expand All @@ -86,16 +102,18 @@ docker run -e AWS_ACCESS_KEY_ID='<aws-access-key>' \
--lambdaArn <your-lambda-arn>
```

Finally, trigger a workflow. You can do this from the Cumulus dashboard, the Cumulus API, or with the AWS Console.
Finally, trigger a workflow. You can do this from the Cumulus dashboard, the
Cumulus API, or with the AWS Console.

## Troubleshooting

SSH into the ECS container instance.

Make sure the EC2 instance has internet access and is able to pull the image from docker hub by doing:
Make sure the EC2 instance has internet access and is able to pull the image
from docker hub by doing:

```bash
docker pull cumuluss/cumulus-ecs-task:1.1.1
docker pull cumuluss/cumulus-ecs-task:1.7.0
```

`cat` the ecs config file to make sure credentials are correct:
Expand All @@ -109,7 +127,9 @@ Check if there's multiple entries of the config.
If there is, there are two things to try:

- Delete the ec2 instance and redeploy
- Delete the incorrect config and restart the ecs agent (I haven't tested this much but I expect it to work. You'll still want to update the docker credentials in the deployment's app directory). Restart the agent by doing:
- Delete the incorrect config and restart the ecs agent (I haven't tested this
much but I expect it to work. You'll still want to update the docker
credentials in the deployment's app directory). Restart the agent by doing:

```bash
sudo stop ecs
Expand All @@ -119,9 +139,11 @@ sudo start ecs

## Create a release

To create a release, first make sure the [CHANGELOG.md](CHANGELOG.md) file is updated with all the changes made.
To create a release, first make sure the [CHANGELOG.md](CHANGELOG.md) file is
updated with all the changes made.

Next, bump the version and the changes will automatically be released upon merge to master.
Next, bump the version and the changes will automatically be released upon merge
to master.

```bash
npm version <major|minor|patch|specific version>
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "@cumulus/cumulus-ecs-task",
"version": "1.6.0",
"version": "1.7.0",
"description": "Run lambda functions in ECS",
"main": "index.js",
"bin": {
"cumulus-ecs-task": "index.js"
},
"engines": {
"node": ">=10.16.3"
"node": ">=12.18.0"
},
"keywords": [
"CUMULUS",
Expand Down

0 comments on commit 6f9a8a5

Please sign in to comment.