Files
fn-serverless/README.md
2016-07-17 20:52:28 -07:00

1.4 KiB

Note: currently running at: http://gateway.iron.computer:8080/

IronFunctions

First, let's fire up an IronFunctions instance. Copy the example.env file into a file named .env and fill in the missing values.

Then start your functions instance:

docker run --env-file .env --rm -it --privileged -p 8080:8080 iron/functions

Usage

First things first, create an app/service:

TOOD: App or service??

iron create app APP_NAME
# OR
curl -H "Content-Type: application/json" -X POST -d '{"name":"APP_NAME"}' http://localhost:8080/api/v1/apps

Now add routes to the app. First we'll add a route to the output of a docker container:

iron add route myapp /hello iron/hello
# OR
curl -H "Content-Type: application/json" -X POST -d '{"path":"/hello", "image":"iron/hello", "type":"run"}' http://localhost:8080/api/v1/apps/myapp/routes

And how about a slackbot endpoint:

curl -H "Content-Type: application/json" -X POST -d '{"path":"/guppy","image":"treeder/guppy:0.0.2", "content_type": "application/json"}' http://localhost:8080/api/v1/apps/myapp/routes

Test out the route:

Surf to: http://localhost:8080/hello?app=myapp

You'all also get a custom URL like this when in production.

myapp.ironfunctions.com/myroute

Updating Your Images

Tag your images with a version, eg treeder/guppy:0.0.5 then use that including the tag and update the route.