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

iron-lambda

v1.0.7

Published

Lambda functions support for IronWorker cloud

Downloads

3

Readme

iron-lambda

Lambda functions support for IronWorker cloud

What is this?

Use the iron-lambda to locally dev and test your lambda functions in the exact same environment it will have when running remotely on the IronWorker cloud.

The Workflow

The general workflow is the following:

  1. Create your lambda function (or use existing one). All dependencies must in the current directory or in sub-directories.
  2. Create an input/payload example file (check this into source control as an example, default name is ./event.json)
  3. Run your lambda function locally inside an Iron.io Stack container.
  4. Debug/test until you get it working properly.
  5. Once it works like you want it to, upload it to IronWorker. You should only have to do this once until you want to make changes.

Getting Started

1. You'll need Docker installed and running on your machine to use this. Run:

docker info

This should print information about your Docker installation. If it doesn't, you don't have Docker setup properly.

2. You'll want to install the new Iron cli tool as well (not totally necessary, but makes things a lot easier):

curl -sSL http://get.iron.io/cli | sh

Or if you'd prefer to download it yourself, you can grab the latest release from here: https://github.com/iron-io/ironcli/releases

3. Check that the Iron cli tool was installed properly:

iron --version

4. Install this npm package globally:

npm install iron-lambda -g

5. Create new directory for your function development and enter inside it

mkdir your-iron-lambda-func
cd your-iron-lambda-func

6. Setup iron lambda template

iron-lambda setup

The lambda function is placed in lambda.js, feel free to change it.

exports.handler = function(event, context) {
    console.log( "event", event );
    console.log( "env", process.env );
    context.done();
};

where event is the payload passed to lambda function

Command Line Interface

setup

Inits you working directory with template

iron-lambda setup

Template contains the following files:

  • .env - stores runtime enviroment variables (e.g. credentials, roles, security tokens & etc)
  • deploy.env - stores variables for docker image building process (e.g. you docker hub repository and image version)
  • Dockerfile
  • lambda.js - the lambda function module, must export handler
  • package.json

run

Quick run locally

iron-lambda run

Runs the lambda function inside default iron/node docker container. The event data to run lambda on (the payload) should be placed to ./event.json.

run-in-docker

Run locally inside docker container

iron-lambda run-in-docker

Builds a docker container and runs the lambda function inside it. The event data to run lambda on (the payload) should be placed to ./event.json. Make sure you've specified a valid docker repository name in DOCKER_REPO_NAME variable of ./deploy.env file.

deploy

Deploy your lambda function

iron-lambda deploy

Builds a docker container, deploys it to docker hub and registers in IronWorker cloud. Make sure :

  • you have logged to docker (see docker login command) and has your Iron.IO project credentials in ./iron.json. This file you can obtain on Getting Started page inside your IronWorker project (https://hud.iron.io/dashboard).
  • you have specified a valid docker repository name in DOCKER_REPO_NAME variable of ./deploy.env file.

Notes

Windows Users

If you are using boot2docker on Windows, please note the following:

The Linux VM in the boot2docker VirtualBox maps the c/Users directory in the VM instance to the C:\Users folder in Windows. So be sure your source code for your worker is in a folder under C:\Users, then cd to that folder in the context of the VM (in Boot2Docker terminal) and run it from there.