npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gunslinger

v0.1.0

Published

Cloud resiliency tool

Downloads

2

Readme

Gunslinger

A cloud resiliency tool, inspired by Chaos Monkey and written in Node.js for AWS Lambda.

Caveat Emptor: This is still alpha software, and some actions may incur additional AWS charges.

Usage

$ npm install --save gunslinger

Function code:

exports.run = require('gunslinger')(require('./config'));

Configuration:

{
  "armed": false,
  "store": ["simple_db", "GunslingerEvents"],
  "notifier": ["sns", "arn:aws:sns:eu-west-1:123456789012:Gunslinger"],
  "grouper": "asg",
  "filters": [
    ["tag", "gunslinger"],
    ["redundancy", 2],
    ["probability", 0.15],
    ["action_limit", 1]
  ],
  "actions": [
    "burn_cpu",
    "fill_disk",
    "terminate"
  ],
  "ssh": {
    "user": "ec2-user",
    "privateKey": "/path/to/key.pem",
    "publicIp": true
  }
}

Create SimpleDB and SNS resources:

$ aws configure set preview.sdb true
$ aws sdb create-domain --domain-name GunslingerEvents
$ aws sns create-topic --name Gunslinger

Create a function:

$ aws lambda create-function --function-name Gunslinger --zip-file fileb:///path/to/code.zip --role GunslingerExecution --handler index.run --runtime nodejs4.3

The GunslingerExection role should have sns:Publish, sdb:PutAttributes, sdb:Select, autoscaling:DescribeAutoScalingGroups, ec2:DescribeInstances and ec2:TerminateInstances permissions.

Create a schedule and apply it to your function:

$ aws events put-rule --schedule-expression 'cron(0 9-16 ? * MON-FRI *)' --name GunslingerPerHourOfficeHours
$ aws lambda add-permission --function-name Gunslinger --statement-id 1 --action lambda:InvokeFunction --principal events.amazonaws.com --source-arn arn:aws:events:us-east-1:123456789012:rule/GunslingerPerHourOfficeHours
$ aws events put-targets --rule GunslingerPerHourOfficeHours --targets '{"Id" : "1", "Arn": "arn:aws:lambda:us-east-1:123456789012:function:Gunslinger"}'

Configuration

armed (default = false)

The default mode of Gunslinger is "unarmed". In this mode, no destructive action is taken. Before you switch to the "armed" mode, verify your filter configuration. Without any filters, Gunslinger will target every auto scaling group within your AWS account on each invocation!

store (required)

Gunslinger will persist events (such as instance termination) to maintain a record for future invocations. Currently, only SimpleDB is supported.

notifier (default = none)

Optionally, Gunslinger can push events to a notification service. Currently, only SNS is supported.

grouper (default = asg)

Gunslinger targets logical groups of EC2 instances. Currently, only auto scaling groups are supported.

filters (default = [])

The set of target groups can be reduced by applying one or more of the following filters:

  • action_limit(N): allow at most N actions on any given group within a 24-hour window.
  • probability(N): only take action on any given group with a probability of 0 <= N <= 1.0.
  • redundancy(N): only take action on groups with N or more healthy instances.
  • tag(K): only take action on groups tagged with key K.

actions (default = [])

When a group is targeted, a target action is randomly selected out of this configured set. Please consult the source for available actions.

VPC usage

Unless publicIp is explicitly set to true, Gunslinger will attempt to SSH to the private IP addresses of instances. To use this mode, you must add a VPC configuration to your Lambda function.