New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

serverless-tasks-handel-extension

Package Overview
Dependencies
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serverless-tasks-handel-extension

Handel Extension that provides serverless scheduled tasks using ECS Fargate

  • 0.3.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
8
decreased by-33.33%
Maintainers
2
Weekly downloads
 
Created
Source

Serverless Tasks Handel Extension

This repository contains a Handel extension that provides serverless scheduled tasks using ECS Fargate.

Motivation

As of Jun. 2018, Fargate doesn't have built-in support for scheduled tasks. You can accomplish this with CloudWatch Events, Lambda, and Fargate working in concert.

The above setup works great, but it requires quite a bit of CloudFormation, particularly when wiring the permissions together properly.

This Handel extension aims to provide that functionality with only a line or two of configuration.

Usage

To use this extension, add it to the extensions section of your Handel file, and then add the scheduledtask service to your environment:

version: 1

name: schedtask-example

extensions: # This tells Handel to import this extension
  tasks: serverless-tasks-handel-extension # This is the NPM package name of this extension

environments:
  dev:
    task:
      type: tasks::scheduledtask # You must use the <extensionName>::<serviceType> syntax here
      schedule: rate(1 minute) # Required. See https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html for what to put here
      image_name: dsw88/handel-scheduled-task-example # Optional. The Docker image that should be executed as the task
      work_dir_path: '/mnt/share/workdir' # Optional. The directory where the task 8GB working directory should be mounted
      max_mb: 2048 # Optional. Default: 512. The amount of memory in MB to allocate to the task
      cpu_units: 1024 # Optional. Default: 256. The amount of CPU units to allocate to the task. 1 vCPU = 1024.
      environment_variables: # Optional. Any environment variables that should be passed to the task
        MY_ENV: myValue

That's all the configuration you need to do! Once you deploy this app using Handel, your task will execute on the schedule you've defined.

Image Names

The image_name parameter can take several forms:

If you want to pull a public image from somewhere like DockerHub, just reference the image name directly:

dsw88/handel-scheduled-task-example

If you want to reference an image in your AWS account’s EC2 Container Registry (ECR), reference it like this:

# The <account> piece will be replaced with your account's long ECR repository name
<account>/handel-scheduled-task-example

If you don’t specify an image_name, this extension will automatically choose an image name for you based on your Handel naming information. It will use the following image naming pattern:

<appName>-<serviceName>-<containerName>:<environmentName>

For example, if you don’t specify an image_name in the above example Handel file, the image this extension will look for is the following:

schedtask-example-task:dev

Working Directory

You are provided with a 4GB mounted volume in each task. This can be used as scratch space for your tasks.

You can use the optional work_dir_path parameter to configure where this volume should be mounted in your container.

If you don't specify the work_dir_path parameter, this volume will be mounted at the following default location:

/mnt/share/task-workdir

Be aware that this scratch space does not persist across tasks!

FAQs

Package last updated on 31 Jul 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc