Remove iron...

This commit is contained in:
Travis Reeder
2017-05-18 18:59:34 +00:00
committed by Reed Allman
parent 521df8c1ff
commit 9cc12b4b12
146 changed files with 406 additions and 1050 deletions

View File

@@ -1,77 +1 @@
## v0.2.0 (unreleased) TODO
### Release Notes
### Features
- [#428](https://github.com/treeder/functions/issues/428): Change update route from PUT to PATCH.
- [#368](https://github.com/treeder/functions/issues/368): fn: support route headers tweaks.
- [#316](https://github.com/treeder/functions/issues/316): fnctl: Add rustlang support.
- [#313](https://github.com/treeder/functions/issues/313): fnctl: Add .NET core support?.
- [#310](https://github.com/treeder/functions/issues/310): fnctl: Add python support.
- [#69](https://github.com/treeder/functions/issues/69): Long(er) running containers for better performance aka Hot Containers.
- [#472](https://github.com/treeder/functions/pull/472): Add global lru for routes with keys being the appname + path.
- [#484](https://github.com/treeder/functions/pull/484): Add triggers example for OpenStack project Picasso.
- [#487](https://github.com/treeder/functions/pull/487): Add initial load balancer.
### Bugfixes
- [#483](https://github.com/treeder/functions/pull/483): Listen for PORT before running async/sync workers in order to prevent errors.
- [#479](https://github.com/treeder/functions/pull/478): Add routes config set/unset back
- [#429](https://github.com/treeder/functions/issues/429): Broken docs after merge.
- [#422](https://github.com/treeder/functions/issues/422): The headers field in func.yaml expects an array of values for each header key.
- [#421](https://github.com/treeder/functions/issues/421): Can't update a route and show better error message.
- [#420](https://github.com/treeder/functions/issues/420): `fn` tool install script not being updated to new releases.
- [#419](https://github.com/treeder/functions/issues/419): --runtime flag on init doesn't work area/fn .
- [#414](https://github.com/treeder/functions/issues/414): make run-docker is buggy on linux .
- [#413](https://github.com/treeder/functions/issues/413): fnctl: Creating routes ignores the route path and assigns function name.
- [#403](https://github.com/treeder/functions/issues/403): Route update (HTTP PUT) modifies datastore entity by making it inconsistent.
- [#393](https://github.com/treeder/functions/issues/393): Add documentation on how to use hot containers.
- [#384](https://github.com/treeder/functions/issues/384): Multiple routines use non-threadsafe cache.
- [#381](https://github.com/treeder/functions/issues/381): Unable to update route path through HTTP PUT area/api bug.
- [#380](https://github.com/treeder/functions/issues/380): Unable to update app name.
- [#373](https://github.com/treeder/functions/issues/373): fn build should fail if no version in func.yaml.
- [#369](https://github.com/treeder/functions/issues/369): Add documentation related to SpecialHandlers.
- [#366](https://github.com/treeder/functions/issues/366): Documentation lagging behind after Hot Containers.
- [#365](https://github.com/treeder/functions/issues/365): Documentation lagging behind on AppListeners.
- [#364](https://github.com/treeder/functions/issues/364): Remove app_name from per function endpoints.
- [#363](https://github.com/treeder/functions/issues/363): Update CONTRIBUTING with some rules of PRs.
- [#360](https://github.com/treeder/functions/issues/360): HTTP route /version is not described in swagger doc.
- [#352](https://github.com/treeder/functions/issues/352): Improve `fn publish` command .
- [#345](https://github.com/treeder/functions/issues/345): Check and fix for potential goroutine leak in api/runner.
- [#339](https://github.com/treeder/functions/issues/339): Unable to run sync route execution longer than 60 seconds.
- [#320](https://github.com/treeder/functions/issues/320): Change cli tool name to `fn`?.
- [#319](https://github.com/treeder/functions/issues/319): Update docs to link to client libraries.
- [#304](https://github.com/treeder/functions/issues/304): Create an fnctl dns entry and enable ssl for install of the cli tool.
- [#302](https://github.com/treeder/functions/issues/302): Placement of app name in fnctl seems inconsistent .
- [#301](https://github.com/treeder/functions/issues/301): can add a route with /hello but cant delete it with /hello .. have to delete it with just hello.
- [#299](https://github.com/treeder/functions/issues/299): More obvious USAGE line for where to include app name.
- [#298](https://github.com/treeder/functions/issues/298): deleting a route that doesn't exist says it's deleted.
- [#296](https://github.com/treeder/functions/issues/296): Better error messages for error on creating app.
- [#293](https://github.com/treeder/functions/issues/293): fn: auto release for fn.
- [#288](https://github.com/treeder/functions/issues/288): api: add upsert entrypoint for route updates.
- [#284](https://github.com/treeder/functions/issues/284): Update iron/node image.
- [#275](https://github.com/treeder/functions/issues/275): Functions API /tasks returns only one task ignoring query parameter `n`.
- [#274](https://github.com/treeder/functions/issues/274): Support app deletion API .
- [#254](https://github.com/treeder/functions/issues/254): HTTP POST to /apps/{app}/routes is not returning HTTP 409 in case of existing similar route.
- [#253](https://github.com/treeder/functions/issues/253): HTTP POST to /app for app creation should return HTTP 409 if app already exists.
- [#252](https://github.com/treeder/functions/issues/252): HTTP PUT to /apps/{app} creates new app instead of modifying initial.
- [#251](https://github.com/treeder/functions/issues/251): Maybe drop the CONFIG_ prefix on user defined config vars?.
- [#235](https://github.com/treeder/functions/issues/235): Docs: Missing Redis docs.
- [#229](https://github.com/treeder/functions/issues/229): fnctl change suggestions.
- [#218](https://github.com/treeder/functions/issues/218): Copy s3 event example from treeder/lambda.
- [#216](https://github.com/treeder/functions/issues/216): fnclt lambda commands need to automatically detect region from the AWS config.
- [#197](https://github.com/treeder/functions/issues/197): Create an fnctl dns entry and enable ssl for install of the cli tool.
- [#182](https://github.com/treeder/functions/issues/182): Remove error in logs when image not found.
- [#161](https://github.com/treeder/functions/issues/161): Example slackbot - Copy guppy example over.
- [#134](https://github.com/treeder/functions/issues/134): Dynamic runners scaling.
- [#126](https://github.com/treeder/functions/issues/126): Detect OS and disable Memory profiling if needed.
- [#72](https://github.com/treeder/functions/issues/72): Should the input stream include a headers section, just like HTTP?.
- [#69](https://github.com/treeder/functions/issues/69): How to run on Openstack.
- [#20](https://github.com/treeder/functions/issues/20): Make function testing framework.
- [#3](https://github.com/treeder/functions/issues/3): Make "function tool" in ironcli.
- [#2](https://github.com/treeder/functions/issues/2): Allow setting content-type on a route, then use that when responding.
## v0.1.0 [2016-11-18]
Alpha 1 Release

View File

@@ -1,4 +1,4 @@
# Contributing to IronFunctions # Contributing to Oracle Functions
We welcome all contributions! We welcome all contributions!
@@ -52,7 +52,7 @@ make test
make docker-run make docker-run
``` ```
will start IronFunctions inside a Docker container. will start Functions inside a Docker container.
## Tests in Docker ## Tests in Docker
@@ -61,4 +61,4 @@ make docker-test
``` ```
will test IronFunctions inside a Docker container. will test Functions inside a Docker container.

View File

@@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier same "printed page" as the copyright notice for easier
identification within third-party archives. identification within third-party archives.
Copyright 2016 Iron.io Copyright 2017 Oracle Corporation
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@@ -199,3 +199,7 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
=========================
Copyright for portions of this project are held by Iron.io, 2016 as part of project IronFunctions.

View File

@@ -28,7 +28,7 @@ docker-dep:
docker run --rm -it -v ${CURDIR}:/go/src/github.com/treeder/functions -w /go/src/github.com/treeder/functions treeder/glide install -v docker run --rm -it -v ${CURDIR}:/go/src/github.com/treeder/functions -w /go/src/github.com/treeder/functions treeder/glide install -v
docker-build: docker-build:
docker run --rm -v ${CURDIR}:/go/src/github.com/treeder/functions -w /go/src/github.com/treeder/functions iron/go:dev go build -o functions-alpine docker run --rm -v ${CURDIR}:/go/src/github.com/treeder/functions -w /go/src/github.com/treeder/functions funcy/go:dev go build -o functions-alpine
docker build --build-arg HTTP_PROXY -t treeder/functions:latest . docker build --build-arg HTTP_PROXY -t treeder/functions:latest .
docker-run: docker-build docker-run: docker-build
@@ -39,7 +39,7 @@ docker-test:
-v /var/run/docker.sock:/var/run/docker.sock \ -v /var/run/docker.sock:/var/run/docker.sock \
-v ${CURDIR}:/go/src/github.com/treeder/functions \ -v ${CURDIR}:/go/src/github.com/treeder/functions \
-w /go/src/github.com/treeder/functions \ -w /go/src/github.com/treeder/functions \
iron/go:dev go test \ funcy/go:dev go test \
-v $(shell docker run -ti -v ${CURDIR}:/go/src/github.com/treeder/functions -w /go/src/github.com/treeder/functions -e GOPATH=/go golang:alpine sh -c 'go list ./... | grep -v vendor | grep -v examples | grep -v tool | grep -v fn | grep -v datastore') -v $(shell docker run -ti -v ${CURDIR}:/go/src/github.com/treeder/functions -w /go/src/github.com/treeder/functions -e GOPATH=/go golang:alpine sh -c 'go list ./... | grep -v vendor | grep -v examples | grep -v tool | grep -v fn | grep -v datastore')
all: dep build all: dep build

View File

@@ -1,19 +1,19 @@
![IronFunctions](docs/assets/logo-black-400w.png) # NONAME... :(
[![CircleCI](https://circleci.com/gh/treeder/functions.svg?style=svg)](https://circleci.com/gh/treeder/functions) [![CircleCI](https://circleci.com/gh/treeder/functions.svg?style=svg)](https://circleci.com/gh/treeder/functions)
[![GoDoc](https://godoc.org/github.com/treeder/functions?status.svg)](https://godoc.org/github.com/treeder/functions) [![GoDoc](https://godoc.org/github.com/treeder/functions?status.svg)](https://godoc.org/github.com/treeder/functions)
Welcome to IronFunctions! The open source serverless platform. Welcome to Oracle Functions! The open source serverless platform.
## What is IronFunctions? ## What is Oracle Functions?
IronFunctions is an open source serverless platform, or as we like to refer to it, Functions as a Oracle Functions is an open source serverless platform, or as we like to refer to it, Functions as a
Service (FaaS) platform that you can run anywhere. Service (FaaS) platform that you can run anywhere.
* Write once * Write once
* [Any language](docs/faq.md#which-languages-are-supported) * [Any language](docs/faq.md#which-languages-are-supported)
* [AWS Lambda format supported](docs/lambda/README.md) * [AWS Lambda format supported](docs/lambda/README.md)
* [Run anywhere](docs/faq.md#where-can-i-run-ironfunctions) * [Run anywhere](docs/faq.md#where-can-i-run-functions)
* Public, private and hybrid cloud * Public, private and hybrid cloud
* [Import functions directly from Lambda](docs/lambda/import.md) and run them wherever you want * [Import functions directly from Lambda](docs/lambda/import.md) and run them wherever you want
* Easy to use [for developers](docs/README.md#for-developers) * Easy to use [for developers](docs/README.md#for-developers)
@@ -34,12 +34,12 @@ The main benefits that most people refer to are on the developer side and they i
* Pay by the milliseconds your code is executing -- unlike a typical application that runs 24/7, and you're paying * Pay by the milliseconds your code is executing -- unlike a typical application that runs 24/7, and you're paying
24/7, functions only run when needed 24/7, functions only run when needed
Since you'll be running IronFunctions yourself, the paying part may not apply, but it does apply to Since you'll be running Oracle Functions yourself, the paying part may not apply, but it does apply to
cost savings on your infrastructure bills as you'll read below. cost savings on your infrastructure bills as you'll read below.
### Benefits for operators ### Benefits for operators
If you will be operating IronFunctions (the person who has to manage the servers behind the serverless), If you will be operating Oracle Functions (the person who has to manage the servers behind the serverless),
then the benefits are different, but related. then the benefits are different, but related.
* Extremely efficient use of resources * Extremely efficient use of resources
@@ -50,18 +50,15 @@ then the benefits are different, but related.
* Single system for code written in any language or any technology * Single system for code written in any language or any technology
* Single system to monitor * Single system to monitor
* Scaling is the same for all functions, you don't scale each app independently * Scaling is the same for all functions, you don't scale each app independently
* Scaling is simply adding more IronFunctions nodes * Scaling is simply adding more Oracle Functions nodes
There is a lot more reading you can do on the topic, just search for ["what is serverless"](https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=what%20is%20serverless) There is a lot more reading you can do on the topic, just search for
and you'll find plenty of information. We have pretty thorough post on the Iron.io blog called ["what is serverless"](https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=what%20is%20serverless)
[What is Serverless Computing and Why is it Important](https://www.iron.io/what-is-serverless-computing/). and you'll find plenty of information.
## Join Our Community ## Join Our Community
Join our Slack community to get help and give feedback. TODO: Slack or Discord community.
[![Slack Status](https://open-iron.herokuapp.com/badge.svg)](
get.iron.io/open-slack)
## Quickstart ## Quickstart
@@ -69,12 +66,12 @@ This guide will get you up and running in a few minutes.
### Prequisites ### Prequisites
* Docker 1.12 or later installed and running * Docker 17.05 or later installed and running
* Logged into Docker Hub (`docker login`) * Logged into Docker Hub (`docker login`)
### Run IronFunctions ### Run Oracle Functions
To get started quickly with IronFunctions, just fire up an `treeder/functions` container: To get started quickly with Oracle Functions, just fire up a `treeder/functions` container:
```sh ```sh
docker run --rm -it --name functions -v ${PWD}/data:/app/data -v /var/run/docker.sock:/var/run/docker.sock -p 8080:8080 treeder/functions docker run --rm -it --name functions -v ${PWD}/data:/app/data -v /var/run/docker.sock:/var/run/docker.sock -p 8080:8080 treeder/functions
@@ -82,12 +79,12 @@ docker run --rm -it --name functions -v ${PWD}/data:/app/data -v /var/run/docker
*where ${PWD}/data is the directory where the functions application data files will be stored* *where ${PWD}/data is the directory where the functions application data files will be stored*
This will start IronFunctions in single server mode, using an embedded database and message queue. You can find all the This will start Oracle Functions in single server mode, using an embedded database and message queue. You can find all the
configuration options [here](docs/operating/options.md). If you are on Windows, check [here](docs/operating/windows.md). configuration options [here](docs/operating/options.md). If you are on Windows, check [here](docs/operating/windows.md).
### CLI tool ### CLI tool
Install the IronFunctions CLI tool: Install the Oracle Functions CLI tool:
```sh ```sh
curl -LSs https://goo.gl/KKDFGn | sh curl -LSs https://goo.gl/KKDFGn | sh
@@ -155,7 +152,7 @@ write your functions in AWS's [Lambda format](docs/lambda/README.md).
## Usage ## Usage
This is a more detailed explanation of the main commands you'll use in IronFunctions as a developer. This is a more detailed explanation of the main commands you'll use in Oracle Functions as a developer.
### Create an Application ### Create an Application
@@ -180,12 +177,12 @@ Now that we have an app, we can route endpoints to functions.
### Add a Route ### Add a Route
A route is a way to define a path in your application that maps to a function. In this example, we'll map A route is a way to define a path in your application that maps to a function. In this example, we'll map
`/hello` to a simple `Hello World!` function called `iron/hello` which is a function we already made that you `/hello` to a simple `Hello World!` function called `treeder/hello` which is a function we already made that you
can use -- yes, you can share functions! The source code for this function is in the [examples directory](examples/hello/go). can use -- yes, you can share functions! The source code for this function is in the [examples directory](examples/hello/go).
You can read more about [writing your own functions here](docs/writing.md). You can read more about [writing your own functions here](docs/writing.md).
```sh ```sh
fn routes create myapp /hello -i iron/hello fn routes create myapp /hello -i treeder/hello
``` ```
Or using cURL: Or using cURL:
@@ -194,7 +191,7 @@ Or using cURL:
curl -H "Content-Type: application/json" -X POST -d '{ curl -H "Content-Type: application/json" -X POST -d '{
"route": { "route": {
"path":"/hello", "path":"/hello",
"image":"iron/hello" "image":"treeder/hello"
} }
}' http://localhost:8080/v1/apps/myapp/routes }' http://localhost:8080/v1/apps/myapp/routes
``` ```
@@ -240,7 +237,7 @@ You should see it say `Hello Johnny!` now instead of `Hello World!`.
### Add an asynchronous function ### Add an asynchronous function
IronFunctions supports synchronous function calls like we just tried above, and asynchronous for background processing. Oracle Functions supports synchronous function calls like we just tried above, and asynchronous for background processing.
Asynchronous function calls are great for tasks that are CPU heavy or take more than a few seconds to complete. Asynchronous function calls are great for tasks that are CPU heavy or take more than a few seconds to complete.
For instance, image processing, video processing, data processing, ETL, etc. For instance, image processing, video processing, data processing, ETL, etc.
@@ -256,7 +253,7 @@ curl -H "Content-Type: application/json" -X POST -d '{
"route": { "route": {
"type": "async", "type": "async",
"path":"/hello-async", "path":"/hello-async",
"image":"iron/hello" "image":"treeder/hello"
} }
}' http://localhost:8080/v1/apps/myapp/routes }' http://localhost:8080/v1/apps/myapp/routes
``` ```
@@ -284,7 +281,7 @@ Read more on [logging](docs/logging.md).
## Functions UI ## Functions UI
```sh ```sh
docker run --rm -it --link functions:api -p 4000:4000 -e "API_URL=http://api:8080" iron/functions-ui docker run --rm -it --link functions:api -p 4000:4000 -e "API_URL=http://api:8080" treeder/functions-ui
``` ```
For more information, see: https://github.com/treeder/functions-ui For more information, see: https://github.com/treeder/functions-ui
@@ -319,11 +316,11 @@ These are the high level roadmap goals. See [milestones](https://github.com/tree
You can get community support via: You can get community support via:
* [Stack Overflow](http://stackoverflow.com/questions/tagged/ironfunctions) * [Stack Overflow](http://stackoverflow.com/questions/tagged/functions)
* [Slack](http://get.iron.io/open-slack) * [Slack](http://get.iron.io/open-slack)
You can get commercial support by contacting [Iron.io](https://iron.io/contact) You can get commercial support by contacting [Iron.io](https://iron.io/contact)
## Want to contribute to IronFunctions? ## Want to contribute to Oracle Functions?
See [contributing](CONTRIBUTING.md). See [contributing](CONTRIBUTING.md).

View File

@@ -274,7 +274,7 @@ func Test(t *testing.T, ds models.Datastore) {
// unchanged // unchanged
AppName: testRoute.AppName, AppName: testRoute.AppName,
Path: testRoute.Path, Path: testRoute.Path,
Image: "iron/hello", Image: "treeder/hello",
Type: "sync", Type: "sync",
Format: "http", Format: "http",
// updated // updated
@@ -317,7 +317,7 @@ func Test(t *testing.T, ds models.Datastore) {
// unchanged // unchanged
AppName: testRoute.AppName, AppName: testRoute.AppName,
Path: testRoute.Path, Path: testRoute.Path,
Image: "iron/hello", Image: "treeder/hello",
Type: "sync", Type: "sync",
Format: "http", Format: "http",
Timeout: 100, Timeout: 100,
@@ -482,7 +482,7 @@ var testApp = &models.App{
var testRoute = &models.Route{ var testRoute = &models.Route{
AppName: testApp.Name, AppName: testApp.Name,
Path: "/test", Path: "/test",
Image: "iron/hello", Image: "treeder/hello",
Type: "sync", Type: "sync",
Format: "http", Format: "http",
} }

View File

@@ -1,17 +1,3 @@
// Copyright 2016 Iron.io
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package common package common
import ( import (

View File

@@ -1,17 +1,3 @@
// Copyright 2016 Iron.io
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package common package common
import "time" import "time"

View File

@@ -1,17 +1,3 @@
// Copyright 2016 Iron.io
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package common package common
import ( import (

View File

@@ -1,17 +1,3 @@
// Copyright 2016 Iron.io
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package common package common
import ( import (

View File

@@ -1,17 +1,3 @@
// Copyright 2016 Iron.io
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package common package common
import ( import (

View File

@@ -1,17 +1,3 @@
// Copyright 2016 Iron.io
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package common package common
import ( import (

View File

@@ -1,17 +1,3 @@
// Copyright 2016 Iron.io
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package stats package stats
import ( import (

View File

@@ -1,17 +1,3 @@
// Copyright 2016 Iron.io
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package stats package stats
import ( import (

View File

@@ -1,17 +1,3 @@
// Copyright 2016 Iron.io
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package stats package stats
import ( import (

View File

@@ -1,17 +1,3 @@
// Copyright 2016 Iron.io
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package stats package stats
import ( import (

View File

@@ -1,17 +1,3 @@
// Copyright 2016 Iron.io
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package stats package stats
import ( import (

View File

@@ -1,19 +1,5 @@
// +build riemann // +build riemann
// Copyright 2016 Iron.io
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package stats package stats
import ( import (

View File

@@ -1,17 +1,3 @@
// Copyright 2016 Iron.io
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package stats package stats
import ( import (

View File

@@ -1,17 +1,3 @@
// Copyright 2016 Iron.io
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package stats package stats
import ( import (

View File

@@ -1,17 +1,3 @@
// Copyright 2016 Iron.io
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package stats package stats
import ( import (
@@ -81,8 +67,8 @@ func whoami() string {
// keys. The prefix is used as the key prefix. // keys. The prefix is used as the key prefix.
// If config is nil, creates a noop reporter. // If config is nil, creates a noop reporter.
// //
// st, e := NewStatsd(config, "ironmq") // st, e := NewStatsd(config, "servicename")
// st.Inc("enqueue", 1) -> Actually records to key ironmq.enqueue. // st.Inc("eventname", 1) -> Actually records to key servicename.eventname.
func NewStatsd(config *StatsdConfig) (*theStatsdReporter, error) { func NewStatsd(config *StatsdConfig) (*theStatsdReporter, error) {
var client statsd.Statter var client statsd.Statter
var err error var err error

View File

@@ -1,17 +1,3 @@
// Copyright 2016 Iron.io
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package common package common
import ( import (

View File

@@ -1,17 +1,3 @@
// Copyright 2016 Iron.io
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package common package common
import ( import (

View File

@@ -1,17 +1,3 @@
// Copyright 2016 Iron.io
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package docker package docker
import ( import (

View File

@@ -1,19 +1,5 @@
// +build go1.7 // +build go1.7
// Copyright 2016 Iron.io
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package docker package docker
import ( import (

View File

@@ -1,17 +1,3 @@
// Copyright 2016 Iron.io
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package docker package docker
import ( import (
@@ -23,9 +9,9 @@ import (
"testing" "testing"
"time" "time"
"github.com/vrischmann/envconfig"
"gitlab.oracledx.com/odx/functions/api/runner/common" "gitlab.oracledx.com/odx/functions/api/runner/common"
"gitlab.oracledx.com/odx/functions/api/runner/drivers" "gitlab.oracledx.com/odx/functions/api/runner/drivers"
"github.com/vrischmann/envconfig"
) )
type taskDockerTest struct { type taskDockerTest struct {
@@ -41,7 +27,7 @@ func (f *taskDockerTest) EnvVars() map[string]string {
func (f *taskDockerTest) Labels() map[string]string { return nil } func (f *taskDockerTest) Labels() map[string]string { return nil }
func (f *taskDockerTest) Id() string { return f.id } func (f *taskDockerTest) Id() string { return f.id }
func (f *taskDockerTest) Group() string { return "" } func (f *taskDockerTest) Group() string { return "" }
func (f *taskDockerTest) Image() string { return "iron/hello" } func (f *taskDockerTest) Image() string { return "treeder/hello" }
func (f *taskDockerTest) Timeout() time.Duration { return 30 * time.Second } func (f *taskDockerTest) Timeout() time.Duration { return 30 * time.Second }
func (f *taskDockerTest) Logger() (stdout, stderr io.Writer) { return f.output, nil } func (f *taskDockerTest) Logger() (stdout, stderr io.Writer) { return f.output, nil }
func (f *taskDockerTest) WriteStat(drivers.Stat) { /* TODO */ } func (f *taskDockerTest) WriteStat(drivers.Stat) { /* TODO */ }

View File

@@ -1,17 +1,3 @@
// Copyright 2016 Iron.io
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Interface for all container drivers // Interface for all container drivers
package drivers package drivers

View File

@@ -1,17 +1,3 @@
// Copyright 2016 Iron.io
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package drivers package drivers
import ( import (
@@ -108,14 +94,14 @@ func TestDecimate(t *testing.T) {
func TestParseImage(t *testing.T) { func TestParseImage(t *testing.T) {
cases := map[string][]string{ cases := map[string][]string{
"iron/hello": {"", "iron/hello", "latest"}, "treeder/hello": {"", "treeder/hello", "latest"},
"iron/hello:v1": {"", "iron/hello", "v1"}, "treeder/hello:v1": {"", "treeder/hello", "v1"},
"my.registry/hello": {"my.registry", "hello", "latest"}, "my.registry/hello": {"my.registry", "hello", "latest"},
"my.registry/hello:v1": {"my.registry", "hello", "v1"}, "my.registry/hello:v1": {"my.registry", "hello", "v1"},
"mongo": {"", "library/mongo", "latest"}, "mongo": {"", "library/mongo", "latest"},
"mongo:v1": {"", "library/mongo", "v1"}, "mongo:v1": {"", "library/mongo", "v1"},
"quay.com/iron/hello": {"quay.com", "iron/hello", "latest"}, "quay.com/treeder/hello": {"quay.com", "treeder/hello", "latest"},
"quay.com:8080/iron/hello:v2": {"quay.com:8080", "iron/hello", "v2"}, "quay.com:8080/treeder/hello:v2": {"quay.com:8080", "treeder/hello", "v2"},
"localhost.localdomain:5000/samalba/hipache:latest": {"localhost.localdomain:5000", "samalba/hipache", "latest"}, "localhost.localdomain:5000/samalba/hipache:latest": {"localhost.localdomain:5000", "samalba/hipache", "latest"},
} }

View File

@@ -1,17 +1,3 @@
// Copyright 2016 Iron.io
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package mock package mock
import ( import (

View File

@@ -29,8 +29,8 @@ func TestRunnerHello(t *testing.T) {
expectedOut string expectedOut string
expectedErr string expectedErr string
}{ }{
{&models.Route{Image: "iron/hello"}, ``, "success", "Hello World!", ""}, {&models.Route{Image: "treeder/hello"}, ``, "success", "Hello World!", ""},
{&models.Route{Image: "iron/hello"}, `{"name": "test"}`, "success", "Hello test!", ""}, {&models.Route{Image: "treeder/hello"}, `{"name": "test"}`, "success", "Hello test!", ""},
} { } {
var stdout, stderr bytes.Buffer var stdout, stderr bytes.Buffer
cfg := &task.Config{ cfg := &task.Config{
@@ -82,8 +82,8 @@ func TestRunnerError(t *testing.T) {
expectedOut string expectedOut string
expectedErr string expectedErr string
}{ }{
{&models.Route{Image: "iron/error"}, ``, "error", "", ""}, {&models.Route{Image: "funcy/error"}, ``, "error", "", ""},
{&models.Route{Image: "iron/error"}, `{"name": "test"}`, "error", "", ""}, {&models.Route{Image: "funcy/error"}, `{"name": "test"}`, "error", "", ""},
} { } {
var stdout, stderr bytes.Buffer var stdout, stderr bytes.Buffer
cfg := &task.Config{ cfg := &task.Config{

View File

@@ -9,9 +9,9 @@ import (
"time" "time"
"github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"gitlab.oracledx.com/odx/functions/api/runner/drivers"
"gitlab.oracledx.com/odx/functions/api/runner/protocol" "gitlab.oracledx.com/odx/functions/api/runner/protocol"
"gitlab.oracledx.com/odx/functions/api/runner/task" "gitlab.oracledx.com/odx/functions/api/runner/task"
"gitlab.oracledx.com/odx/functions/api/runner/drivers"
) )
// hot functions - theory of operation // hot functions - theory of operation
@@ -61,7 +61,6 @@ import (
// Terminate // Terminate
// (internal clock) // (internal clock)
// RunTask helps sending a task.Request into the common concurrency stream. // RunTask helps sending a task.Request into the common concurrency stream.
// Refer to StartWorkers() to understand what this is about. // Refer to StartWorkers() to understand what this is about.
func RunTask(tasks chan task.Request, ctx context.Context, cfg *task.Config) (drivers.RunResult, error) { func RunTask(tasks chan task.Request, ctx context.Context, cfg *task.Config) (drivers.RunResult, error) {
@@ -73,7 +72,7 @@ func RunTask(tasks chan task.Request, ctx context.Context, cfg *task.Config) (dr
} }
// StartWorkers operates the common concurrency stream, ie, it will process all // StartWorkers operates the common concurrency stream, ie, it will process all
// IronFunctions tasks, either sync or async. In the process, it also dispatches // functions tasks, either sync or async. In the process, it also dispatches
// the workload to either regular or hot functions. // the workload to either regular or hot functions.
func StartWorkers(ctx context.Context, rnr *Runner, tasks <-chan task.Request) { func StartWorkers(ctx context.Context, rnr *Runner, tasks <-chan task.Request) {
var wg sync.WaitGroup var wg sync.WaitGroup
@@ -262,13 +261,13 @@ func (hc *htfn) serve(ctx context.Context) {
var wg sync.WaitGroup var wg sync.WaitGroup
cfg := *hc.cfg cfg := *hc.cfg
logger := logrus.WithFields(logrus.Fields{ logger := logrus.WithFields(logrus.Fields{
"app": cfg.AppName, "app": cfg.AppName,
"route": cfg.Path, "route": cfg.Path,
"image": cfg.Image, "image": cfg.Image,
"memory": cfg.Memory, "memory": cfg.Memory,
"format": cfg.Format, "format": cfg.Format,
"max_concurrency": cfg.MaxConcurrency, "max_concurrency": cfg.MaxConcurrency,
"idle_timeout": cfg.IdleTimeout, "idle_timeout": cfg.IdleTimeout,
}) })
wg.Add(1) wg.Add(1)

View File

@@ -29,12 +29,12 @@ func TestRouteCreate(t *testing.T) {
{datastore.NewMock(), "/v1/apps/a/routes", `{ "path": "/myroute" }`, http.StatusBadRequest, models.ErrRoutesMissingNew}, {datastore.NewMock(), "/v1/apps/a/routes", `{ "path": "/myroute" }`, http.StatusBadRequest, models.ErrRoutesMissingNew},
{datastore.NewMock(), "/v1/apps/a/routes", `{ "route": { } }`, http.StatusBadRequest, models.ErrRoutesValidationMissingPath}, {datastore.NewMock(), "/v1/apps/a/routes", `{ "route": { } }`, http.StatusBadRequest, models.ErrRoutesValidationMissingPath},
{datastore.NewMock(), "/v1/apps/a/routes", `{ "route": { "path": "/myroute" } }`, http.StatusBadRequest, models.ErrRoutesValidationMissingImage}, {datastore.NewMock(), "/v1/apps/a/routes", `{ "route": { "path": "/myroute" } }`, http.StatusBadRequest, models.ErrRoutesValidationMissingImage},
{datastore.NewMock(), "/v1/apps/a/routes", `{ "route": { "image": "iron/hello" } }`, http.StatusBadRequest, models.ErrRoutesValidationMissingPath}, {datastore.NewMock(), "/v1/apps/a/routes", `{ "route": { "image": "treeder/hello" } }`, http.StatusBadRequest, models.ErrRoutesValidationMissingPath},
{datastore.NewMock(), "/v1/apps/a/routes", `{ "route": { "image": "iron/hello", "path": "myroute" } }`, http.StatusBadRequest, models.ErrRoutesValidationInvalidPath}, {datastore.NewMock(), "/v1/apps/a/routes", `{ "route": { "image": "treeder/hello", "path": "myroute" } }`, http.StatusBadRequest, models.ErrRoutesValidationInvalidPath},
{datastore.NewMock(), "/v1/apps/$/routes", `{ "route": { "image": "iron/hello", "path": "/myroute" } }`, http.StatusInternalServerError, models.ErrAppsValidationInvalidName}, {datastore.NewMock(), "/v1/apps/$/routes", `{ "route": { "image": "treeder/hello", "path": "/myroute" } }`, http.StatusInternalServerError, models.ErrAppsValidationInvalidName},
// success // success
{datastore.NewMock(), "/v1/apps/a/routes", `{ "route": { "image": "iron/hello", "path": "/myroute" } }`, http.StatusOK, nil}, {datastore.NewMock(), "/v1/apps/a/routes", `{ "route": { "image": "treeder/hello", "path": "/myroute" } }`, http.StatusOK, nil},
} { } {
rnr, cancel := testRunner(t) rnr, cancel := testRunner(t)
srv := testServer(test.mock, &mqs.Mock{}, rnr, tasks) srv := testServer(test.mock, &mqs.Mock{}, rnr, tasks)
@@ -207,7 +207,7 @@ func TestRouteUpdate(t *testing.T) {
Path: "/myroute/do", Path: "/myroute/do",
}, },
}, },
), "/v1/apps/a/routes/myroute/do", `{ "route": { "image": "iron/hello" } }`, http.StatusOK, nil}, ), "/v1/apps/a/routes/myroute/do", `{ "route": { "image": "treeder/hello" } }`, http.StatusOK, nil},
// Addresses #381 // Addresses #381
{datastore.NewMockInit(nil, {datastore.NewMockInit(nil,

View File

@@ -45,9 +45,9 @@ func TestRouteRunnerAsyncExecution(t *testing.T) {
{Name: "myapp", Config: map[string]string{"app": "true"}}, {Name: "myapp", Config: map[string]string{"app": "true"}},
}, },
[]*models.Route{ []*models.Route{
{Type: "async", Path: "/myroute", AppName: "myapp", Image: "iron/hello", Config: map[string]string{"test": "true"}}, {Type: "async", Path: "/myroute", AppName: "myapp", Image: "treeder/hello", Config: map[string]string{"test": "true"}},
{Type: "async", Path: "/myerror", AppName: "myapp", Image: "iron/error", Config: map[string]string{"test": "true"}}, {Type: "async", Path: "/myerror", AppName: "myapp", Image: "funcy/error", Config: map[string]string{"test": "true"}},
{Type: "async", Path: "/myroute/:param", AppName: "myapp", Image: "iron/hello", Config: map[string]string{"test": "true"}}, {Type: "async", Path: "/myroute/:param", AppName: "myapp", Image: "treeder/hello", Config: map[string]string{"test": "true"}},
}, },
) )
mq := &mqs.Mock{} mq := &mqs.Mock{}

View File

@@ -128,8 +128,8 @@ func TestRouteRunnerExecution(t *testing.T) {
{Name: "myapp", Config: models.Config{}}, {Name: "myapp", Config: models.Config{}},
}, },
[]*models.Route{ []*models.Route{
{Path: "/myroute", AppName: "myapp", Image: "iron/hello", Headers: map[string][]string{"X-Function": {"Test"}}}, {Path: "/myroute", AppName: "myapp", Image: "treeder/hello", Headers: map[string][]string{"X-Function": {"Test"}}},
{Path: "/myerror", AppName: "myapp", Image: "iron/error", Headers: map[string][]string{"X-Function": {"Test"}}}, {Path: "/myerror", AppName: "myapp", Image: "funcy/error", Headers: map[string][]string{"X-Function": {"Test"}}},
}, },
), &mqs.Mock{}, rnr, tasks) ), &mqs.Mock{}, rnr, tasks)
@@ -186,7 +186,7 @@ func TestRouteRunnerTimeout(t *testing.T) {
{Name: "myapp", Config: models.Config{}}, {Name: "myapp", Config: models.Config{}},
}, },
[]*models.Route{ []*models.Route{
{Path: "/sleeper", AppName: "myapp", Image: "iron/sleeper", Timeout: 1}, {Path: "/sleeper", AppName: "myapp", Image: "funcy/sleeper", Timeout: 1},
}, },
), &mqs.Mock{}, rnr, tasks) ), &mqs.Mock{}, rnr, tasks)

View File

@@ -14,15 +14,15 @@ import (
"github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/ccirello/supervisor" "github.com/ccirello/supervisor"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/spf13/viper"
"gitlab.oracledx.com/odx/functions/api" "gitlab.oracledx.com/odx/functions/api"
"gitlab.oracledx.com/odx/functions/api/datastore" "gitlab.oracledx.com/odx/functions/api/datastore"
"gitlab.oracledx.com/odx/functions/api/models" "gitlab.oracledx.com/odx/functions/api/models"
"gitlab.oracledx.com/odx/functions/api/mqs" "gitlab.oracledx.com/odx/functions/api/mqs"
"gitlab.oracledx.com/odx/functions/api/runner" "gitlab.oracledx.com/odx/functions/api/runner"
"gitlab.oracledx.com/odx/functions/api/runner/common"
"gitlab.oracledx.com/odx/functions/api/runner/task" "gitlab.oracledx.com/odx/functions/api/runner/task"
"gitlab.oracledx.com/odx/functions/api/server/internal/routecache" "gitlab.oracledx.com/odx/functions/api/server/internal/routecache"
"gitlab.oracledx.com/odx/functions/api/runner/common"
"github.com/spf13/viper"
) )
const ( const (
@@ -55,7 +55,7 @@ type Server struct {
const cacheSize = 1024 const cacheSize = 1024
// NewFromEnv creates a new IronFunctions server based on env vars. // NewFromEnv creates a new Functions server based on env vars.
func NewFromEnv(ctx context.Context) *Server { func NewFromEnv(ctx context.Context) *Server {
ds, err := datastore.New(viper.GetString(EnvDBURL)) ds, err := datastore.New(viper.GetString(EnvDBURL))
if err != nil { if err != nil {
@@ -72,7 +72,7 @@ func NewFromEnv(ctx context.Context) *Server {
return New(ctx, ds, mq, apiURL) return New(ctx, ds, mq, apiURL)
} }
// New creates a new IronFunctions server with the passed in datastore, message queue and API URL // New creates a new Functions server with the passed in datastore, message queue and API URL
func New(ctx context.Context, ds models.Datastore, mq models.MessageQueue, apiURL string, opts ...ServerOption) *Server { func New(ctx context.Context, ds models.Datastore, mq models.MessageQueue, apiURL string, opts ...ServerOption) *Server {
metricLogger := runner.NewMetricLogger() metricLogger := runner.NewMetricLogger()
funcLogger := runner.NewFuncLogger() funcLogger := runner.NewFuncLogger()

View File

@@ -120,8 +120,8 @@ func TestFullStack(t *testing.T) {
{"create my app", "POST", "/v1/apps", `{ "app": { "name": "myapp" } }`, http.StatusOK, 0}, {"create my app", "POST", "/v1/apps", `{ "app": { "name": "myapp" } }`, http.StatusOK, 0},
{"list apps", "GET", "/v1/apps", ``, http.StatusOK, 0}, {"list apps", "GET", "/v1/apps", ``, http.StatusOK, 0},
{"get app", "GET", "/v1/apps/myapp", ``, http.StatusOK, 0}, {"get app", "GET", "/v1/apps/myapp", ``, http.StatusOK, 0},
{"add myroute", "POST", "/v1/apps/myapp/routes", `{ "route": { "name": "myroute", "path": "/myroute", "image": "iron/hello" } }`, http.StatusOK, 1}, {"add myroute", "POST", "/v1/apps/myapp/routes", `{ "route": { "name": "myroute", "path": "/myroute", "image": "treeder/hello" } }`, http.StatusOK, 1},
{"add myroute2", "POST", "/v1/apps/myapp/routes", `{ "route": { "name": "myroute2", "path": "/myroute2", "image": "iron/error" } }`, http.StatusOK, 2}, {"add myroute2", "POST", "/v1/apps/myapp/routes", `{ "route": { "name": "myroute2", "path": "/myroute2", "image": "funcy/error" } }`, http.StatusOK, 2},
{"get myroute", "GET", "/v1/apps/myapp/routes/myroute", ``, http.StatusOK, 2}, {"get myroute", "GET", "/v1/apps/myapp/routes/myroute", ``, http.StatusOK, 2},
{"get myroute2", "GET", "/v1/apps/myapp/routes/myroute2", ``, http.StatusOK, 2}, {"get myroute2", "GET", "/v1/apps/myapp/routes/myroute2", ``, http.StatusOK, 2},
{"get all routes", "GET", "/v1/apps/myapp/routes", ``, http.StatusOK, 2}, {"get all routes", "GET", "/v1/apps/myapp/routes", ``, http.StatusOK, 2},

View File

@@ -30,7 +30,7 @@ func TestSpecialHandlerSet(t *testing.T) {
// {Name: "test"}, // {Name: "test"},
// }, // },
// Routes: []*models.Route{ // Routes: []*models.Route{
// {Path: "/test", Image: "iron/hello", AppName: "test"}, // {Path: "/test", Image: "treeder/hello", AppName: "test"},
// }, // },
// }, // },
// MQ: &mqs.Mock{}, // MQ: &mqs.Mock{},

View File

@@ -1,4 +1,4 @@
package version package version
// Version of IronFunctions // Version of Functions
var Version = "0.3.2" var Version = "0.3.2"

View File

@@ -62,22 +62,22 @@ languages.each do |l|
when 'ruby' when 'ruby'
clone(l) clone(l)
fruby = "functions_ruby" fruby = "functions_ruby"
gem_name = "iron_functions" gem_name = "oracle_functions"
glob_pattern = ["**", "*.rb"] # just rb files glob_pattern = ["**", "*.rb"] # just rb files
skip_files = ["#{gem_name}.gemspec"] skip_files = ["#{gem_name}.gemspec"]
deploy = ["gem build #{gem_name}.gemspec", "gem push #{gem_name}-#{version}.gem"] deploy = ["gem build #{gem_name}.gemspec", "gem push #{gem_name}-#{version}.gem"]
options['gemName'] = gem_name options['gemName'] = gem_name
options['moduleName'] = "IronFunctions" options['moduleName'] = "OracleFunctions"
options['gemVersion'] = version options['gemVersion'] = version
options['gemHomepage'] = "https://github.com/treeder/#{fruby}" options['gemHomepage'] = "https://github.com/treeder/#{fruby}"
options['gemSummary'] = 'Ruby gem for IronFunctions' options['gemSummary'] = 'Ruby gem for Oracle Functions'
options['gemDescription'] = 'Ruby gem for IronFunctions.' options['gemDescription'] = 'Ruby gem for Oracle Functions.'
options['gemAuthorEmail'] = 'travis@iron.io' options['gemAuthorEmail'] = 'treeder@gmail.com'
when 'javascript' when 'javascript'
lshort = 'js' lshort = 'js'
# copy_dir = "javascript-client/." # copy_dir = "javascript-client/."
clone(lshort) clone(lshort)
options['projectName'] = "iron_functions" options['projectName'] = "oracle_functions"
deploy << "npm publish" deploy << "npm publish"
else else
puts "Skipping #{l}" puts "Skipping #{l}"

View File

@@ -83,16 +83,16 @@ func main() {
case "ruby": case "ruby":
skipFiles = append(skipFiles, "#{gem_name}.gemspec") skipFiles = append(skipFiles, "#{gem_name}.gemspec")
deploy = append(deploy, []string{"gem", "build #{gem_name}.gemspec", "gem push #{gem_name}-#{version}.gem"}) deploy = append(deploy, []string{"gem", "build #{gem_name}.gemspec", "gem push #{gem_name}-#{version}.gem"})
options["gemName"] = "iron_functions" options["gemName"] = "oracle_functions"
options["moduleName"] = "IronFunctions" options["moduleName"] = "OracleFunctions"
options["gemVersion"] = version options["gemVersion"] = version
options["gemHomepage"] = "https://github.com/treeder/functions_ruby" options["gemHomepage"] = "https://github.com/treeder/functions_ruby"
options["gemSummary"] = "Ruby gem for IronFunctions" options["gemSummary"] = "Ruby gem for Oracle Functions"
options["gemDescription"] = "Ruby gem for IronFunctions." options["gemDescription"] = "Ruby gem for Oracle Functions."
options["gemAuthorEmail"] = "travis@iron.io" options["gemAuthorEmail"] = "treeder@gmail.com"
case "javascript": case "javascript":
short = "js" short = "js"
options["projectName"] = "iron_functions" options["projectName"] = "oracle_functions"
deploy = append(deploy, []string{"npm", "publish"}) deploy = append(deploy, []string{"npm", "publish"})
default: default:
continue continue
@@ -305,7 +305,7 @@ func genSwaggerClient(target string) error {
return err return err
} }
cmd := exec.Command("docker", "run", "--rm", "-u", fmt.Sprintf("%s:%s", u.Uid, u.Gid), "-v", fmt.Sprintf("%s/%s:/go/src/github.com/iron-io/functions_go", cwd, target), "-v", fmt.Sprintf("%s/%s:/go/swagger.spec", cwd, swaggerURL), "-w", "/go/src", "quay.io/goswagger/swagger", "generate", "client", "-f", "/go/swagger.spec", "-t", "github.com/iron-io/functions_go", "-A", "functions") cmd := exec.Command("docker", "run", "--rm", "-u", fmt.Sprintf("%s:%s", u.Uid, u.Gid), "-v", fmt.Sprintf("%s/%s:/go/src/github.com/treeder/functions_go", cwd, target), "-v", fmt.Sprintf("%s/%s:/go/swagger.spec", cwd, swaggerURL), "-w", "/go/src", "quay.io/goswagger/swagger", "generate", "client", "-f", "/go/swagger.spec", "-t", "github.com/iron-io/functions_go", "-A", "functions")
d, err := cmd.CombinedOutput() d, err := cmd.CombinedOutput()
if err != nil { if err != nil {
log.Printf("Error running go-swagger: %s\n", d) log.Printf("Error running go-swagger: %s\n", d)

View File

@@ -1,10 +1,10 @@
# IronFunctions Documentation # Oracle Functions Documentation
* [FAQ](faq.md) * [FAQ](faq.md)
## For Developers ## For Developers
If you are a developer using IronFunctions through the API, this section is for you. If you are a developer using Oracle Functions through the API, this section is for you.
* [Quickstart](https://github.com/treeder/functions#quickstart) * [Quickstart](https://github.com/treeder/functions#quickstart)
* [Definitions](definitions.md) * [Definitions](definitions.md)
@@ -19,7 +19,7 @@ If you are a developer using IronFunctions through the API, this section is for
## For Operators ## For Operators
If you are operating IronFunctions, this section is for you. If you are operating Oracle Functions, this section is for you.
* [Running in Production Overview](operating/production.md) * [Running in Production Overview](operating/production.md)
* [Runtime Options](operating/options.md) * [Runtime Options](operating/options.md)
@@ -29,9 +29,9 @@ If you are operating IronFunctions, this section is for you.
* [Logging](operating/logging.md) * [Logging](operating/logging.md)
* [Metrics](operating/metrics.md) * [Metrics](operating/metrics.md)
* [Triggers](operating/triggers.md) * [Triggers](operating/triggers.md)
* [Extending IronFunctions](operating/extending.md) * [Extending Oracle Functions](operating/extending.md)
* [Docker Configuration](operating/docker.md) * [Docker Configuration](operating/docker.md)
* [Operating On Windows](operating/windows.md) * [Operating On Windows](operating/windows.md)
* Running IronFunctions on: * Running Oracle Functions on:
* [Kubernetes](operating/kubernetes/README.md) * [Kubernetes](operating/kubernetes/README.md)
* [Docker Swarm](operating/docker-swarm/README.md) * [Docker Swarm](operating/docker-swarm/README.md)

View File

@@ -58,10 +58,10 @@ Note: Route level configuration overrides app level configuration.
Using `fn`: Using `fn`:
```sh ```sh
fn routes create myapp /path --config k1=v1 --config k2=v2 --image iron/hello fn routes create myapp /path --config k1=v1 --config k2=v2 --image treeder/hello
``` ```
Or using a cURL: Or using cURL:
```sh ```sh
curl -H "Content-Type: application/json" -X POST -d '{ curl -H "Content-Type: application/json" -X POST -d '{
@@ -80,7 +80,7 @@ curl -H "Content-Type: application/json" -X POST -d '{
```json ```json
{ {
"path": "/hello", "path": "/hello",
"image": "iron/hello", "image": "treeder/hello",
"type": "sync", "type": "sync",
"memory": 128, "memory": 128,
"config": { "config": {
@@ -150,4 +150,4 @@ This properties are only used if the function is in `hot function` mode
#### max_concurrency (string) #### max_concurrency (string)
This property defines the maximum amount of concurrent hot functions instances the function should have (per IronFunction node). This property defines the maximum amount of concurrent hot functions instances the function should have (per Oracle Functions node).

View File

@@ -6,16 +6,16 @@ Since we use containers as the base building block, all languages can be used. T
helper libraries like our Lambda wrapper for every language, but you can use any language if you follow the helper libraries like our Lambda wrapper for every language, but you can use any language if you follow the
base [function format](function-format.md). base [function format](function-format.md).
## Where can I run IronFunctions? ## Where can I run Oracle Functions?
Anywhere. Any cloud, on-premise, on your laptop. As long as you can run a Docker container, you can run IronFunctions. Anywhere. Any cloud, on-premise, on your laptop. As long as you can run a Docker container, you can run Oracle Functions.
## Which orchestration tools does IronFunctions support? ## Which orchestration tools does functions support?
IronFunctions can be deployed using any orchestration tool. Functions can be deployed using any orchestration tool.
## Does IronFunctions require Docker? ## Does Oracle Functions require Docker?
For now we require Docker primarily for the packaging and distribution via Docker Registries, For now we require Docker primarily for the packaging and distribution via Docker Registries,
but we've built IronFunctions in a way that abstracts the container technology so we can support others as but we've built Functions in a way that abstracts the container technology so we can support others as
needed. For instance, we'll eventually add rkt support. needed. For instance, we may add rkt support.

View File

@@ -54,7 +54,7 @@ hello world
The header keys and values would be populated with information about the function call such as the request URL and query parameters. The header keys and values would be populated with information about the function call such as the request URL and query parameters.
`Content-Length` is determined by the [Content-Length](https://tools.ietf.org/html/rfc7230#section-3.3.3) header, which is mandatory both for input and output. It is used by IronFunctions to know when stop writing to STDIN and reading from STDOUT. `Content-Length` is determined by the [Content-Length](https://tools.ietf.org/html/rfc7230#section-3.3.3) header, which is mandatory both for input and output. It is used by Functions to know when stop writing to STDIN and reading from STDOUT.
Pros: Pros:

View File

@@ -1,6 +1,6 @@
# Hot functions # Hot functions
IronFunctions is built on top of container technologies, for each incoming Oracle Functions is built on top of container technologies, for each incoming
workload, it spins a new container, feed it with the payload and sends the workload, it spins a new container, feed it with the payload and sends the
answer back to the caller. You can expect an average start time of 300ms per answer back to the caller. You can expect an average start time of 300ms per
container. You may refer to [this blog](https://medium.com/travis-on-docker/the-overhead-of-docker-run-f2f06d47c9f3#.96tj75ugb) post to understand the details better. container. You may refer to [this blog](https://medium.com/travis-on-docker/the-overhead-of-docker-run-f2f06d47c9f3#.96tj75ugb) post to understand the details better.
@@ -13,7 +13,7 @@ Thus, it means that once you decide to use a hot function, you must be able to
tell the moment it should reading from standard input to start writing to tell the moment it should reading from standard input to start writing to
standard output. standard output.
Currently, IronFunctions implements a HTTP-like protocol to operate hot Currently, Functions implements a HTTP-like protocol to operate hot
containers, but instead of communication through a TCP/IP port, it uses standard containers, but instead of communication through a TCP/IP port, it uses standard
input/output. input/output.
@@ -57,7 +57,7 @@ The next step in the cycle is to do some processing:
``` ```
And finally, we return the result with a `Content-Length` header, so And finally, we return the result with a `Content-Length` header, so
IronFunctions daemon would know when to stop reading the gotten response. Functions daemon would know when to stop reading the gotten response.
```go ```go
res := http.Response{ res := http.Response{
@@ -78,7 +78,7 @@ Rinse and repeat for each incoming workload.
## Deploying a hot function ## Deploying a hot function
Once your functions is adapted to be handled as hot function, you must tell Once your functions is adapted to be handled as hot function, you must tell
IronFunctions daemon that this function is now ready to be reused across Functions daemon that this function is now ready to be reused across
requests: requests:
```json ```json

View File

@@ -1,6 +1,6 @@
# Lambda everywhere # Lambda everywhere
Lambda support for IronFunctions enables you to take your AWS Lambda functions and run them Lambda support for Oracle Functios enables you to take your AWS Lambda functions and run them
anywhere. You should be able to take your code and run them without any changes. anywhere. You should be able to take your code and run them without any changes.
## Creating Lambda Functions ## Creating Lambda Functions

View File

@@ -2,11 +2,11 @@
AWS Lambda introduced serverless computing to the masses. Wouldn't it be nice AWS Lambda introduced serverless computing to the masses. Wouldn't it be nice
if you could run the same Lambda functions on any platform, in any cloud? if you could run the same Lambda functions on any platform, in any cloud?
Iron.io is proud to release a set of tools that allow just this. Package your Oracle is proud to release a set of tools that allow just this. Package your
Lambda function in a Docker container and run it anywhere with an environment Lambda function in a Docker container and run it anywhere with an environment
similar to AWS Lambda. similar to AWS Lambda.
Using a job scheduler such as IronFunctions, you can connect these functions to Using a job scheduler such as Oracle Functions, you can connect these functions to
webhooks and run them on-demand, at scale. You can also use a container webhooks and run them on-demand, at scale. You can also use a container
management system paired with a task queue to run these functions in management system paired with a task queue to run these functions in
a self-contained, platform-independent manner. a self-contained, platform-independent manner.

View File

@@ -1,8 +1,10 @@
# Creating Docker images out of Lambda functions # Creating Docker images out of Lambda functions
Docker images created by running the `create-function` subcommand on a Lambda function are ready to execute. Docker images created by running the `create-function` subcommand on a Lambda function are ready to execute.
You can convert any Lambda function of type nodejs 0.10, python 2.7 and Java 8 into an You can convert any Lambda function of type nodejs 0.10, python 2.7 and Java 8 into an
IronFunction compatible Docker Image as follows: Oracle Functions compatible Docker Image as follows:
```bash ```bash
fn lambda create-function <name> <runtime> <handler> <files...> fn lambda create-function <name> <runtime> <handler> <files...>
``` ```
@@ -16,7 +18,8 @@ fn lambda create-function <name> <runtime> <handler> <files...>
* file: the files to be converted, however for java8 only one file of type `jar` is allowed. * file: the files to be converted, however for java8 only one file of type `jar` is allowed.
e.g: e.g:
```bash ```bash
fn lambda create-function irontest/node-exec:1 nodejs node_exec.handler node_exec.js fn lambda create-function test/node-exec:1 nodejs node_exec.handler node_exec.js
``` ```

View File

@@ -6,7 +6,7 @@ Lambda and Dockerized Lambda.
## Request/Response ## Request/Response
IronFunctions has sync/async communication with Request/Response workflows. Functions has sync/async communication with Request/Response workflows.
* sync: returns the result as the body of the response * sync: returns the result as the body of the response
* async: returns the task id in the body of the response as a json * async: returns the task id in the body of the response as a json
@@ -21,11 +21,11 @@ such assumptions, please rewrite it.
## nodejs ## nodejs
* node.js version [0.10.42][iron/node] * node.js version [0.10.42][funcy/node]
* ImageMagick version [6.9.3][magickv] and nodejs [wrapper 6.9.3][magickwrapperv] * ImageMagick version [6.9.3][magickv] and nodejs [wrapper 6.9.3][magickwrapperv]
* aws-sdk version [2.2.12][awsnodev] * aws-sdk version [2.2.12][awsnodev]
[iron/node]: https://github.com/treeder/dockers/blob/master/node/Dockerfile [funcy/node]: https://github.com/treeder/dockers/blob/master/node/Dockerfile
[magickv]: https://pkgs.alpinelinux.org/package/main/x86_64/imagemagick [magickv]: https://pkgs.alpinelinux.org/package/main/x86_64/imagemagick
[magickwrapperv]: https://www.npmjs.com/package/imagemagick [magickwrapperv]: https://www.npmjs.com/package/imagemagick
[awsnodev]: https://aws.amazon.com/sdk-for-node-js/ [awsnodev]: https://aws.amazon.com/sdk-for-node-js/
@@ -38,12 +38,12 @@ Payloads MUST be a valid JSON object literal.
* context.fail() does not currently truncate error logs. * context.fail() does not currently truncate error logs.
* `context.functionName` is of the form of a docker image, for example * `context.functionName` is of the form of a docker image, for example
`iron/test-function`. `username/test-function`.
* `context.functionVersion` is always the string `"$LATEST"`. * `context.functionVersion` is always the string `"$LATEST"`.
* `context.invokedFunctionArn` is not supported. Value is empty string. * `context.invokedFunctionArn` is not supported. Value is empty string.
* `context.memoryLimitInMB` does not reflect reality. Value is always `256`. * `context.memoryLimitInMB` does not reflect reality. Value is always `256`.
* `context.awsRequestId` reflects the environment variable `TASK_ID`. On local * `context.awsRequestId` reflects the environment variable `TASK_ID`. On local
runs from `ironcli` this is a UUID. On IronFunctions this is the task ID. runs from `fn` tool this is a UUID. On Functions server this is the task ID.
* `logGroupName` and `logStreamName` are empty strings. * `logGroupName` and `logStreamName` are empty strings.
* `identity` and `clientContext` are always `null`. * `identity` and `clientContext` are always `null`.
@@ -57,7 +57,7 @@ If your handler throws an exception, we only log the error message. There is no
* CPython [2.7.11][pythonv] * CPython [2.7.11][pythonv]
* boto3 (Python AWS SDK) [1.2.3][botov]. * boto3 (Python AWS SDK) [1.2.3][botov].
[pythonv]: https://hub.docker.com/r/iron/python/tags/ [pythonv]: https://hub.docker.com/r/funcy/python/tags/
[botov]: https://github.com/boto/boto3/releases/tag/1.2.3 [botov]: https://github.com/boto/boto3/releases/tag/1.2.3
### Event ### Event
@@ -68,11 +68,11 @@ literal.
### Context object ### Context object
* `context.functionName` is of the form of a docker image, for example * `context.functionName` is of the form of a docker image, for example
`iron/test-function`. `username/test-function`.
* `context.functionVersion` is always the string `"$LATEST"`. * `context.functionVersion` is always the string `"$LATEST"`.
* `context.invokedFunctionArn` is `None`. * `context.invokedFunctionArn` is `None`.
* `context.awsRequestId` reflects the environment variable `TASK_ID` which is * `context.awsRequestId` reflects the environment variable `TASK_ID` which is
set to the task ID on IronFunctions. If TASK_ID is empty, a new UUID is used. set to the task ID on Functions. If TASK_ID is empty, a new UUID is used.
* `logGroupName`, `logStreamName`, `identity` and `clientContext` are `None`. * `logGroupName`, `logStreamName`, `identity` and `clientContext` are `None`.
### Exceptions ### Exceptions
@@ -84,7 +84,7 @@ a JSON object with trace information.
* OpenJDK Java Runtime [1.8.0][javav] * OpenJDK Java Runtime [1.8.0][javav]
[javav]: https://hub.docker.com/r/iron/java/tags/ [javav]: https://hub.docker.com/r/funcy/java/tags/
The Java8 runtime is significantly lacking at this piont and we **do not The Java8 runtime is significantly lacking at this piont and we **do not
recommend** using it. recommend** using it.
@@ -163,8 +163,8 @@ to CloudWatch are not supported.
### Context object ### Context object
* `context.getFunctionName()` returns a String of the form of a docker image, * `context.getFunctionName()` returns a String of the form of a docker image,
for example `iron/test-function`. for example `username/test-function`.
* `context.getFunctionVersion()` is always the string `"$LATEST"`. * `context.getFunctionVersion()` is always the string `"$LATEST"`.
* `context.getAwsRequestId()` reflects the environment variable `TASK_ID` which is * `context.getAwsRequestId()` reflects the environment variable `TASK_ID` which is
set to the task ID on IronFunctions. If TASK_ID is empty, a new UUID is used. set to the task ID on Functions. If TASK_ID is empty, a new UUID is used.
* `getInvokedFunctionArn()`, `getLogGroupName()`, `getLogStreamName()`, `getIdentity()`, `getClientContext()`, `getLogger()` return `null`. * `getInvokedFunctionArn()`, `getLogGroupName()`, `getLogStreamName()`, `getIdentity()`, `getClientContext()`, `getLogger()` return `null`.

View File

@@ -1,128 +0,0 @@
# Introduction
This guide will walk you through creating and testing a simple Lambda function.
We need the the `fn` tool for the rest of this guide. You can install it
by following [these instructions](https://github.com/treeder/function/fn).
*For this getting started we are assuming you already have working lambda function code available, if not head to the [import instructions] (import.md) and skip the next section.*
## Creating the function
Let's convert the `hello_world` AWS Lambda example to Docker.
```python
def my_handler(event, context):
message = 'Hello {} {}!'.format(event['first_name'],
event['last_name'])
return {
'message' : message
}
```
Create an empty directory for your project and save this code in a file called
`hello_world.py`.
Now let's use `fn`'s Lambda functionality to create a Docker image. We can
then run the Docker image with a payload to execute the Lambda function.
```sh
$ fn lambda create-function irontest/hello_world:1 python2.7 hello_world.my_handler hello_world.py
Creating directory: irontest/hello_world:1 ... OK
Creating Dockerfile: irontest/hello_world:1/Dockerfile ... OK
Copying file: irontest/hello_world/hello_world:1.py ... OK
Creating function.yaml ... OK
```
As you can see, this is very similar to creating a Lambda function using the
`aws` CLI tool. We name the function as we would name other Docker images. The
`1` indicates the version. You can use any string. This way you can configure
your deployment environment to use different versions. The handler is
the name of the function to run, in the form that python expects
(`module.function`). Where you would package the files into a `.zip` to upload
to Lambda, we just pass the list of files to `fn`.
## Deploying the function to IronFunctions
Next we want to deploy the function to our IronFunctions
```sh
$ fn deploy -v -d ./irontest irontest
deploying irontest/hello_world:1/function.yaml
Sending build context to Docker daemon 4.096 kB
Step 1 : FROM iron/lambda-python2.7
latest: Pulling from iron/lambda-python2.7
c52e3ed763ff: Pull complete
789cf808491a: Pull complete
d1b635efed57: Pull complete
fe23c3dbcfa8: Pull complete
63c874a9687e: Pull complete
a6d462dae1df: Pull complete
Digest: sha256:c5dde3bf3be776c0f6b909d4ad87255a0af9b6696831fbe17c5f659655a0494a
Status: Downloaded newer image for iron/lambda-python2.7:latest
---> 66d3adf47835
Step 2 : ADD hello_world.py ./hello_world:1.py
---> 91a592e0dfa9
Removing intermediate container 1a1ef40ff0dd
Step 3 : CMD hello_world.my_handler
---> Running in 318da1bba060
---> db9b9644168e
Removing intermediate container 318da1bba060
Successfully built db9b9644168e
The push refers to a repository [docker.io/irontest/hello_world:1]
5d9d142e21b2: Pushed
11d8145d6038: Layer already exists
23885f85dbd0: Layer already exists
6a350a8d14ee: Layer already exists
e67f7ef625c5: Layer already exists
321db514ef85: Layer already exists
6102f0d2ad33: Layer already exists
latest: digest: sha256:5926ff413f134fa353e4b42f2d4a0d2d4f5b3a39489cfdf6dd5b4a63c4e40dee size: 1784
updating API with appName: irontest route: /hello_world:1 image: irontest/hello_world:1
path result
irontest/hello_world:1/function.yaml done
```
This will deploy the generated function under the app `irontest` with `hello_world` as a route, e.g:
`http://<hostname>/r/irontest/hello_world:1`,
You should also now see the generated Docker image.
```sh
$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
irontest/hello_world:1 latest db9b9644168e About a minute ago 108.4 MB
...
```
## Testing the function
The `test-function` subcommand can launch the Dockerized function with the
right parameters.
```sh
$ fn lambda test-function irontest/hello_world:1 --payload '{ "first_name": "Jon", "last_name": "Snow" }'
{"message": "Hello Jon Snow!"}
```
You should see the output.
## Calling the function from IronFunctions
The `fn call` command can call the deployed version with a given payload.
```sh
$ echo '{ "first_name": "Jon", "last_name": "Snow" }' | ./fn call irontest /hello_world:1
{"message": "Hello Jon Snow!"}
```
You should see the output.
## Commands documentation
* [create-function](create.md)
* [test-function](test.md)
* [aws-import](import.md)
## More documentation
* [env](environment.md)
* [aws](aws.md)

View File

@@ -38,7 +38,7 @@ fn lambda aws-import arn:aws:lambda:us-west-2:123141564251:function:my-function
will import the function code from the region `us-east-1` to a directory called `./user/my-function`. Inside the directory you will find the `function.yml`, `Dockerfile`, and all the files needed for running the function. will import the function code from the region `us-east-1` to a directory called `./user/my-function`. Inside the directory you will find the `function.yml`, `Dockerfile`, and all the files needed for running the function.
Using Lambda with Docker Hub and IronFunctions requires that the Docker image be Using Lambda with Docker Hub and Oracle Functions requires that the Docker image be
named `<Docker Hub username>/<image name>`. This is used to uniquely identify named `<Docker Hub username>/<image name>`. This is used to uniquely identify
images on Docker Hub. Please use the `<Docker Hub username>/<image images on Docker Hub. Please use the `<Docker Hub username>/<image
name>` as the image name with `aws-import` to create a correctly named image. name>` as the image name with `aws-import` to create a correctly named image.
@@ -50,6 +50,6 @@ by passing `--version <version>.`
You can then deploy the imported lambda as follows: You can then deploy the imported lambda as follows:
``` ```
./fn deploy -d ./user/my-function user ./fn deploy myapp
```` ````
Now the function can be reached via ```http://$HOSTNAME/r/user/my-function``` Now the function can be reached via ```http://$HOSTNAME/r/user/my-function```

View File

@@ -20,7 +20,7 @@ the directory on your host. eg: `docker run -v $PWD/data:/functions/data -e DB_U
URL: `postgres://user123:pass456@ec2-117-21-174-214.compute-1.amazonaws.com:6212/db982398` URL: `postgres://user123:pass456@ec2-117-21-174-214.compute-1.amazonaws.com:6212/db982398`
Use a PostgreSQL database. If you're using IronFunctions in production, you should probably start here. Use a PostgreSQL database. If you're using Functions in production, you should probably start here.
[More on PostgreSQL](postgres.md) [More on PostgreSQL](postgres.md)

View File

@@ -1,4 +1,4 @@
# IronFunctions using BoltDB # Oracle Functions using BoltDB
BoltDB is the default database, you just need to run the API. BoltDB is the default database, you just need to run the API.
@@ -7,5 +7,5 @@ BoltDB is the default database, you just need to run the API.
To keep it persistent, add a volume flag to the command: To keep it persistent, add a volume flag to the command:
``` ```
docker run --rm -it --privileged -v $PWD/bolt.db:/app/bolt.db -p 8080:8080 iron/functions docker run --rm -it --privileged -v $PWD/bolt.db:/app/bolt.db -p 8080:8080 treeder/functions
``` ```

View File

@@ -1,20 +1,20 @@
# IronFunctions using Postgres # Oracle Functions using Postgres
Let's presuppose you don't have even a MySQL DB ready. Let's presuppose you don't have even a MySQL DB ready.
### 1. Let's start a MySQL instance: ### 1. Let's start a MySQL instance:
``` ```
docker run --name iron-mysql \ docker run --name func-mysql \
-e MYSQL_DATABASE=funcs -e MYSQL_USER=iron -e MYSQL_PASSWORD=ironfunctions -d mysql -e MYSQL_DATABASE=funcs -e MYSQL_USER=funcy -e MYSQL_PASSWORD=funcypass -d mysql
``` ```
For more configuration options, see [docker mysql docs](https://hub.docker.com/_/mysql/). For more configuration options, see [docker mysql docs](https://hub.docker.com/_/mysql/).
### 2. Now let's start IronFunctions connecting to our new mysql instance ### 2. Now let's start Functions connecting to our new mysql instance
``` ```
docker run --rm --privileged --link "iron-mysql:mysql" \ docker run --rm --privileged --link "iron-mysql:mysql" \
-e "DB_URL=mysql://iron:ironfunctions@tcp(mysql:3306)/funcs" \ -e "DB_URL=mysql://funcy:funcypass@tcp(mysql:3306)/funcs" \
-it -p 8080:8080 iron/functions -it -p 8080:8080 treeder/functions
``` ```

View File

@@ -1,34 +1,34 @@
# IronFunctions using Postgres # Oracle Functions using Postgres
Let's presuppose you don't have even a postgres DB ready. Let's presuppose you don't have even a postgres DB ready.
### 1. Let's start a postgres instance: ### 1. Let's start a postgres instance:
``` ```
docker run --name iron-postgres \ docker run --name funcy-postgres \
-e POSTGRES_PASSWORD=ironfunctions -d postgres -e POSTGRES_PASSWORD=funcypass -d postgres
``` ```
### 2. Now let's create a new database to IronFunctions ### 2. Now let's create a new database for Functions
Creating database: Creating database:
``` ```
docker run -it --rm --link iron-postgres:postgres postgres \ docker run -it --rm --link funcy-postgres:postgres postgres \
psql -h postgres -U postgres -c "CREATE DATABASE funcs;" psql -h postgres -U postgres -c "CREATE DATABASE funcs;"
``` ```
Granting access to postgres user Granting access to postgres user
``` ```
docker run -it --rm --link iron-postgres:postgres postgres \ docker run -it --rm --link funcy-postgres:postgres postgres \
psql -h postgres -U postgres -c 'GRANT ALL PRIVILEGES ON DATABASE funcs TO postgres;' psql -h postgres -U postgres -c 'GRANT ALL PRIVILEGES ON DATABASE funcs TO postgres;'
``` ```
### 3. Now let's start IronFunctions connecting to our new postgres instance ### 3. Now let's start Functions connecting to our new postgres instance
``` ```
docker run --rm --privileged --link "iron-postgres:postgres" \ docker run --rm --privileged --link "iron-postgres:postgres" \
-e "DB_URL=postgres://postgres:ironfunctions@postgres/funcs?sslmode=disable" \ -e "DB_URL=postgres://postgres:funcypass@postgres/funcs?sslmode=disable" \
-it -p 8080:8080 iron/functions -it -p 8080:8080 treeder/functions
``` ```

View File

@@ -1,6 +1,6 @@
# Docker Swarm and IronFunctions # Docker Swarm and Oracle Functions
How to run IronFunction as a scheduler on top of Docker Standalone Swarm cluster. How to run Oracle Functions as a scheduler on top of Docker Standalone Swarm cluster.
## Quick installation ## Quick installation
@@ -8,11 +8,11 @@ How to run IronFunction as a scheduler on top of Docker Standalone Swarm cluster
*Prerequisite 2: It assumes that your running environment is already configured to use Swarm's master scheduler.* *Prerequisite 2: It assumes that your running environment is already configured to use Swarm's master scheduler.*
This is a step-by-step procedure to execute IronFunction on top of Docker Swarm cluster. It works by having IronFunction daemon started through Swarm's master, and there enqueueing tasks through Swarm API. This is a step-by-step procedure to execute Oracle Functions on top of Docker Swarm cluster. It works by having Oracle Functions daemon started through Swarm's master, and there enqueueing tasks through Swarm API.
### Steps ### Steps
1. Start IronFunction in the Swarm Master. It expects all basic Docker environment variables to be present (DOCKER_TLS_VERIFY, DOCKER_HOST, DOCKER_CERT_PATH, DOCKER_MACHINE_NAME). The important part is that the working Swarm master environment must be passed to Functions daemon: 1. Start Oracle Functions in the Swarm Master. It expects all basic Docker environment variables to be present (DOCKER_TLS_VERIFY, DOCKER_HOST, DOCKER_CERT_PATH, DOCKER_MACHINE_NAME). The important part is that the working Swarm master environment must be passed to Functions daemon:
```ShellSession ```ShellSession
$ docker login # if you plan to use private images $ docker login # if you plan to use private images
$ docker volume create --name functions-datafiles $ docker volume create --name functions-datafiles
@@ -24,7 +24,7 @@ $ docker run -d --name functions \
-e DOCKER_MACHINE_NAME \ -e DOCKER_MACHINE_NAME \
-v $DOCKER_CERT_PATH:/docker-cert \ -v $DOCKER_CERT_PATH:/docker-cert \
-v functions-datafiles:/app/data \ -v functions-datafiles:/app/data \
iron/functions treeder/functions
``` ```
2. Once the daemon is started, check where it is listening for connections: 2. Once the daemon is started, check where it is listening for connections:
@@ -32,23 +32,23 @@ $ docker run -d --name functions \
```ShellSession ```ShellSession
# docker info # docker info
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5a0846e6a025 iron/functions "/usr/local/bin/entry" 59 seconds ago Up 58 seconds 2375/tcp, 10.0.0.1:8080->8080/tcp swarm-agent-00/functions 5a0846e6a025 treeder/functions "/usr/local/bin/entry" 59 seconds ago Up 58 seconds 2375/tcp, 10.0.0.1:8080->8080/tcp swarm-agent-00/functions
```` ````
Note `10.0.0.1:8080` in `PORTS` column, this is where the service is listening. IronFunction will use Docker Swarm scheduler to deliver tasks to all nodes present in the cluster. Note `10.0.0.1:8080` in `PORTS` column, this is where the service is listening. Oracle Functions will use Docker Swarm scheduler to deliver tasks to all nodes present in the cluster.
3. Test the cluster: 3. Test the cluster:
```ShellSession ```ShellSession
$ export IRON_FUNCTION=$(docker port functions | cut -d ' ' -f3) $ export FUNCTIONS=$(docker port functions | cut -d ' ' -f3)
$ curl -H "Content-Type: application/json" -X POST -d '{ "app": { "name":"myapp" } }' http://$IRON_FUNCTION/v1/apps $ curl -H "Content-Type: application/json" -X POST -d '{ "app": { "name":"myapp" } }' http://$FUNCTIONS/v1/apps
{"message":"App successfully created","app":{"name":"myapp","config":null}} {"message":"App successfully created","app":{"name":"myapp","config":null}}
$ curl -H "Content-Type: application/json" -X POST -d '{ "route": { "type": "sync", "path":"/hello-sync", "image":"iron/hello" } }' http://$IRON_FUNCTION/v1/apps/myapp/routes $ curl -H "Content-Type: application/json" -X POST -d '{ "route": { "type": "sync", "path":"/hello-sync", "image":"treeder/hello" } }' http://$FUNCTIONS/v1/apps/myapp/routes
{"message":"Route successfully created","route":{"app_name":"myapp","path":"/hello-sync","image":"iron/hello","memory":128,"type":"sync","config":null}} {"message":"Route successfully created","route":{"app_name":"myapp","path":"/hello-sync","image":"treeder/hello","memory":128,"type":"sync","config":null}}
$ curl -H "Content-Type: application/json" -X POST -d '{ "name":"Johnny" }' http://$IRON_FUNCTION/r/myapp/hello-sync $ curl -H "Content-Type: application/json" -X POST -d '{ "name":"Johnny" }' http://$FUNCTIONS/r/myapp/hello-sync
Hello Johnny! Hello Johnny!
``` ```
@@ -58,7 +58,7 @@ Hello Johnny!
*Prerequisite 2: It assumes that your running environment is already configured to use Swarm's master scheduler.* *Prerequisite 2: It assumes that your running environment is already configured to use Swarm's master scheduler.*
This is a step-by-step procedure to execute IronFunction on top of Docker Swarm cluster. It works by having IronFunction daemon started through Swarm's master, however the tasks are executed on each host locally. In production, database and message queue must be external to IronFunction execution, this guarantees robustness of the service against failures. This is a step-by-step procedure to execute Oracle Functions on top of Docker Swarm cluster. It works by having Oracle Functions daemon started through Swarm's master, however the tasks are executed on each host locally. In production, database and message queue must be external to Oracle Functions execution, this guarantees robustness of the service against failures.
We strongly recommend you deploy your own HA Redis and PostgreSQL clusters. Otherwise, you can follow the instructions below and have them set in single nodes. We strongly recommend you deploy your own HA Redis and PostgreSQL clusters. Otherwise, you can follow the instructions below and have them set in single nodes.
@@ -74,7 +74,7 @@ docker-machine create -d virtualbox --swarm --swarm-master --swarm-discovery etc
# Set aside one host for DB activities # Set aside one host for DB activities
docker-machine create -d virtualbox --engine-label use=db --swarm --swarm-discovery etcd://$ETCD_HOST:2379/swarm --engine-opt="cluster-store=etcd://$ETCD_HOST:2379/network" --engine-opt="cluster-advertise=eth1:2376" swarm-db; docker-machine create -d virtualbox --engine-label use=db --swarm --swarm-discovery etcd://$ETCD_HOST:2379/swarm --engine-opt="cluster-store=etcd://$ETCD_HOST:2379/network" --engine-opt="cluster-advertise=eth1:2376" swarm-db;
# The rest is a horizontally scalable set of hosts for IronFunction # The rest is a horizontally scalable set of hosts for Oracle Functions
docker-machine create -d virtualbox --engine-label use=worker --swarm --swarm-discovery etcd://$ETCD_HOST:2379/swarm --engine-opt="cluster-store=etcd://$ETCD_HOST:2379/network" --engine-opt="cluster-advertise=eth1:2376" swarm-worker-00; docker-machine create -d virtualbox --engine-label use=worker --swarm --swarm-discovery etcd://$ETCD_HOST:2379/swarm --engine-opt="cluster-store=etcd://$ETCD_HOST:2379/network" --engine-opt="cluster-advertise=eth1:2376" swarm-worker-00;
docker-machine create -d virtualbox --engine-label use=worker --swarm --swarm-discovery etcd://$ETCD_HOST:2379/swarm --engine-opt="cluster-store=etcd://$ETCD_HOST:2379/network" --engine-opt="cluster-advertise=eth1:2376" swarm-worker-01 docker-machine create -d virtualbox --engine-label use=worker --swarm --swarm-discovery etcd://$ETCD_HOST:2379/swarm --engine-opt="cluster-store=etcd://$ETCD_HOST:2379/network" --engine-opt="cluster-advertise=eth1:2376" swarm-worker-01
``` ```
@@ -83,7 +83,7 @@ docker-machine create -d virtualbox --engine-label use=worker --swarm --swarm-di
If you using externally deployed Redis and PostgreSQL cluster, you may skip to step 4. If you using externally deployed Redis and PostgreSQL cluster, you may skip to step 4.
1. Build a multi-host network for IronFunction: 1. Build a multi-host network for Oracle Functions:
```ShellSession ```ShellSession
$ docker network create --driver overlay --subnet=10.0.9.0/24 functions-network $ docker network create --driver overlay --subnet=10.0.9.0/24 functions-network
```` ````
@@ -100,7 +100,7 @@ $ docker create -e constraint:use==db --network=functions-network -v /var/lib/po
$ docker run -d -e constraint:use==db --network=functions-network --volumes-from postgresql-data --name functions-postgres -e POSTGRES_PASSWORD=mysecretpassword postgres $ docker run -d -e constraint:use==db --network=functions-network --volumes-from postgresql-data --name functions-postgres -e POSTGRES_PASSWORD=mysecretpassword postgres
``` ```
4. Start IronFunctions: 4. Start Oracle Functions:
```ShellSession ```ShellSession
$ docker run -d --name functions-00 \ $ docker run -d --name functions-00 \
-l functions \ -l functions \
@@ -110,7 +110,7 @@ $ docker run -d --name functions-00 \
-v /var/run/docker.sock:/var/run/docker.sock \ -v /var/run/docker.sock:/var/run/docker.sock \
-e 'MQ_URL=redis://functions-redis' \ -e 'MQ_URL=redis://functions-redis' \
-e 'DB_URL=postgres://postgres:mysecretpassword@functions-postgres/?sslmode=disable' \ -e 'DB_URL=postgres://postgres:mysecretpassword@functions-postgres/?sslmode=disable' \
iron/functions treeder/functions
``` ```
5. Load Balancer: 5. Load Balancer:
@@ -120,14 +120,14 @@ $ export BACKENDS=$(docker ps --filter label=functions --format="{{ .ID }}" | xa
$ docker run -d --name functions-lb -p 80:80 -e BACKENDS noqcks/haproxy $ docker run -d --name functions-lb -p 80:80 -e BACKENDS noqcks/haproxy
$ export IRON_FUNCTION=$(docker port functions-lb | cut -d ' ' -f3) $ export FUNCTIONS=$(docker port functions-lb | cut -d ' ' -f3)
$ curl -H "Content-Type: application/json" -X POST -d '{ "app": { "name":"myapp" } }' http://$IRON_FUNCTION/v1/apps $ curl -H "Content-Type: application/json" -X POST -d '{ "app": { "name":"myapp" } }' http://$FUNCTIONS/v1/apps
{"message":"App successfully created","app":{"name":"myapp","config":null}} {"message":"App successfully created","app":{"name":"myapp","config":null}}
$ curl -H "Content-Type: application/json" -X POST -d '{ "route": { "type": "sync", "path":"/hello-sync", "image":"iron/hello" } }' http://$IRON_FUNCTION/v1/apps/myapp/routes $ curl -H "Content-Type: application/json" -X POST -d '{ "route": { "type": "sync", "path":"/hello-sync", "image":"treeder/hello" } }' http://$FUNCTIONS/v1/apps/myapp/routes
{"message":"Route successfully created","route":{"app_name":"myapp","path":"/hello-sync","image":"iron/hello","memory":128,"type":"sync","config":null}} {"message":"Route successfully created","route":{"app_name":"myapp","path":"/hello-sync","image":"treeder/hello","memory":128,"type":"sync","config":null}}
$ curl -H "Content-Type: application/json" -X POST -d '{ "name":"Johnny" }' http://$IRON_FUNCTION/r/myapp/hello-sync $ curl -H "Content-Type: application/json" -X POST -d '{ "name":"Johnny" }' http://$FUNCTIONS/r/myapp/hello-sync
Hello Johnny! Hello Johnny!
``` ```

View File

@@ -1,16 +1,16 @@
# Extending IronFunctions # Extending Oracle Functions
IronFunctions is extensible so you can add custom functionality and extend the project without needing to modify the core. Oracle Functions is extensible so you can add custom functionality and extend the project without needing to modify the core.
There are multiple ways to extend the functionality of IronFunctions. There are multiple ways to extend the functionality of Oracle Functions.
1. Listeners - listen to API events such as a route getting updated and react accordingly. 1. Listeners - listen to API events such as a route getting updated and react accordingly.
1. Middleware - a chain of middleware is executed before an API handler is called. 1. Middleware - a chain of middleware is executed before an API handler is called.
1. Add API Endpoints - extend the default IronFunctions API. 1. Add API Endpoints - extend the default Oracle Functions API.
## Listeners ## Listeners
Listeners are the main way to extend IronFunctions. Listeners are the main way to extend Oracle Functions.
The following listener types are supported: The following listener types are supported:
@@ -19,7 +19,7 @@ The following listener types are supported:
### Creating a Listener ### Creating a Listener
You can easily use app and runner listeners by creating a struct with valid methods satisfying the interface for the respective listener and adding it to the IronFunctions API You can easily use app and runner listeners by creating a struct with valid methods satisfying the interface for the respective listener and adding it to the Oracle Functions API
Example: Example:
@@ -67,6 +67,6 @@ See examples of this in [examples/middleware/main.go](../../examples/middleware/
## Adding API Endpoints ## Adding API Endpoints
You can add API endpoints to the IronFunctions server by using the `AddEndpoint` and `AddEndpointFunc` methods. You can add API endpoints to the Oracle Functions server by using the `AddEndpoint` and `AddEndpointFunc` methods.
See examples of this in [examples/extensions/main.go](../../examples/extensions/main.go). See examples of this in [examples/extensions/main.go](../../examples/extensions/main.go).

View File

@@ -1,4 +1,4 @@
# HOWTO run IronFunction in Kubernetes at AWS # HOWTO run Oracle Functions in Kubernetes at AWS
*Prerequisite 1: it assumes you have a working Kubernetes, and a locally configured kubectl.* *Prerequisite 1: it assumes you have a working Kubernetes, and a locally configured kubectl.*
@@ -9,7 +9,7 @@
### Steps ### Steps
1. Start IronFunction in the Kubernetes cluster: 1. Start Oracle Functions in the Kubernetes cluster:
```ShellSession ```ShellSession
$ cd docs/ $ cd docs/
$ kubectl create -f kubernetes-quick $ kubectl create -f kubernetes-quick
@@ -44,15 +44,15 @@ Note `a23122e39900111e681ba0e29b70bb46-630391493.us-east-1.elb.amazonaws.com` in
3. Test the cluster: 3. Test the cluster:
```ShellSession ```ShellSession
$ export IRON_FUNCTION=$(kubectl get -o json svc functions | jq -r '.status.loadBalancer.ingress[0].hostname'):8080 $ export FUNCTIONS=$(kubectl get -o json svc functions | jq -r '.status.loadBalancer.ingress[0].hostname'):8080
$ curl -H "Content-Type: application/json" -X POST -d '{ "app": { "name":"myapp" } }' http://$IRON_FUNCTION/v1/apps $ curl -H "Content-Type: application/json" -X POST -d '{ "app": { "name":"myapp" } }' http://$FUNCTIONS/v1/apps
{"message":"App successfully created","app":{"name":"myapp","config":null}} {"message":"App successfully created","app":{"name":"myapp","config":null}}
$ curl -H "Content-Type: application/json" -X POST -d '{ "route": { "type": "sync", "path":"/hello-sync", "image":"iron/hello" } }' http://$IRON_FUNCTION/v1/apps/myapp/routes $ curl -H "Content-Type: application/json" -X POST -d '{ "route": { "type": "sync", "path":"/hello-sync", "image":"treeder/hello" } }' http://$FUNCTIONS/v1/apps/myapp/routes
{"message":"Route successfully created","route":{"app_name":"myapp","path":"/hello-sync","image":"iron/hello","memory":128,"type":"sync","config":null}} {"message":"Route successfully created","route":{"app_name":"myapp","path":"/hello-sync","image":"treeder/hello","memory":128,"type":"sync","config":null}}
$ curl -H "Content-Type: application/json" -X POST -d '{ "name":"Johnny" }' http://$IRON_FUNCTION/r/myapp/hello-sync $ curl -H "Content-Type: application/json" -X POST -d '{ "name":"Johnny" }' http://$FUNCTIONS/r/myapp/hello-sync
Hello Johnny! Hello Johnny!
``` ```
@@ -60,7 +60,7 @@ Hello Johnny!
### Steps ### Steps
1. Start IronFunction and its dependencies: 1. Start Oracle Functions and its dependencies:
```ShellSession ```ShellSession
$ cd docs/ $ cd docs/
$ kubectl create -f kubernetes-production $ kubectl create -f kubernetes-production
@@ -97,14 +97,14 @@ Note `a23122e39900111e681ba0e29b70bb46-630391493.us-east-1.elb.amazonaws.com` in
3. Test the cluster: 3. Test the cluster:
```ShellSession ```ShellSession
$ export IRON_FUNCTION=$(kubectl get -o json svc functions | jq -r '.status.loadBalancer.ingress[0].hostname'):8080 $ export FUNCTIONS=$(kubectl get -o json svc functions | jq -r '.status.loadBalancer.ingress[0].hostname'):8080
$ curl -H "Content-Type: application/json" -X POST -d '{ "app": { "name":"myapp" } }' http://$IRON_FUNCTION/v1/apps $ curl -H "Content-Type: application/json" -X POST -d '{ "app": { "name":"myapp" } }' http://$FUNCTIONS/v1/apps
{"message":"App successfully created","app":{"name":"myapp","config":null}} {"message":"App successfully created","app":{"name":"myapp","config":null}}
$ curl -H "Content-Type: application/json" -X POST -d '{ "route": { "type": "sync", "path":"/hello-sync", "image":"iron/hello" } }' http://$IRON_FUNCTION/v1/apps/myapp/routes $ curl -H "Content-Type: application/json" -X POST -d '{ "route": { "type": "sync", "path":"/hello-sync", "image":"treeder/hello" } }' http://$FUNCTIONS/v1/apps/myapp/routes
{"message":"Route successfully created","route":{"app_name":"myapp","path":"/hello-sync","image":"iron/hello","memory":128,"type":"sync","config":null}} {"message":"Route successfully created","route":{"app_name":"myapp","path":"/hello-sync","image":"treeder/hello","memory":128,"type":"sync","config":null}}
$ curl -H "Content-Type: application/json" -X POST -d '{ "name":"Johnny" }' http://$IRON_FUNCTION/r/myapp/hello-sync $ curl -H "Content-Type: application/json" -X POST -d '{ "name":"Johnny" }' http://$FUNCTIONS/r/myapp/hello-sync
Hello Johnny! Hello Johnny!
``` ```

View File

@@ -14,7 +14,7 @@ spec:
spec: spec:
containers: containers:
- name: functions - name: functions
image: iron/functions image: treeder/functions
securityContext: securityContext:
privileged: true privileged: true
env: env:

View File

@@ -14,7 +14,7 @@ spec:
spec: spec:
containers: containers:
- name: functions - name: functions
image: iron/functions image: treeder/functions
securityContext: securityContext:
privileged: true privileged: true
env: env:

View File

@@ -1,6 +1,6 @@
# Logging # Logging
There are a few things to note about what IronFunctions logs. There are a few things to note about what Oracle Functions logs.
## Logspout ## Logspout

View File

@@ -1,6 +1,6 @@
# Message Queues # Message Queues
A message queue is used to coordinate asynchronous function calls that run through IronFunctions. A message queue is used to coordinate asynchronous function calls that run through Oracle Functions.
We currently support the following message queues and they are passed in via the `MQ_URL` environment variable. For example: We currently support the following message queues and they are passed in via the `MQ_URL` environment variable. For example:
@@ -23,7 +23,7 @@ See Redis in databases above.
URL: `ironmq://project_id:token@mq-aws-us-east-1.iron.io/queue_prefix` URL: `ironmq://project_id:token@mq-aws-us-east-1.iron.io/queue_prefix`
IronMQ is a hosted message queue service provided by [Iron.io](http://iron.io). If you're using IronFunctions in production and don't IronMQ is a hosted message queue service provided by [Iron.io](http://iron.io). If you're using Oracle Functions in production and don't
want to manage a message queue, you should start here. want to manage a message queue, you should start here.
The IronMQ connector uses HTTPS by default. To use HTTP set the scheme to The IronMQ connector uses HTTPS by default. To use HTTP set the scheme to

View File

@@ -1,8 +1,8 @@
# IronFunctions Runtime Options # Oracle Functions Runtime Options
## Configuration ## Configuration
When starting IronFunctions, you can pass in the following configuration variables as environment variables. Use `-e VAR_NAME=VALUE` in When starting Oracle Functions, you can pass in the following configuration variables as environment variables. Use `-e VAR_NAME=VALUE` in
docker run. For example: docker run. For example:
```sh ```sh
@@ -13,7 +13,7 @@ docker run -e VAR_NAME=VALUE ...
| --------------|-------------|----------------| | --------------|-------------|----------------|
| DB_URL | The database URL to use in URL format. See [Databases](databases/README.md) for more information. | bolt:///app/data/bolt.db | | DB_URL | The database URL to use in URL format. See [Databases](databases/README.md) for more information. | bolt:///app/data/bolt.db |
| MQ_URL | The message queue to use in URL format. See [Message Queues](mqs/README.md) for more information. | bolt:///app/data/worker_mq.db | | MQ_URL | The message queue to use in URL format. See [Message Queues](mqs/README.md) for more information. | bolt:///app/data/worker_mq.db |
| API_URL | The primary IronFunctions API URL to that this instance will talk to. In a production environment, this would be your load balancer URL. | N/A | | API_URL | The primary Oracle Functions API URL to that this instance will talk to. In a production environment, this would be your load balancer URL. | N/A |
| PORT | Sets the port to run on | 8080 | | PORT | Sets the port to run on | 8080 |
| LOG_LEVEL | Set to DEBUG to enable debugging | INFO | | LOG_LEVEL | Set to DEBUG to enable debugging | INFO |
| DOCKER_HOST | Docker remote API URL | /var/run/docker.sock:/var/run/docker.sock | | DOCKER_HOST | Docker remote API URL | /var/run/docker.sock:/var/run/docker.sock |
@@ -23,12 +23,12 @@ docker run -e VAR_NAME=VALUE ...
## Starting without Docker in Docker ## Starting without Docker in Docker
The default way to run IronFunctions, as it is in the Quickstart guide, is to use docker-in-docker (dind). There are The default way to run Oracle Functions, as it is in the Quickstart guide, is to use docker-in-docker (dind). There are
a couple reasons why we did it this way: a couple reasons why we did it this way:
* It's clean. Once the container exits, there is nothing left behind including all the function images. * It's clean. Once the container exits, there is nothing left behind including all the function images.
* You can set resource restrictions for the entire IronFunctions instance. For instance, you can set `--memory` on * You can set resource restrictions for the entire Oracle Functions instance. For instance, you can set `--memory` on
the docker run command to set the max memory for the IronFunctions instance AND all of the functions it's running. the docker run command to set the max memory for the Oracle Functions instance AND all of the functions it's running.
There are some reasons you may not want to use dind, such as using the image cache during testing or you're running There are some reasons you may not want to use dind, such as using the image cache during testing or you're running
[Windows](windows.md). [Windows](windows.md).
@@ -38,7 +38,7 @@ There are some reasons you may not want to use dind, such as using the image cac
One way is to mount the host Docker. Everything is essentially the same except you add a `-v` flag: One way is to mount the host Docker. Everything is essentially the same except you add a `-v` flag:
```sh ```sh
docker run --rm --name functions -it -v /var/run/docker.sock:/var/run/docker.sock -v $PWD/data:/app/data -p 8080:8080 iron/functions docker run --rm --name functions -it -v /var/run/docker.sock:/var/run/docker.sock -v $PWD/data:/app/data -p 8080:8080 treeder/functions
``` ```
### Run outside Docker ### Run outside Docker

View File

@@ -1,19 +1,19 @@
# Running IronFunctions in Production # Running Oracle Functions in Production
The [QuickStart guide](/README.md#quickstart) is intended to quickly get started and kick the tires. To run in production and be ready to scale, you need The [QuickStart guide](/README.md#quickstart) is intended to quickly get started and kick the tires. To run in production and be ready to scale, you need
to use more production ready components. to use more production ready components.
* Put the IronFunctions API behind a load balancer and launch run several instances of them (the more the merrier). * Put the Oracle Functions API behind a load balancer and launch run several instances of them (the more the merrier).
* Run a database that can scale. * Run a database that can scale.
* Asynchronous functions requires a message queue (preferably one that scales). * Asynchronous functions requires a message queue (preferably one that scales).
Here's a rough diagram of what a production deployment looks like: Here's a rough diagram of what a production deployment looks like:
![IronFunctions Architecture Diagram](../assets/architecture.png) ![Oracle Functions Architecture Diagram](../assets/architecture.png)
## Load Balancer ## Load Balancer
Any load balancer will work, put every instance of IronFunctions that you run behind the load balancer. Any load balancer will work, put every instance of Oracle Functions that you run behind the load balancer.
**Note**: We will work on a smart load balancer that can direct traffic in a smarter way. See [#151](https://github.com/treeder/functions/issues/151). **Note**: We will work on a smart load balancer that can direct traffic in a smarter way. See [#151](https://github.com/treeder/functions/issues/151).
@@ -26,13 +26,13 @@ The database is pluggable and we currently support a few options that can be [fo
## Message Queue ## Message Queue
The message queue is an important part of asynchronous functions, essentially buffering requests for processing when resources are available. The reliability and scale of the message queue will play an important part The message queue is an important part of asynchronous functions, essentially buffering requests for processing when resources are available. The reliability and scale of the message queue will play an important part
in how well IronFunctions runs, in particular if you use a lot of asynchronous function calls. in how well Oracle Functions runs, in particular if you use a lot of asynchronous function calls.
The message queue is pluggable and we currently support a few options that can be [found here](mqs/README.md). We welcome pull requests for more! The message queue is pluggable and we currently support a few options that can be [found here](mqs/README.md). We welcome pull requests for more!
## Logging, Metrics and Monitoring ## Logging, Metrics and Monitoring
Logging is a particularly important part of IronFunctions. It not only emits logs, but metrics are also emitted to the logs. Ops teams can then decide how they want Logging is a particularly important part of Oracle Functions. It not only emits logs, but metrics are also emitted to the logs. Ops teams can then decide how they want
to use the logs and metrics without us prescribing a particular technology. For instance, you can [logspout-statsd](https://github.com/treeder/logspout-statsd) to capture metrics to use the logs and metrics without us prescribing a particular technology. For instance, you can [logspout-statsd](https://github.com/treeder/logspout-statsd) to capture metrics
from the logs and forward them to statsd. from the logs and forward them to statsd.
@@ -41,5 +41,5 @@ from the logs and forward them to statsd.
## Scaling ## Scaling
There are metrics emitted to the logs that can be used to notify you when to scale. The most important being the `wait_time` metrics for both the There are metrics emitted to the logs that can be used to notify you when to scale. The most important being the `wait_time` metrics for both the
synchronous and asynchronous functions. If `wait_time` increases, you'll want to start more IronFunctions instances. synchronous and asynchronous functions. If `wait_time` increases, you'll want to start more Oracle Functions instances.

View File

@@ -1,8 +1,8 @@
# IronFunctions Routes # Oracle Functions Routes
Routes have a many-to-one mapping to an [app](apps.md). Routes have a many-to-one mapping to an [app](apps.md).
A good practice to get the best performance on your IronFunctions API is define A good practice to get the best performance on your Oracle Functions API is define
the required memory for each function. the required memory for each function.
## Route level configuration ## Route level configuration
@@ -26,9 +26,9 @@ Note: Route level configuration overrides app level configuration.
TODO: link to swagger doc on swaggerhub after it's updated. TODO: link to swagger doc on swaggerhub after it's updated.
## Understanding IronFunctions memory management ## Understanding Oracle Functions memory management
When IronFunctions starts it registers the total available memory in your system When Oracle Functions starts it registers the total available memory in your system
in order to know during its runtime if the system has the required amount of in order to know during its runtime if the system has the required amount of
free memory to run each function. Every function starts the runner reduces the free memory to run each function. Every function starts the runner reduces the
amount of memory used by that function from the available memory register. When amount of memory used by that function from the available memory register. When
@@ -56,7 +56,7 @@ some container configuration values.
curl -H "Content-Type: application/json" -X POST -d '{ curl -H "Content-Type: application/json" -X POST -d '{
"route": { "route": {
"path":"/hello", "path":"/hello",
"image":"iron/hello", "image":"treeder/hello",
"memory": 100, "memory": 100,
"type": "sync", "type": "sync",
"config": {"APPLOG": "stderr"} "config": {"APPLOG": "stderr"}

View File

@@ -1,2 +1,2 @@
# Scaling IronFunctions # Scaling Oracle Functions

View File

@@ -1,6 +1,6 @@
# Triggers # Triggers
Triggers are integrations that you can use in other systems to fire off functions in IronFunctions. Triggers are integrations that you can use in other systems to fire off functions in Oracle Functions.
## OpenStack ## OpenStack
@@ -12,7 +12,7 @@ Triggers are integrations that you can use in other systems to fire off function
* Kernel: 4.7 or newer with overlay2 or aufs module * Kernel: 4.7 or newer with overlay2 or aufs module
* Docker: 1.12 or newer * Docker: 1.12 or newer
2. [Picasso](https://github.com/openstack/picasso) - Picasso provides an OpenStack API and Keystone authentication layer on top of IronFunctions. 2. [Picasso](https://github.com/openstack/picasso) - Picasso provides an OpenStack API and Keystone authentication layer on top of Oracle Functions.
Please refer to the [Picasso on DevStack](https://github.com/openstack/picasso/blob/master/devstack/README.md) guide for setup instructions. Please refer to the [Picasso on DevStack](https://github.com/openstack/picasso/blob/master/devstack/README.md) guide for setup instructions.
### Examples ### Examples

View File

@@ -1,9 +1,9 @@
# User Interface for IronFunctions # User Interface for Oracle Functions
### Run Functions UI ### Run Functions UI
```sh ```sh
docker run --rm -it --link functions:api -p 4000:4000 -e "API_URL=http://api:8080" iron/functions-ui docker run --rm -it --link functions:api -p 4000:4000 -e "API_URL=http://api:8080" treeder/functions-ui
``` ```
For more information, see: https://github.com/treeder/functions-ui For more information, see: https://github.com/treeder/functions-ui

View File

@@ -3,7 +3,7 @@
Windows doesn't support Docker in Docker so you'll change the run command to the following: Windows doesn't support Docker in Docker so you'll change the run command to the following:
```sh ```sh
docker run --rm --name functions -it -v /var/run/docker.sock:/var/run/docker.sock -v ${pwd}/data:/app/data -p 8080:8080 iron/functions docker run --rm --name functions -it -v /var/run/docker.sock:/var/run/docker.sock -v ${pwd}/data:/app/data -p 8080:8080 treeder/functions
``` ```
Then everything should work as normal. Then everything should work as normal.

View File

@@ -11,19 +11,13 @@ Once it's pushed to a registry, you can use it by referencing it when adding a r
This is the easiest way to build, package and deploy your functions. This is the easiest way to build, package and deploy your functions.
##
### Creating an image ### Creating an image
The basic Dockerfile for most languages is along these lines: The basic Dockerfile for most languages is along these lines:
``` ```
# Choose base image # Choose base image
FROM iron/go FROM golang:alpine
# Set the working directory # Set the working directory
WORKDIR /function WORKDIR /function
# Add your binary or code to the working directory # Add your binary or code to the working directory
@@ -35,7 +29,7 @@ ENTRYPOINT ["./funcbin"]
Then you simply build your function: Then you simply build your function:
```sh ```sh
docker run --rm -v ${pwd}:/go/src/$FUNCPKG -w /go/src/$FUNCPKG iron/go:dev go build -o funcbin docker run --rm -v ${pwd}:/go/src/$FUNCPKG -w /go/src/$FUNCPKG funcy/go:dev go build -o funcbin
docker build -t $USERNAME/myfunction . docker build -t $USERNAME/myfunction .
``` ```

View File

@@ -1,10 +1,10 @@
# This is the IronFunctions API spec # This is the Oracle Functions API spec
# If you make changes here, remember to run `go generate` in api/models/ and # If you make changes here, remember to run `go generate` in api/models/ and
# api/server to make sure you use the changes. # api/server to make sure you use the changes.
swagger: '2.0' swagger: '2.0'
info: info:
title: IronFunctions title: Oracle Functions
description: The open source serverless platform. description: The open source serverless platform.
version: "0.1.29" version: "0.1.29"
# the domain of the service # the domain of the service

View File

@@ -1,4 +1,4 @@
FROM iron/go:dev FROM funcy/go:dev
RUN mkdir -p /go/src/github.com/Masterminds RUN mkdir -p /go/src/github.com/Masterminds
ENV GOPATH=/go ENV GOPATH=/go

View File

@@ -1,4 +1,4 @@
FROM iron/go FROM alpine
ADD func . ADD func .

View File

@@ -5,7 +5,7 @@ A simple serverless blog API
## Requirements ## Requirements
- Remote MongoDB instance (for example heroku) - Remote MongoDB instance (for example heroku)
- Running IronFunctions API - Running Oracle Functions API
## Development ## Development
@@ -16,7 +16,7 @@ A simple serverless blog API
USERNAME=YOUR_DOCKER_HUB_USERNAME USERNAME=YOUR_DOCKER_HUB_USERNAME
# build it # build it
docker run --rm -v "$PWD":/go/src/github.com/treeder/hello -w /go/src/github.com/treeder/hello iron/go:dev go build -o function docker run --rm -v "$PWD":/go/src/github.com/treeder/hello -w /go/src/github.com/treeder/hello funcy/go:dev go build -o function
docker build -t $USERNAME/func-blog . docker build -t $USERNAME/func-blog .
``` ```
@@ -31,9 +31,9 @@ docker tag $USERNAME/func-blog:latest $USERNAME/func-blog:`cat VERSION`
docker push $USERNAME/func-blog docker push $USERNAME/func-blog
``` ```
## Running it on IronFunctions ## Running it on Oracle Functions
First you need a running IronFunctions API First you need a running Oracle Functions API
### First, let's define this environment variables ### First, let's define this environment variables
@@ -53,7 +53,7 @@ MONGODB=YOUR_MONGODB_ADDRESS
./test.sh ./test.sh
``` ```
### Running with IronFunctions ### Running with Oracle Functions
With this command we are going to create an application with name `blog` and also defining the app configuration `DB`. With this command we are going to create an application with name `blog` and also defining the app configuration `DB`.
@@ -101,7 +101,7 @@ curl -X POST --data '{
#### Testing function #### Testing function
Now that we created our IronFunction route, let's test our routes Now that we created our Oracle Functions route, let's test our routes
``` ```
curl -X POST http://$FUNCAPI/r/blog/posts curl -X POST http://$FUNCAPI/r/blog/posts

View File

@@ -8,5 +8,5 @@ FUNCPKG=$(pwd | sed "s|$GOPATH/src/||")
docker run --rm -v "$PWD":/go/src/$FUNCPKG -w /go/src/$FUNCPKG glide up docker run --rm -v "$PWD":/go/src/$FUNCPKG -w /go/src/$FUNCPKG glide up
# build image # build image
docker run --rm -v "$PWD":/go/src/$FUNCPKG -w /go/src/$FUNCPKG iron/go:dev go build -o func docker run --rm -v "$PWD":/go/src/$FUNCPKG -w /go/src/$FUNCPKG funcy/go:dev go build -o func
docker build -t iron/func-blog . docker build -t username/func-blog .

View File

@@ -1,3 +1,3 @@
name: iron/func-blog name: username/func-blog
build: build:
- ./build.sh - ./build.sh

View File

@@ -9,8 +9,8 @@ docker rm test-mongo-func
docker run -p 27017:27017 --name test-mongo-func -d mongo docker run -p 27017:27017 --name test-mongo-func -d mongo
echo '{ "title": "My New Post", "body": "Hello world!", "user": "test" }' | docker run --rm -i -e METHOD=POST -e ROUTE=/posts -e DB=mongo:27017 --link test-mongo-func:mongo -e TEST=1 iron/func-blog echo '{ "title": "My New Post", "body": "Hello world!", "user": "test" }' | docker run --rm -i -e METHOD=POST -e ROUTE=/posts -e DB=mongo:27017 --link test-mongo-func:mongo -e TEST=1 username/func-blog
docker run --rm -i -e METHOD=GET -e ROUTE=/posts -e DB=mongo:27017 --link test-mongo-func:mongo -e TEST=1 iron/func-blog docker run --rm -i -e METHOD=GET -e ROUTE=/posts -e DB=mongo:27017 --link test-mongo-func:mongo -e TEST=1 username/func-blog
docker stop test-mongo-func docker stop test-mongo-func
docker rm test-mongo-func docker rm test-mongo-func

View File

@@ -1,19 +1,19 @@
# IronFunctions Load Balance example using Caddy # Oracle Functions Load Balance example using Caddy
Simple example of IronFunctions load balancer using Caddy Server Simple example of Oracle Functions load balancer using Caddy Server
## Run IronFunctions ## Run Oracle Functions
Start the IronFunctions instances Start the Oracle Functions instances
Ref: https://github.com/treeder/functions/blob/master/README.md#start-the-ironfunctions-api Ref: https://github.com/treeder/functions/blob/master/README.md#start-the-functions-api
## Configure environment variable ## Configure environment variable
Pass the host and port of IronFunctions instances in environment variables, Pass the host and port of Oracle Functions instances in environment variables,
this example uses three IronFunctions instances. this example uses three Oracle Functions instances.
```sh ```sh
export LB_HOST01="172.17.0.1:8080" export LB_HOST01="172.17.0.1:8080"

View File

@@ -1,12 +1,12 @@
ironfunctions01: functions01:
restart: always restart: always
image: iron/functions image: treeder/functions
ironfunctions02: functions02:
restart: always restart: always
image: iron/functions image: treeder/functions
ironfunctions03: functions03:
restart: always restart: always
image: iron/functions image: treeder/functions
caddy: caddy:
image: abiosoft/caddy image: abiosoft/caddy
volumes: volumes:
@@ -14,10 +14,10 @@ caddy:
ports: ports:
- "9000:9000" - "9000:9000"
environment: environment:
- LB_HOST01=ironfunctions01:8080 - LB_HOST01=functions01:8080
- LB_HOST02=ironfunctions02:8080 - LB_HOST02=functions02:8080
- LB_HOST03=ironfunctions03:8080 - LB_HOST03=functions03:8080
links: links:
- ironfunctions01 - functions01
- ironfunctions02 - functions02
- ironfunctions03 - functions03

View File

@@ -1,3 +1,3 @@
name: iron/func-caddy-lb name: username/func-caddy-lb
build: build:
- ./build.sh - ./build.sh

View File

@@ -1,4 +1,4 @@
FROM iron/ruby:dev FROM funcy/ruby:dev
WORKDIR /function WORKDIR /function
ADD Gemfile /function/ ADD Gemfile /function/

View File

@@ -4,7 +4,7 @@ This images compares the payload info with the header.
## Requirements ## Requirements
- IronFunctions API - Oracle Functions API
## Development ## Development
@@ -35,7 +35,7 @@ docker push $USERNAME/func-checker
./test.sh ./test.sh
``` ```
## Running it on IronFunctions ## Running it on Oracle Functions
### Let's define some environment variables ### Let's define some environment variables
@@ -45,7 +45,7 @@ docker push $USERNAME/func-checker
FUNCAPI=YOUR_FUNCTIONS_ADDRESS FUNCAPI=YOUR_FUNCTIONS_ADDRESS
``` ```
### Running with IronFunctions ### Running with Oracle Functions
With this command we are going to create an application with name `checker`. With this command we are going to create an application with name `checker`.
@@ -71,7 +71,7 @@ curl -X POST --data '{
#### Testing function #### Testing function
Now that we created our IronFunction route, let's test our new route Now that we created our Oracle Functions route, let's test our new route
``` ```
curl -X POST --data '{ "env_vars": { "test": "1" } }' http://$FUNCAPI/r/checker/check curl -X POST --data '{ "env_vars": { "test": "1" } }' http://$FUNCAPI/r/checker/check

View File

@@ -2,4 +2,4 @@
set -ex set -ex
# build image # build image
docker build -t iron/func-checker . docker build -t username/func-checker .

View File

@@ -1,3 +1,3 @@
name: iron/func-checker name: username/func-checker
build: build:
- ./build.sh - ./build.sh

View File

@@ -6,4 +6,4 @@ set -x
PAYLOAD='{"env_vars": {"FOO": "bar"}}' PAYLOAD='{"env_vars": {"FOO": "bar"}}'
# test it # test it
echo $PAYLOAD | docker run --rm -i -e TEST=1 -e FOO=bar iron/func-checker echo $PAYLOAD | docker run --rm -i -e TEST=1 -e FOO=bar username/func-checker

View File

@@ -1,4 +1,4 @@
FROM iron/ruby:dev FROM funcy/ruby:dev
WORKDIR /function WORKDIR /function
ADD Gemfile /function/ ADD Gemfile /function/

View File

@@ -4,7 +4,7 @@ This images compares the payload info with the header.
## Requirements ## Requirements
- IronFunctions API - Oracle Functions API
## Development ## Development
@@ -35,7 +35,7 @@ docker push $USERNAME/func-echo
./test.sh ./test.sh
``` ```
## Running it on IronFunctions ## Running it on Oracle Functions
### Let's define some environment variables ### Let's define some environment variables
@@ -45,7 +45,7 @@ docker push $USERNAME/func-echo
FUNCAPI=YOUR_FUNCTIONS_ADDRESS FUNCAPI=YOUR_FUNCTIONS_ADDRESS
``` ```
### Running with IronFunctions ### Running with Oracle Functions
With this command we are going to create an application with name `echo`. With this command we are going to create an application with name `echo`.
@@ -70,7 +70,7 @@ curl -X POST --data '{
#### Testing function #### Testing function
Now that we created our IronFunction route, let's test our new route Now that we created our Oracle Functions route, let's test our new route
``` ```
curl -X POST --data '{"input": "yoooo"}' http://$FUNCAPI/r/echo/echo curl -X POST --data '{"input": "yoooo"}' http://$FUNCAPI/r/echo/echo

View File

@@ -2,4 +2,4 @@
set -ex set -ex
# build image # build image
docker build -t iron/func-echo . docker build -t username/func-echo .

View File

@@ -1,3 +1,3 @@
name: iron/func-echo name: username/func-echo
build: build:
- ./build.sh - ./build.sh

View File

@@ -6,4 +6,4 @@ set -x
PAYLOAD='{"input": "yoooo"}' PAYLOAD='{"input": "yoooo"}'
# test it # test it
echo $PAYLOAD | docker run --rm -i -e TEST=1 iron/func-echo echo $PAYLOAD | docker run --rm -i -e TEST=1 username/func-echo

View File

@@ -1,4 +1,4 @@
FROM iron/ruby:dev FROM funcy/ruby:dev
WORKDIR /worker WORKDIR /worker
ADD Gemfile* /worker/ ADD Gemfile* /worker/

View File

@@ -4,7 +4,7 @@ This images compares the payload info with the header.
## Requirements ## Requirements
- IronFunctions API - Oracle Functions API
## Development ## Development
@@ -35,7 +35,7 @@ docker push $USERNAME/func-error
./test.sh ./test.sh
``` ```
## Running it on IronFunctions ## Running it on Oracle Functions
### Let's define some environment variables ### Let's define some environment variables
@@ -45,7 +45,7 @@ docker push $USERNAME/func-error
FUNCAPI=YOUR_FUNCTIONS_ADDRESS FUNCAPI=YOUR_FUNCTIONS_ADDRESS
``` ```
### Running with IronFunctions ### Running with Oracle Functions
With this command we are going to create an application with name `error`. With this command we are going to create an application with name `error`.
@@ -70,7 +70,7 @@ curl -X POST --data '{
#### Testing function #### Testing function
Now that we created our IronFunction route, let's test our new route Now that we created our Oracle Functions route, let's test our new route
``` ```
curl -X POST --data '{"input": "yoooo"}' http://$FUNCAPI/r/error/error curl -X POST --data '{"input": "yoooo"}' http://$FUNCAPI/r/error/error

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash
set -ex set -ex
docker build -t iron/func-error . docker build -t username/func-error .

View File

@@ -1,3 +1,3 @@
name: iron/func-error name: username/func-error
build: build:
- ./build.sh - ./build.sh

View File

@@ -6,4 +6,4 @@ set -x
PAYLOAD='{"input": "yoooo"}' PAYLOAD='{"input": "yoooo"}'
# test it # test it
echo $PAYLOAD | docker run --rm -i -e TEST=1 iron/func-error echo $PAYLOAD | docker run --rm -i -e TEST=1 username/func-error

View File

@@ -6,10 +6,10 @@ Make sure you downloaded and installed [dotnet](https://www.microsoft.com/net/co
dotnet new dotnet new
``` ```
By default dotnet creates a ```Program.cs``` file with a main method. To make it work with IronFunction's `fn` tool please rename it to ```func.cs```. By default dotnet creates a ```Program.cs``` file with a main method. To make it work with Oracle Functions's `fn` tool please rename it to ```func.cs```.
Now change the code as you desire to do whatever magic you need it to do. Once done you can now create an iron function out of it. Now change the code as you desire to do whatever magic you need it to do. Once done you can now create a function out of it.
## Creating an IronFunction ## Creating an Oracle Functions
Simply run Simply run
```bash ```bash
@@ -31,7 +31,7 @@ fn push
This will create a docker image and push the image to docker. This will create a docker image and push the image to docker.
## Publishing to IronFunctions ## Publishing to Oracle Functions
```bash ```bash
fn routes create <app_name> </path> fn routes create <app_name> </path>

View File

@@ -1,6 +1,6 @@
# Quick Example for a Go Function (3 minutes) # Quick Example for a Go Function (3 minutes)
This example will show you how to test and deploy Go (Golang) code to IronFunctions. This example will show you how to test and deploy Go (Golang) code to Oracle Functions.
```sh ```sh
# create your func.yaml file # create your func.yaml file
@@ -11,11 +11,11 @@ fn build
cat hello.payload.json | fn run cat hello.payload.json | fn run
# push it to Docker Hub # push it to Docker Hub
fn push fn push
# Create a route to this function on IronFunctions # Create a route to this function on Oracle Functions
fn routes create myapp /hello fn routes create myapp /hello
``` ```
Now you can call your function on IronFunctions: Now you can call your function on Oracle Functions:
```sh ```sh
curl -H "Content-Type: application/json" -X POST -d @hello.payload.json http://localhost:8080/r/myapp/hello curl -H "Content-Type: application/json" -X POST -d @hello.payload.json http://localhost:8080/r/myapp/hello

View File

@@ -1,6 +1,6 @@
## Quick Example for a NodeJS Function (4 minutes) ## Quick Example for a NodeJS Function (4 minutes)
This example will show you how to test and deploy a Node function to IronFunctions. This example will show you how to test and deploy a Node function to Oracle Functions.
```sh ```sh
# create your func.yaml file # create your func.yaml file
@@ -11,7 +11,7 @@ fn build
cat hello.payload.json | fn run cat hello.payload.json | fn run
# push it to Docker Hub # push it to Docker Hub
fn push fn push
# Create a route to this function on IronFunctions # Create a route to this function on Oracle Functions
fn routes create myapp /hello fn routes create myapp /hello
``` ```
@@ -24,7 +24,7 @@ Create a [package.json](https://docs.npmjs.com/getting-started/using-a-package.j
Run: Run:
```sh ```sh
docker run --rm -v "$PWD":/function -w /function iron/node:dev npm install docker run --rm -v "$PWD":/function -w /function funcy/node:dev npm install
``` ```
Then everything should work. Then everything should work.

View File

@@ -1,4 +1,4 @@
FROM iron/php FROM funcy/php
WORKDIR /app WORKDIR /app
ADD . /app ADD . /app

View File

@@ -1,6 +1,6 @@
## Quick Example for a PHP Function (4 minutes) ## Quick Example for a PHP Function (4 minutes)
This example will show you how to test and deploy Go (Golang) code to IronFunctions. This example will show you how to test and deploy Go (Golang) code to Oracle Functions.
### 1. Prepare the `func.yaml` file: ### 1. Prepare the `func.yaml` file:
@@ -11,7 +11,7 @@ name: USERNAME/hello
version: 0.0.1 version: 0.0.1
path: /hello path: /hello
build: build:
- docker run --rm -v "$PWD":/worker -w /worker iron/php:dev composer install - docker run --rm -v "$PWD":/worker -w /worker funcy/php:dev composer install
``` ```
The important step here is to ensure you replace `USERNAME` with your Docker Hub account name. Some points of note: The important step here is to ensure you replace `USERNAME` with your Docker Hub account name. Some points of note:
@@ -27,7 +27,7 @@ fn build
cat hello.payload.json | fn run cat hello.payload.json | fn run
# push it to Docker Hub # push it to Docker Hub
fn push fn push
# Create a route to this function on IronFunctions # Create a route to this function on Oracle Functions
fn routes create phpapp /hello fn routes create phpapp /hello
``` ```

Some files were not shown because too many files have changed in this diff Show More