New In Marketplace: IronFunctions Functions-as-a-Service in 11 Clouds

by Phil Dougherty

on February 21, 2017

Today we added a new integration to the ContainerShip Cloud click to deploy marketplace, IronFunctions. IronFunctions is an open source project developed by iron.io that offers a FaaS (functions as a service) platform for developing and running AWS Lambda style micro applications.

Over the last 6 months, Serverless has become a major trend and generated significant buzz in DevOps and software development circles. The major benefit and draw of the technology for developers is the concept of not having to deal with servers at all. In the case of Lambda, developers can write scripts or functions that were distilled down into the most extremely simple functionality necessary to complete one task. That function can then we wired up to fire during an event, and can be scaled almost infinitely without having to worry about the underlying virtual machines or capacity needed to execute the code. Jobs may only run for a second or less (though they can run for longer), and billing is setup to tally on a per-second basis instead of the per-hour or per-minute costs typically associated with launching virtual machines on a cloud provider. In a way, the Serverless or FaaS trend can be thought of as similar to the idea of PaaS in many ways. Infrastructure that is abstracted away completely and seemingly limitless in scalability.

IronFunctions is a little different than Lambda in one major way. You need to run it on servers, so it's not really Serverless from an operational perspective. It does allow you to interact with it via an API and CLI that is compatible with Lambda, and will give you the same functionality as long as you realize you're still going to need to manage infrastructure to make it work! 

What this integration includes

We added this integration by following the Running in Production guide in the IronFunctions documentation. When you deploy IronFunctions from the Marketplace, you'll end up with the following setup:

  • IronFunctions: Set up to scale automatically as more hosts are added to your ContainerShip cluster.
  • IronFunctions UI: A user interface for adding and managing functions and apps
  • Postgres: Stores metadata about apps and mappings of URLs to functions.
  • Redis: Used as a queue for buffering requests for processing when resources are available, an important part of supporting async functions.
  • ContainerShip load balancer: Nginx based load balancing that will automatically adjust configuration as hosts are added/removed or containers are scaled.
  • Volume management: Postgres, Redis, and IronFunctions all write data to disk and ContainerShip is pre-configured to manage the data volumes which will allow you to snapshot your setup and clone it to a new cluster, or even a different provider altogether.

Deploying the integration

First you need to setup a ContainerShip cluster so that you have some server capacity to run the integration on. You should launch a cluster with follower hosts with at least 2GB of RAM. If you would like a walkthrough of launching your first cluster, you can check out this video.

Once your cluster is up and running, go to Applications -> Launch New Application -> Marketplace

application_list.png

Once you're in the Marketplace, click on IronFunctions.

ironfunctions_marketplace.png

You'll then have the option to adjust resource settings for each tier of the integration (redis, postgres, ironfunctions) but the defaults should work well for testing.

ironfunctions_app_settings.png

 

Once you're happy, just click Add Application, and ContainerShip Cloud will stand everything up for you on your cluster.

ironfunctions_applist.png

Accessing Your IronFunctions Setup

Every application in ContainerShip Cloud has a DNS entry generated for it automatically to make accessing it externally simple. To find the DNS entry for your IronFunctions setup, simply click on the application, and look for the "DNS entry".

ironfunctions_app_overview.png

At this point you should be all set to setup your first functions using the Quickstart Guide. The most important part being the installation of the CLI tool fn.

$ curl -LSs http://get.iron.io/fn | sh

What follows is a quick example of how to get started using a simple function written in go: 

1. Create a new directory to work in, and save the following code as func.go:


package main

import (
"encoding/json"
"fmt"
"os"
)

type Person struct {
Name string
}

func main() {
p := &Person{Name: "ContainerShip!"}
json.NewDecoder(os.Stdin).Decode(p)
fmt.Printf("Hello %v!", p.Name)
}

2. Login to your dockerhub account:

$ docker login

3. Initialize your new function

$ fn init mydockerhubusername/testing123
assuming go runtime
func.yaml created.

4. Build the docker image for your new function

$ fn build

5. Push the image for your new function to DockerHub

$ fn push

6. Set the API_URL environment variable to use the DNS entry of your ContainerShip iron functions deployment

$ export API_URL="http://ironio-ironfunctions.40984d40049704dc35df6ae4ee4b5e6c.dns.cship.co"

7. Create your new application

$ fn apps create testing123 mydockerhubusername/testing123
testing123 created

8. Add a route for the testing123 app

$ fn routes create testing123 /hello mydockerhubusername/testing123:0.0.1
/hello created with mydockerhubusername/testing123:0.0.1

9. Call your new testing123 function

$ fn call testing123 /hello
Hello ContainerShip!

What next?

Now that you're up and running and adding functions like a boss, you may want to utilize our streaming logs to aide in debugging, or our prometheus based metrics to see how your services are performing. Once everything is dialed in perfectly, you can take a snapshot of the entire cluster so that you can easily stand the entire fully configured setup up anywhere you like (including all of your functions and routes).


ContainerShip is a hosted containers as a service platform with support for 11 different providers, easy scaling, github and bitbucket integration, build system, out of the box high availability, 5 different docker registry providers, team management, and tons more. Get started on the free forever tier, or try a 30-day free trial of any of our plans.

Sign Up Today