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

etcd-aws-cluster

v0.1.11

Published

This container serves to assist in the creation of an etcd (2.x) cluster from an AWS auto scaling group.

Downloads

37

Readme

etcd-aws-cluster

This container serves to assist in the creation of an etcd (2.x) cluster from an AWS auto scaling group. This is a fork from the upstream Monsanto repo, ported to Node.js. Much thanks to @tj-corrigan for doing the actual hard work of figuring out how to bootstrap etcd in AWS.

Docker Versions

Usage

This container should be run on the instance in the autoscaling group you wish to run the etcd node on. It will autodiscover the current status of the cluster, and write a set of etcd params to stdout.

$ docker run building5/etcd-aws-cluster

For cases where you cannot run a docker container (like starting up an etcd cluster you want to point you docker cluster at), you can also run from npm

$ npm install -g etcd-aws-cluster
$ etcd-aws-cluster

This output could be:

  • written to /etc/sysconfig/etcd-cluster for systemd startup. The output can then be loaded as an EnvironmentFile in an etcd2 drop-in to properly configure etcd2:

    [Service]
    EnvironmentFile=/etc/sysconfig/etcd-cluster
  • written to (or eval from) /etc/default/etcd for upstart startup

    eval $(docker run building5/etcd-aws-cluster)
  • used with docker run --env-file for running in a docker container

    $ docker run --env-file <(docker run building5/etcd-aws-cluster) etcd

The following params are written:

  • ETCD_NAME
    • Node name; uses EC2 instance id
  • ETCD_LISTEN_CLIENT_URLS
    • URL to listen on for client traffic; defaults to http://0.0.0.0:2379
  • ETCD_LISTEN_PEER_URLS
    • URL to listen on for peer traffic; defaults to http://0.0.0.0:2380
  • ETCD_ADVERTISE_CLIENT_URLS
    • URL to advertise for client traffic; defaults to http://:2379
  • ETCD_INITIAL_ADVERTISE_PEER_URLS
    • URL to advertise for peer traffic; defaults to http://:2380
  • ETCD_INITIAL_CLUSTER_STATE
    • new (spinning up new cluster) or existing (joining existing cluster)
  • ETCD_INITIAL_CLUSTER
    • comma separated list of the other members of the cluster

Permissions

IAM permissions are needed to inspect the ASG and its members. The easiest way to do that is with an IAM instance profile. An example policy is given below, but you may want to narrow the Resource to the specific ASG the instance will belong to.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "Stmt1456626729000",
      "Effect": "Allow",
      "Action": [
        "ec2:Describe*",
        "autoscaling:Describe*"
      ],
      "Resource": ["*"]
    }
  ]
}

Workflow

  • get the instance id and ip from amazon

  • fetch the autoscaling group this machine belongs to

  • obtain the ip of every member of the auto scaling group

  • for each member of the autoscaling group detect if they are running etcd and if so who they see as members of the cluster

    if no machines respond

    • assume that this is a new cluster
    • write a file using the ids/ips of the autoscaling group

    else

    • assume that we are joining an existing cluster
    • check to see if any machines are listed as being part of the cluster but are not part of the autoscaling group
      • if so remove it from the etcd cluster
    • add this machine to the current cluster
    • write a file using the ids/ips obtained from query etcd for members of the cluster

Why fork?

The differences in this fork are:

  • Versions tagged in Git.
  • Ported to Node.js, so I have a hope of debugging it.
  • Automatic Docker Hub builds, rebuilding whenever the base FROM image is updated, so we'll keep up to date with security patches.
  • More flexibility, for cases when not using CoreOS.