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

hubot-asgard

v0.2.5

Published

Asgard API wrapper for Hubot with utility functions for launching Asgard instances.

Downloads

24

Readme

hubot-asgard

Hubot script for interacting with Asgard

Goals

  • Allow an easy interface for quick (particularly read-only) data requests from Asgard.
  • Better mobile support via Campfire/Hipchat/XMPP/etc.
  • Templated (eco) output allows easy customization for users.
  • Support basic and/or fundamental updates that should not require a browser to run.
  • Additional ACL via Hubot Admin and roles

Requirements

Asgard needs to be running somewhere, and Hubot needs to be able to access it. You can launch manually on AWS with a NetflixOSS AMI or one of these.

If you want a more hands-off approach, hubot-asgard comes bundled with some asgard-launcher commands. These are AWS-centric launch utilities for Asgard. After configuration in Hubot, you can launch a new Asgard instance as follows:

asgard-launcher run
asgard-launcher url
asgard-launcher authorize <HUBOT_IP>
asgard-launcher authorize <YOUR_IP>

After configuring your Asgard instance via web browser, save a private AMI that includes your configured AWS credentials. Note that it is recommended to disable public AMIs when initially configuring your Asgard instance. If you need public AMIs be careful with the ami listing requests, as they may exceed message size limitations (and currently do not batch).

asgard-launcher create ami

If you want to shutdown the instance, use:

asgard-launcher terminate

If you created an ami, asgard-launcher will use that ami for future asgard-launcher run requests. If not, it will launch the default ami (requiring configuration) each time.

Asgard-launcher defaults to launching the NetflixOSS AMI on an m1.small instance. Use asgard-launcher ami <ami-id> and asgard-launcher instance type <instance-type> to override these defaults.

Installation

Update Hubot's package.json to install hubot-asgard from npm, and update Hubot's external-scripts.json file to include the hubot-asgard module.

Update the files to include the hubot-asgard module:

package.json

...
"dependencies": {
  "hubot":        ">= 2.4.0 < 3.0.0",
  ...
  "hubot-asgard": ">= 0.1.1"
},
...

external-scripts.json

["hubot-awesome-module","other-cool-npm-script","hubot-asgard"]

Run npm install to install hubot-asgard and dependencies.

Configuration options

Hubot-asgard uses Redis to store information via robot.brain. On initial launch, hubot will try to load your HUBOT_ASGARD_URL and HUBOT_ASGARD_REGION from the like-named environment variables. If these are empty, Hubot uses 'http://127.0.0.1' and 'us-east-1'.

You can retrieve and update these values with Hubot via:

asgard url http://asgard.example.com:8080
asgard url
asgard region us-west-2
asgard region

If you plan to use asgard-launcher, you must set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables for successful aws-sdk configuration.

Practical Use

Use hubot help or check the asgard.coffee file to get the full list of options with short descriptions. The steps below cover checking autoscaling groups and pushing a new ami to a particular autoscaling group.

Show autoscaling groups:

asgard autoscaling
OR
a as

Show a single autoscaling group:

a as autoscaling-group-name

Show amis:

asgard ami

Start a rolling push:

asgard rollingpush autoscaling-group-name ami-1234abcd

Check the rolling push task:

asgard task
asgard task 12

Templates

Hubot-asgard returns data via (eco) templates. If you are missing data, or want to organize things differently, hit the Asgard web interface that corresponds to a request and append the url with '.json'. This should show you the data that's being passed to the template. Change the template in a fork and either rock your personal changes, or submit a pull request for everyone to enjoy.

Todo

  • List size checking, response batching. Need basic safety checks in case someone tries to get the list of all AMIs in us-east-1 (or has very large systems).
  • Implement roles - Use HUBOT admin, or entirely separate roles? Probably both.
  • Refine templating
  • Wrap additional services