Update references remove refs to treeder oracle funcy (#376)

* Remove lots of refs to iron and funcy oracle etc..

* more ref replacements

* Replacing more refs. Treeder

* Use Fn not FN
This commit is contained in:
James Jeffrey
2017-09-29 16:22:15 -07:00
committed by Travis Reeder
parent 5219227393
commit c7f3066c75
81 changed files with 211 additions and 398 deletions

View File

@@ -1,4 +1,4 @@
# Contributing to Oracle Functions
# Contributing to Fn
We welcome all contributions!

View File

@@ -42,7 +42,7 @@ docker-build:
docker build --build-arg HTTPS_PROXY --build-arg HTTP_PROXY -t fnproject/functions:latest .
docker-run: docker-build
docker run --rm --privileged -it -e NO_PROXY -e HTTP_PROXY -e LOG_LEVEL=debug -e "DB_URL=sqlite3:///app/data/fn.db" -v ${CURDIR}/data:/app/data -p 8080:8080 funcy/functions
docker run --rm --privileged -it -e NO_PROXY -e HTTP_PROXY -e LOG_LEVEL=debug -e "DB_URL=sqlite3:///app/data/fn.db" -v ${CURDIR}/data:/app/data -p 8080:8080 fnproject/functions
docker-test-run-with-sqlite3:
./api_test.sh sqlite3 4
@@ -58,7 +58,7 @@ docker-test:
-v /var/run/docker.sock:/var/run/docker.sock \
-v ${CURDIR}:/go/src/github.com/fnproject/fn \
-w /go/src/github.com/fnproject/fn \
funcy/go:dev go test \
fnproject/go:dev go test \
-v $(shell docker run --rm -ti -v ${CURDIR}:/go/src/github.com/fnproject/fn -w /go/src/github.com/fnproject/fn -e GOPATH=/go golang:alpine sh -c 'go list ./... | grep -v vendor | grep -v examples | grep -v tool | grep -v fn')
all: dep build

View File

@@ -89,7 +89,7 @@ Now run the following CLI commands:
fn init
# Set your Docker Hub username
export FN_REGISTRY=<DOCKERHUB_USERNAME>
export Fn_REGISTRY=<DOCKERHUB_USERNAME>
# Test your function
# This will run inside a container exactly how it will on the server

View File

@@ -1,164 +0,0 @@
package mqs
import (
"context"
"encoding/json"
"fmt"
"net/url"
"strconv"
"strings"
"sync"
"github.com/fnproject/fn/api/models"
mq_config "github.com/iron-io/iron_go3/config"
ironmq "github.com/iron-io/iron_go3/mq"
"github.com/sirupsen/logrus"
)
type assoc struct {
msgId string
reservationId string
}
type IronMQ struct {
queues []ironmq.Queue
// Protects the map
sync.Mutex
// job id to {msgid, reservationid}
msgAssoc map[string]*assoc
}
type IronMQConfig struct {
Token string `mapstructure:"token"`
ProjectId string `mapstructure:"project_id"`
Host string `mapstructure:"host"`
Scheme string `mapstructure:"scheme"`
Port uint16 `mapstructure:"port"`
QueuePrefix string `mapstructure:"queue_prefix"`
}
func NewIronMQ(url *url.URL) *IronMQ {
if url.User == nil || url.User.Username() == "" {
logrus.Fatal("IronMQ requires PROJECT_ID and TOKEN")
}
p, ok := url.User.Password()
if !ok {
logrus.Fatal("IronMQ requires PROJECT_ID and TOKEN")
}
settings := &mq_config.Settings{
Token: p,
ProjectId: url.User.Username(),
Host: url.Host,
Scheme: "https",
}
if url.Scheme == "ironmq+http" {
settings.Scheme = "http"
}
parts := strings.Split(url.Host, ":")
if len(parts) > 1 {
settings.Host = parts[0]
p, err := strconv.Atoi(parts[1])
if err != nil {
logrus.WithFields(logrus.Fields{"host_port": url.Host}).Fatal("Invalid host+port combination")
}
settings.Port = uint16(p)
}
var queueName string
if url.Path != "" {
queueName = url.Path
} else {
queueName = "fn"
}
mq := &IronMQ{
queues: make([]ironmq.Queue, 3),
msgAssoc: make(map[string]*assoc),
}
// Check we can connect by trying to create one of the queues. Create is
// idempotent, so this is fine.
_, err := ironmq.ConfigCreateQueue(ironmq.QueueInfo{Name: fmt.Sprintf("%s_%d", queueName, 0)}, settings)
if err != nil {
logrus.WithError(err).Fatal("Could not connect to IronMQ")
}
for i := 0; i < 3; i++ {
mq.queues[i] = ironmq.ConfigNew(fmt.Sprintf("%s_%d", queueName, i), settings)
}
logrus.WithFields(logrus.Fields{"base_queue": queueName}).Info("IronMQ initialized")
return mq
}
func (mq *IronMQ) Push(ctx context.Context, job *models.Call) (*models.Call, error) {
if job.Priority == nil || *job.Priority < 0 || *job.Priority > 2 {
return nil, fmt.Errorf("IronMQ Push job %s: Bad priority", job.ID)
}
// Push the work onto the queue.
buf, err := json.Marshal(job)
if err != nil {
return nil, err
}
_, err = mq.queues[*job.Priority].PushMessage(ironmq.Message{Body: string(buf), Delay: int64(job.Delay)})
return job, err
}
func (mq *IronMQ) Reserve(ctx context.Context) (*models.Call, error) {
var job models.Call
var messages []ironmq.Message
var err error
for i := 2; i >= 0; i-- {
messages, err = mq.queues[i].LongPoll(1, 60, 0 /* wait */, false /* delete */)
if err != nil {
// It is OK if the queue does not exist, it will be created when a message is queued.
if !strings.Contains(err.Error(), "404 Not Found") {
return nil, err
}
}
if len(messages) == 0 {
// Try next priority.
if i == 0 {
return nil, nil
}
continue
}
// Found a message!
break
}
message := messages[0]
if message.Body == "" {
return nil, nil
}
err = json.Unmarshal([]byte(message.Body), &job)
if err != nil {
return nil, err
}
mq.Lock()
mq.msgAssoc[job.ID] = &assoc{message.Id, message.ReservationId}
mq.Unlock()
return &job, nil
}
func (mq *IronMQ) Delete(ctx context.Context, job *models.Call) error {
if job.Priority == nil || *job.Priority < 0 || *job.Priority > 2 {
return fmt.Errorf("IronMQ Delete job %s: Bad priority", job.ID)
}
mq.Lock()
assoc, exists := mq.msgAssoc[job.ID]
delete(mq.msgAssoc, job.ID)
mq.Unlock()
if exists {
return mq.queues[*job.Priority].DeleteMessage(assoc.msgId, assoc.reservationId)
}
return nil
}

View File

@@ -4,7 +4,6 @@ import (
"context"
"fmt"
"net/url"
"strings"
"github.com/fnproject/fn/api/models"
"github.com/opentracing/opentracing-go"
@@ -35,9 +34,6 @@ func newmq(mqURL string) (models.MessageQueue, error) {
case "bolt":
return NewBoltMQ(u)
}
if strings.HasPrefix(u.Scheme, "ironmq") {
return NewIronMQ(u), nil
}
return nil, fmt.Errorf("mq type not supported %v", u.Scheme)
}

View File

@@ -21,12 +21,12 @@ function quick() {
}
function build () {
docker run --rm -v ${pwd}:/go/src/github.com/treeder/functions -w /go/src/github.com/treeder/functions golang:alpine go build -o functions-alpine
docker build -t treeder/functions:latest .
docker run --rm -v ${pwd}:/go/src/github.com/fnproject/functions -w /go/src/github.com/fnproject/functions golang:alpine go build -o functions-alpine
docker build -t fnproject/functions:latest .
}
function run () {
docker run --rm --name functions -it -v /var/run/docker.sock:/var/run/docker.sock -e LOG_LEVEL=debug -e "DB_URL=sqlite3:///app/data/fn.db" -v $PWD/data:/app/data -p 8080:8080 treeder/functions
docker run --rm --name functions -it -v /var/run/docker.sock:/var/run/docker.sock -e LOG_LEVEL=debug -e "DB_URL=sqlite3:///app/data/fn.db" -v $PWD/data:/app/data -p 8080:8080 fnproject/functions
}
switch ($cmd)

View File

@@ -6,7 +6,7 @@ require 'openssl'
require_relative 'utils.rb'
swaggerUrl = "https://raw.githubusercontent.com/treeder/functions/master/docs/swagger.yml"
swaggerUrl = "https://raw.githubusercontent.com/fnproject/fn/master/docs/swagger.yml"
spec = YAML.load(open(swaggerUrl))
version = spec['info']['version']
puts "VERSION: #{version}"

View File

@@ -25,7 +25,7 @@ If you are a developer using Fn through the API, this section is for you.
## For Operators
If you are operating Oracle Functions, this section is for you.
If you are operating Fn, this section is for you.
* [Running in Production Overview](operating/production.md)
* [Runtime Options](operating/options.md)
@@ -35,9 +35,9 @@ If you are operating Oracle Functions, this section is for you.
* [Logging](operating/logging.md)
* [Metrics](operating/metrics.md)
* [Triggers](operating/triggers.md)
* [Extending Oracle Functions](operating/extending.md)
* [Extending Fn](operating/extending.md)
* [Docker Configuration](operating/docker.md)
* [Operating On Windows](operating/windows.md)
* Running Oracle Functions on:
* Running Fn on:
* [Kubernetes](operating/kubernetes/README.md)
* [Docker Swarm](operating/docker-swarm/README.md)

View File

@@ -6,15 +6,15 @@ 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
base [function format](function-format.md).
## Where can I run Oracle Functions?
## Where can I run Fn?
Anywhere. Any cloud, on-premise, on your laptop. As long as you can run a Docker container, you can run Oracle Functions.
Anywhere. Any cloud, on-premise, on your laptop. As long as you can run a Docker container, you can run Fn.
## Which orchestration tools does functions support?
Functions can be deployed using any orchestration tool.
## Does Oracle Functions require Docker?
## Does Fn require Docker?
For now we require Docker primarily for the packaging and distribution via Docker Registries,
but we've built Functions in a way that abstracts the container technology so we can support others as

View File

@@ -1,6 +1,6 @@
# Lambda everywhere
Lambda support for Oracle Functios enables you to take your AWS Lambda functions and run them
Lambda support for Fn 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.
## Creating Lambda Functions

View File

@@ -5,7 +5,7 @@
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
Oracle Functions compatible Docker Image as follows:
FN compatible Docker Image as follows:
```bash
fn lambda create-function <name> <runtime> <handler> <files...>

View File

@@ -21,11 +21,11 @@ such assumptions, please rewrite it.
## nodejs
* node.js version [0.10.42][funcy/node]
* node.js version [0.10.42][fnproject/node]
* ImageMagick version [6.9.3][magickv] and nodejs [wrapper 6.9.3][magickwrapperv]
* aws-sdk version [2.2.12][awsnodev]
[funcy/node]: https://github.com/treeder/dockers/blob/master/node/Dockerfile
[fnproject/node]: https://github.com/fnproject/dockers/blob/master/node/Dockerfile
[magickv]: https://pkgs.alpinelinux.org/package/main/x86_64/imagemagick
[magickwrapperv]: https://www.npmjs.com/package/imagemagick
[awsnodev]: https://aws.amazon.com/sdk-for-node-js/
@@ -57,7 +57,7 @@ If your handler throws an exception, we only log the error message. There is no
* CPython [2.7.11][pythonv]
* boto3 (Python AWS SDK) [1.2.3][botov].
[pythonv]: https://hub.docker.com/r/funcy/python/tags/
[pythonv]: https://hub.docker.com/r/fnproject/python/tags/
[botov]: https://github.com/boto/boto3/releases/tag/1.2.3
### Event
@@ -84,7 +84,7 @@ a JSON object with trace information.
* OpenJDK Java Runtime [1.8.0][javav]
[javav]: https://hub.docker.com/r/funcy/java/tags/
[javav]: https://hub.docker.com/r/fnproject/java/tags/
The Java8 runtime is significantly lacking at this piont and we **do not
recommend** using it.

View File

@@ -3,7 +3,7 @@
Import existing AWS Lambda functions
====================================
The [fn](https://github.com/treeder/functions/fn/) tool includes a set of
The [fn](https://github.com/fnproject/fn/) tool includes a set of
commands to act on Lambda functions. Most of these are described in
[getting-started](./getting-started.md). One more subcommand is `aws-import`.
@@ -40,7 +40,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.
Using Lambda with Docker Hub and Oracle Functions requires that the Docker image be
Using Lambda with Docker Hub and Fn requires that the Docker image be
named `<Docker Hub username>/<image name>`. This is used to uniquely identify
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.

View File

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

View File

@@ -1,4 +1,4 @@
# Oracle Functions using Postgres
# Fn using Postgres
Let's presuppose you don't have even a MySQL DB ready.
@@ -6,7 +6,7 @@ Let's presuppose you don't have even a MySQL DB ready.
```
docker run --name func-mysql \
-e MYSQL_DATABASE=funcs -e MYSQL_USER=funcy -e MYSQL_PASSWORD=funcypass -d mysql
-e MYSQL_DATABASE=funcs -e MYSQL_USER=func -e MYSQL_PASSWORD=funcpass -d mysql
```
For more configuration options, see [docker mysql docs](https://hub.docker.com/_/mysql/).
@@ -15,6 +15,6 @@ For more configuration options, see [docker mysql docs](https://hub.docker.com/_
```
docker run --rm --privileged --link "iron-mysql:mysql" \
-e "DB_URL=mysql://funcy:funcypass@tcp(mysql:3306)/funcs" \
-it -p 8080:8080 treeder/functions
-e "DB_URL=mysql://func:funcpass@tcp(mysql:3306)/funcs" \
-it -p 8080:8080 fnproject/fn
```

View File

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

View File

@@ -1,25 +1,25 @@
# Extending Oracle Functions
# Extending Fn
Oracle Functions is extensible so you can add custom functionality and extend the project without needing to modify the core.
FN 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 Oracle Functions.
There are multiple ways to extend the functionality of Fn.
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. Add API Endpoints - extend the default Oracle Functions API.
1. Add API Endpoints - extend the default Fn API.
## Listeners
Listeners are the main way to extend Oracle Functions.
Listeners are the main way to extend Fn.
The following listener types are supported:
* App Listeners - [GoDoc](https://godoc.org/github.com/treeder/functions/api/server#AppListener)
* Runner Listeners - [GoDoc](https://godoc.org/github.com/treeder/functions/api/server#RunnerListener)
* App Listeners - [GoDoc](https://godoc.org/github.com/fnproject/functions/api/server#AppListener)
* Runner Listeners - [GoDoc](https://godoc.org/github.com/fnproject/functions/api/server#RunnerListener)
### 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 Oracle Functions 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 Fn API
Example:
@@ -29,8 +29,8 @@ package main
import (
"context"
"github.com/treeder/functions/api/server"
"github.com/treeder/functions/api/models"
"github.com/fnproject/functions/api/server"
"github.com/fnproject/functions/api/models"
)
type myCustomListener struct{}
@@ -67,6 +67,6 @@ See examples of this in [examples/middleware/main.go](../../examples/middleware/
## Adding API Endpoints
You can add API endpoints to the Oracle Functions server by using the `AddEndpoint` and `AddEndpointFunc` methods.
You can add API endpoints to the Fn server by using the `AddEndpoint` and `AddEndpointFunc` methods.
See examples of this in [examples/extensions/main.go](../../examples/extensions/main.go).

View File

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

View File

@@ -1,6 +1,6 @@
# Message Queues
A message queue is used to coordinate asynchronous function calls that run through Oracle Functions.
A message queue is used to coordinate asynchronous function calls that run through Fn.
We currently support the following message queues and they are passed in via the `MQ_URL` environment variable. For example:
@@ -19,18 +19,6 @@ the file cannot be the same as the one used for the Bolt Datastore.
See Redis in databases above.
## [IronMQ](https://www.iron.io/platform/ironmq/)
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 Oracle Functions in production and don't
want to manage a message queue, you should start here.
The IronMQ connector uses HTTPS by default. To use HTTP set the scheme to
`ironmq+http`. You can also use a custom port. An example URL is:
`ironmq+http://project_id:token@localhost:8090/queue_prefix`.
## What about message queue X?
We're happy to add more and we love pull requests, so feel free to add one! Copy one of the implementations above as a starting point.

View File

@@ -1,8 +1,8 @@
# Oracle Functions Runtime Options
# Fn Runtime Options
## Configuration
When starting Oracle Functions, you can pass in the following configuration variables as environment variables. Use `-e VAR_NAME=VALUE` in
When starting Fn, you can pass in the following configuration variables as environment variables. Use `-e VAR_NAME=VALUE` in
docker run. For example:
```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. | sqlite3:///app/data/fn.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 Oracle Functions 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 Fn 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 |
| LOG_LEVEL | Set to DEBUG to enable debugging | INFO |
| 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
The default way to run Oracle Functions, as it is in the Quickstart guide, is to use docker-in-docker (dind). There are
The default way to run Fn, 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:
* 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 Oracle Functions instance. For instance, you can set `--memory` on
the docker run command to set the max memory for the Oracle Functions instance AND all of the functions it's running.
* You can set resource restrictions for the entire Fn instance. For instance, you can set `--memory` on
the docker run command to set the max memory for the Fn 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
[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:
```sh
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
docker run --rm --name functions -it -v /var/run/docker.sock:/var/run/docker.sock -v $PWD/data:/app/data -p 8080:8080 fnproject/functions
```
### Run outside Docker

View File

@@ -1,21 +1,19 @@
# Running Oracle Functions in Production
# Running Fn 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
to use more production ready components.
* Put the Oracle Functions API behind a load balancer and launch run several instances of them (the more the merrier).
* Put the Fn API behind a load balancer and launch run several instances of them (the more the merrier).
* Run a database that can scale.
* Asynchronous functions requires a message queue (preferably one that scales).
Here's a rough diagram of what a production deployment looks like:
![Oracle Functions Architecture Diagram](../assets/architecture.png)
![FN Architecture Diagram](../assets/architecture.png)
## 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).
Any load balancer will work, put every instance of Fn that you run behind the load balancer.
## Database
@@ -26,13 +24,13 @@ The database is pluggable and we currently support a few options that can be [fo
## 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
in how well Oracle Functions runs, in particular if you use a lot of asynchronous function calls.
in how well Fn 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!
## Logging, Metrics and Monitoring
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
Logging is a particularly important part of Fn. 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
from the logs and forward them to statsd.
@@ -41,5 +39,4 @@ from the logs and forward them to statsd.
## 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
synchronous and asynchronous functions. If `wait_time` increases, you'll want to start more Oracle Functions instances.
synchronous and asynchronous functions. If `wait_time` increases, you'll want to start more Fn instances.

View File

@@ -1,8 +1,8 @@
# Oracle Functions Routes
# Fn Routes
Routes have a many-to-one mapping to an [app](apps.md).
A good practice to get the best performance on your Oracle Functions API is define
A good practice to get the best performance on your Fn API is define
the required memory for each function.
## 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.
## Understanding Oracle Functions memory management
## Understanding Fn memory management
When Oracle Functions starts it registers the total available memory in your system
When Fn 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
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

View File

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

View File

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

View File

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

View File

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

View File

@@ -12,12 +12,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
24/7, functions only run when needed
Since you'll be running Oracle Functions yourself, the paying part may not apply, but it does apply to
Since you'll be running Fn yourself, the paying part may not apply, but it does apply to
cost savings on your infrastructure bills as you'll read below.
## Benefits for operators
If you will be operating Oracle Functions (the person who has to manage the servers behind the serverless),
If you will be operating Fn (the person who has to manage the servers behind the serverless),
then the benefits are different, but related.
* Extremely efficient use of resources
@@ -28,7 +28,7 @@ then the benefits are different, but related.
* Single system for code written in any language or any technology
* Single system to monitor
* Scaling is the same for all functions, you don't scale each app independently
* Scaling is simply adding more Oracle Functions nodes
* Scaling is simply adding more Fn 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)

View File

@@ -1,6 +1,6 @@
# Detailed Usage
This is a more detailed explanation of the main commands you'll use in Oracle Functions as a developer.
This is a more detailed explanation of the main commands you'll use in Fn as a developer.
### Create an Application
@@ -85,7 +85,7 @@ You should see it say `Hello Johnny!` now instead of `Hello World!`.
### Add an asynchronous function
Oracle Functions supports synchronous function calls like we just tried above, and asynchronous for background processing.
FN supports synchronous function calls like we just tried above, and asynchronous for background processing.
[Asynchronous functions](async.md) 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.

View File

@@ -38,7 +38,7 @@ You will also have access to a set of environment variables.
* `FN_MEMORY` - a number representing the amount of memory available to the call, in MB
* `FN_TYPE` - the type for this call, currently 'sync' or 'async'
* `FN_HEADER_$X` - the HTTP headers that were set for this request. Replace $X with the upper cased name of the header and replace dashes in the header with underscores.
* `$X` - any [configuration values](https://gitlab.oracledx.com/odx/functions/blob/master/fn/README.md#application-level-configuration) you've set
* `$X` - any [configuration values](https://github.com/fnproject/cli/blob/master/README.md#application-level-configuration) you've set
for the Application or the Route. Replace X with the upper cased name of the config variable you set. Ex: `minio_secret=secret` will be exposed via MINIO_SECRET env var.
* `FN_PARAM_$Y` - any variables found from parsing the URL. Replace $Y with any `:var` from the url.
@@ -75,7 +75,7 @@ STDERR.puts("hi")
### Lambda everywhere
Lambda support for Oracle Functios enables you to take your AWS Lambda functions and run them
Lambda support for Fn 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.
Creating Lambda functions is not much different than using regular functions, just use

View File

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

View File

@@ -4,4 +4,4 @@ This directory has a collection of example functions you can look at to learn mo
## Tutorial Series
The [Tutorial Series](tutorial/) will demonstrate some of Oracle Functions capabilities through a series of exmaples. We'll try to show examples in most major languages. This is a great place to start!
The [Tutorial Series](tutorial/) will demonstrate some of Fn capabilities through a series of exmaples. We'll try to show examples in most major languages. This is a great place to start!

View File

@@ -5,7 +5,7 @@ A simple serverless blog API
## Requirements
- Remote MongoDB instance (for example heroku)
- Running Oracle Functions API
- Running Fn API
## Development
@@ -16,7 +16,7 @@ A simple serverless blog API
USERNAME=YOUR_DOCKER_HUB_USERNAME
# build it
docker run --rm -v "$PWD":/go/src/github.com/fnproject/hello -w /go/src/github.com/fnproject/hello funcy/go:dev go build -o function
docker run --rm -v "$PWD":/go/src/github.com/fnproject/hello -w /go/src/github.com/fnproject/hello fnproject/go:dev go build -o function
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
```
## Running it on Oracle Functions
## Running it on Fn
First you need a running Oracle Functions API
First you need a running Fn API
### First, let's define this environment variables
@@ -53,7 +53,7 @@ MONGODB=YOUR_MONGODB_ADDRESS
./test.sh
```
### Running with Oracle Functions
### Running with Fn
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
Now that we created our Oracle Functions route, let's test our routes
Now that we created our Fn route, let's test our routes
```
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
# build image
docker run --rm -v "$PWD":/go/src/$FUNCPKG -w /go/src/$FUNCPKG funcy/go:dev go build -o func
docker run --rm -v "$PWD":/go/src/$FUNCPKG -w /go/src/$FUNCPKG fnproject/go:dev go build -o func
docker build -t username/func-blog .

View File

@@ -1,4 +1,4 @@
package: github.com/treeder/functions/examples/blog
package: github.com/fnproject/functions/examples/blog
import:
- package: github.com/dgrijalva/jwt-go
version: ^3.0.0

View File

@@ -1,19 +1,19 @@
# Oracle Functions Load Balance example using Caddy
# Fn Load Balance example using Caddy
Simple example of Oracle Functions load balancer using Caddy Server
Simple example of Fn load balancer using Caddy Server
## Run Oracle Functions
## Run Fn
Start the Oracle Functions instances
Start the Fn instances
Ref: https://github.com/treeder/functions/blob/master/README.md#start-the-functions-api
Ref: https://github.com/fnproject/functions/blob/master/README.md#start-the-functions-api
## Configure environment variable
Pass the host and port of Oracle Functions instances in environment variables,
this example uses three Oracle Functions instances.
Pass the host and port of Fn instances in environment variables,
this example uses three Fn instances.
```sh
export LB_HOST01="172.17.0.1:8080"
@@ -38,7 +38,7 @@ docker run --rm \
Follow the Quick-Start steps replacing the example hosts by the Caddy host (localhost:9000)
https://github.com/treeder/functions/blob/master/README.md#quick-start
https://github.com/fnproject/functions/blob/master/README.md#quick-start
## Docker Compose example

View File

@@ -1,12 +1,12 @@
functions01:
restart: always
image: treeder/functions
image: fnproject/functions
functions02:
restart: always
image: treeder/functions
image: fnproject/functions
functions03:
restart: always
image: treeder/functions
image: fnproject/functions
caddy:
image: abiosoft/caddy
volumes:

View File

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

View File

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

View File

@@ -20,7 +20,7 @@ if payload != ""
puts "all good"
end
# Also check for expected env vars: https://gitlab.oracledx.com/odx/functions/blob/master/docs/writing.md#inputs
# Also check for expected env vars: https://github.com/fnproject/fn/blob/master/docs/writing.md#inputs
e = ENV["FN_REQUEST_URL"]
puts e
uri = URI.parse(e)

View File

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

View File

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

View File

@@ -6,10 +6,10 @@ Make sure you downloaded and installed [dotnet](https://www.microsoft.com/net/co
dotnet new
```
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```.
By default dotnet creates a ```Program.cs``` file with a main method. To make it work with Fn'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 a function out of it.
## Creating an Oracle Functions
## Creating an Fn
Simply run
```bash
@@ -31,7 +31,7 @@ fn push
This will create a docker image and push the image to docker.
## Publishing to Oracle Functions
## Publishing to Fn
```bash
fn routes create <app_name> </path>

View File

@@ -1,6 +1,6 @@
# Middleware Example
This example adds a simple authentication middleware to Oracle Functions. See [main.go](main.go) for example code.
This example adds a simple authentication middleware to Fn. See [main.go](main.go) for example code.
## Building and Running

View File

@@ -11,13 +11,13 @@ fn build
./test.sh
# Push it to Docker Hub
fn push
# Create routes to this function on Oracle Functions
# Create routes to this function on Fn
fn apps create <YOUR_APP> --config SERVER=<POSTGRES>
fn routes create --config TABLE=<TABLE_NAME> --config COMMAND=INSERT <YOUR_APP> /<TABLE_NAME>/insert
fn routes create --config TABLE=<TABLE_NAME> --config COMMAND=SELECT <YOUR_APP> /<TABLE_NAME>/select
```
Now you can call your function on Oracle Functions:
Now you can call your function on Fn:
```
echo <JSON_RECORD> | fn call /<YOUR_APP>/<TABLE_NAME>/insert

View File

@@ -1,4 +1,4 @@
package: github.com/treeder/functions/examples/postgres
package: github.com/fnproject/functions/examples/postgres
import:
- package: github.com/lib/pq
- package: github.com/pkg/errors

View File

@@ -1,4 +1,4 @@
FROM funcy/go
FROM fnproject/go
ADD func .

View File

@@ -36,7 +36,7 @@ docker push $USERNAME/func-redis
./test.sh
```
## Running it on Oracle Functions
## Running it on Fn
### Let's define some environment variables
@@ -53,7 +53,7 @@ REDIS=YOUR_REDIS_ADDRESS
REDIS_AUTH=REDIS_AUTH_KEY
```
### Running with Oracle Functions
### Running with Fn
With this command we are going to create an application with name `redis`.
@@ -101,7 +101,7 @@ curl -X POST --data '{
#### Testing function
Now that we created our Oracle Functions route, let's test our new route
Now that we created our Fn route, let's test our new route
```
curl -X POST --data '{"key": "name", "value": "Johnny"}' http://$FUNCAPI/r/redis/set

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
# build image
docker run --rm -v "$PWD":/go/src/$FUNCPKG -w /go/src/$FUNCPKG funcy/go:dev go build -o func
docker run --rm -v "$PWD":/go/src/$FUNCPKG -w /go/src/$FUNCPKG fnproject/go:dev go build -o func
docker build -t username/func-redis .

View File

@@ -1,4 +1,4 @@
package: github.com/treeder/functions/examples/redis
package: github.com/fnproject/functions/examples/redis
import:
- package: github.com/garyburd/redigo
version: ^1.0.0

View File

@@ -1,6 +1,6 @@
## Quick Example for a SlackBot command in Ruby
This example will show you how to test and deploy a SlackBot command to Oracle Functions.
This example will show you how to test and deploy a SlackBot command to Fn.
```sh
# create your func.yaml file
@@ -11,7 +11,7 @@ fn build
cat slack.payload | fn run
# push it to Docker Hub
fn push
# Create a route to this function on Oracle Functions
# Create a route to this function on Fn
fn routes create slackbot /guppy
# Change the route response header content-type to application/json
fn routes headers set slackbot /guppy Content-Type application/json
@@ -21,7 +21,7 @@ cat slack.payload | fn call slackbot /guppy
## Create a Slash Command integration in Slack
In Slack, go to Integrations, find Slash Commands, click Add, type in / as the command then click Add again. On the next page, take the Oracle Functions route URL and paste it into the URL field then click Save Integration.
In Slack, go to Integrations, find Slash Commands, click Add, type in / as the command then click Add again. On the next page, take the Fn route URL and paste it into the URL field then click Save Integration.
If running in localhost, use [ngrok](https://github.com/inconshreveable/ngrok).

View File

@@ -1,4 +1,4 @@
# Example of Oracle Functions test framework - running functions locally
# Example of Fn test framework - running functions locally
This example will show you how to run a test suite on a function.

View File

@@ -1,4 +1,4 @@
# Example of Oracle Functions test framework - running functions remotely
# Example of Fn test framework - running functions remotely
This example will show you how to run a test suite on a function.

View File

@@ -14,7 +14,7 @@ fn run
# Now try with an input
cat sample.payload.json | fn run
# Deploy your functions to the Oracle Functions server (default localhost:8080)
# Deploy your functions to the Fn server (default localhost:8080)
# This will create a route to your function as well
fn deploy --app myapp
```

View File

@@ -1,6 +1,6 @@
# Tutorial 1: Go Function w/ Input (3 minutes)
This example will show you how to test and deploy Go (Golang) code to Oracle Functions. It will also demonstrate passing data in through stdin.
This example will show you how to test and deploy Go (Golang) code to Fn. It will also demonstrate passing data in through stdin.
### First, run the following commands:
@@ -14,7 +14,7 @@ fn run
# Now try with an input
cat sample.payload.json | fn run
# Deploy your functions to the Oracle Functions server (default localhost:8080)
# Deploy your functions to the Fn server (default localhost:8080)
# This will create a route to your function as well
fn deploy --app myapp
```

View File

@@ -1,6 +1,6 @@
# Tutorial 1.2: Go Function w/ Input And Vendor Folder. (3 minutes)
This example will show you how to test and deploy Go (Golang) code with vendored Dependencies to Oracle Functions. It will also demonstrate passing data in through stdin.
This example will show you how to test and deploy Go (Golang) code with vendored Dependencies to Fn. It will also demonstrate passing data in through stdin.
### First, run the following commands:
@@ -17,7 +17,7 @@ fn run
# Now try with an input
cat sample.payload.json | fn run
# Deploy your functions to the Oracle Functions server (default localhost:8080)
# Deploy your functions to the Fn server (default localhost:8080)
# This will create a route to your function as well
fn deploy --app myapp
```

View File

@@ -1,5 +1,5 @@
# Oracle Functions: Java
This example will show you how to test and deploy Java code to Oracle Functions. It will also demonstrate passing data in through stdin.
# Fn: Java
This example will show you how to test and deploy Java code to Fn. It will also demonstrate passing data in through stdin.
### First, run the following commands:
@@ -13,7 +13,7 @@ fn run
# Now try with an input
echo "Michael FassBender" | fn run
# Deploy your functions to the Oracle Functions server (default localhost:8080)
# Deploy your functions to the Fn server (default localhost:8080)
# This will create a route to your function as well
fn deploy --app myapp
```

View File

@@ -1,6 +1,6 @@
# Tutorial 1: NodeJS Function w/ Input (3 minutes)
This example will show you how to test and deploy Node code to Oracle Functions. It will also demonstrate passing data in through stdin.
This example will show you how to test and deploy Node code to Fn. It will also demonstrate passing data in through stdin.
### First, run the following commands:
@@ -15,7 +15,7 @@ fn run
# Now try with an input
cat sample.payload.json | fn run
# Deploy your functions to the Oracle Functions server (default localhost:8080)
# Deploy your functions to the Fn server (default localhost:8080)
# This will create a route to your function as well
fn deploy --app myapp
```
@@ -33,7 +33,7 @@ And now with the JSON input:
curl -H "Content-Type: application/json" -X POST -d @sample.payload.json http://localhost:8080/r/myapp/hello-node
```
That's it! Our `fn deploy` packaged our function and sent it to the Oracle Functions server. Try editing `func.js`
That's it! Our `fn deploy` packaged our function and sent it to the Fn server. Try editing `func.js`
and then doing another `fn deploy`.
### Note on Dependencies

View File

@@ -1,6 +1,6 @@
# Tutorial 1: PHP Function w/ Input (3 minutes)
This example will show you how to test and deploy PHP code to Oracle Functions. It will also demonstrate passing data in through stdin.
This example will show you how to test and deploy PHP code to Fn. It will also demonstrate passing data in through stdin.
### First, run the following commands:
@@ -15,7 +15,7 @@ fn run
# Now try with an input
cat sample.payload.json | fn run
# Deploy your functions to the Oracle Functions server (default localhost:8080)
# Deploy your functions to the Fn server (default localhost:8080)
# This will create a route to your function as well
fn deploy --app myapp
```
@@ -33,7 +33,7 @@ And now with the JSON input:
curl -H "Content-Type: application/json" -X POST -d @sample.payload.json http://localhost:8080/r/myapp/hello-php
```
That's it! Our `fn deploy` packaged our function and sent it to the Oracle Functions server. Try editing `func.php`
That's it! Our `fn deploy` packaged our function and sent it to the Fn server. Try editing `func.php`
and then doing another `fn deploy`.
### Note on Dependencies

View File

@@ -1,6 +1,6 @@
# Tutorial 1: Python Function w/ Input (3 minutes)
This example will show you how to test and deploy Python code to Oracle Functions. It will also demonstrate passing data in through stdin.
This example will show you how to test and deploy Python code to Fn. It will also demonstrate passing data in through stdin.
### First, run the following commands:
@@ -15,7 +15,7 @@ fn run
# Now try with an input
cat sample.payload.json | fn run
# Deploy your functions to the Oracle Functions server (default localhost:8080)
# Deploy your functions to the Fn server (default localhost:8080)
# This will create a route to your function as well
fn deploy --app myapp
```
@@ -33,7 +33,7 @@ And now with the JSON input:
curl -H "Content-Type: application/json" -X POST -d @sample.payload.json http://localhost:8080/r/myapp/hello-python
```
That's it! Our `fn deploy` packaged our function and sent it to the Oracle Functions server. Try editing `func.py`
That's it! Our `fn deploy` packaged our function and sent it to the Fn server. Try editing `func.py`
and then doing another `fn deploy`.
### Note on Dependencies

View File

@@ -1,6 +1,6 @@
# Tutorial 1: Ruby Function w/ Input (3 minutes)
This example will show you how to test and deploy Ruby code to Oracle Functions. It will also demonstrate passing data in through stdin.
This example will show you how to test and deploy Ruby code to Fn. It will also demonstrate passing data in through stdin.
### First, run the following commands:
@@ -15,7 +15,7 @@ fn run
# Now try with an input
cat sample.payload.json | fn run
# Deploy your functions to the Oracle Functions server (default localhost:8080)
# Deploy your functions to the Fn server (default localhost:8080)
# This will create a route to your function as well
fn deploy --app myapp
```
@@ -33,7 +33,7 @@ And now with the JSON input:
curl -H "Content-Type: application/json" -X POST -d @sample.payload.json http://localhost:8080/r/myapp/hello-ruby
```
That's it! Our `fn deploy` packaged our function and sent it to the Oracle Functions server. Try editing `func.rb`
That's it! Our `fn deploy` packaged our function and sent it to the Fn server. Try editing `func.rb`
and then doing another `fn deploy`.

View File

@@ -1,6 +1,6 @@
# Tutorial 1: Rust Function w/ Input (3 minutes)
This example will show you how to test and deploy Rust code to Oracle Functions. It will also demonstrate passing data in through stdin.
This example will show you how to test and deploy Rust code to Fn. It will also demonstrate passing data in through stdin.
The easiest way to create a function in rust is via ***cargo*** and ***fn***.
@@ -42,7 +42,7 @@ fn run
# Now try with an input (copy sample.payload.json from this repo)
cat sample.payload.json | fn run
# Deploy your functions to the Oracle Functions server (default localhost:8080)
# Deploy your functions to the Fn server (default localhost:8080)
# This will create a route to your function as well
fn deploy --app myapp
```

View File

@@ -9,7 +9,7 @@ Install the CLI tool, start a Fn server and run `docker login` to login to Docke
Set your Docker Hub username
```sh
export FN_REGISTRY=<DOCKERHUB_USERNAME>
export Fn_REGISTRY=<DOCKERHUB_USERNAME>
```
Build and deploy the function to the Fn server (default localhost:8080)

View File

@@ -1,8 +1,8 @@
FROM funcy/go:dev as build-stage
FROM fnproject/go:dev as build-stage
WORKDIR /function
ADD . /src
RUN cd /src && go build -o func
FROM funcy/go
FROM fnproject/go
WORKDIR /function
COPY --from=build-stage /src/func /function/
ENTRYPOINT ["./func"]

View File

@@ -1,4 +1,4 @@
name: funcy/stderr-logging
name: fnproject/stderr-logging
version: 0.0.1
runtime: go
entrypoint: ./func

View File

@@ -1,4 +1,4 @@
FROM funcy/go
FROM fnproject/go
ADD func .

View File

@@ -4,7 +4,7 @@ This function exemplifies an authentication in Twitter API and get latest tweets
## Requirements
- Oracle Functions API
- Fn API
- Configure a [Twitter App](https://apps.twitter.com/) and [configure Customer Access and Access Token](https://dev.twitter.com/oauth/overview/application-owner-access-tokens).
## Development
@@ -36,7 +36,7 @@ docker push $USERNAME/func-twitter
./test.sh
```
## Running it on Oracle Functions
## Running it on Fn
### Let's define some environment variables
@@ -51,7 +51,7 @@ ACCESS_TOKEN="XXXXXX"
ACCESS_SECRET="XXXXXX"
```
### Running with Oracle Functions
### Running with Fn
With this command we are going to create an application with name `twitter`.
@@ -82,7 +82,7 @@ curl -X POST --data '{
#### Testing function
Now that we created our Oracle Functions route, let's test our new route
Now that we created our Fn route, let's test our new route
```
curl -X POST --data '{"username": "getiron"}' http://$FUNCAPI/r/twitter/tweets

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
# build image
docker run --rm -v "$PWD":/go/src/$FUNCPKG -w /go/src/$FUNCPKG funcy/go:dev go build -o func
docker run --rm -v "$PWD":/go/src/$FUNCPKG -w /go/src/$FUNCPKG fnproject/go:dev go build -o func
docker build -t username/func-twitter .

View File

@@ -1,4 +1,4 @@
package: github.com/treeder/functions/examples/twitter
package: github.com/fnproject/functions/examples/twitter
import:
- package: github.com/dghubble/go-twitter
subpackages:

View File

@@ -5,9 +5,9 @@ build:
go build
docker-build:
docker pull funcy/go:dev
docker pull fnproject/go:dev
docker run --rm -v ${GOPATH}/src/github.com/fnproject/fn:/go/src/github.com/fnproject/fn \
-w /go/src/github.com/fnproject/fn/fnlb funcy/go:dev go build -o fnlb-alpine
-w /go/src/github.com/fnproject/fn/fnlb fnproject/go:dev go build -o fnlb-alpine
docker build --build-arg HTTP_PROXY -t fnproject/fnlb:latest .
all: build

View File

@@ -1,7 +1,7 @@
# Oracle Functions LoadBalancer
# Fn LoadBalancer
## Loadbalancing several Oracle Functions
You can run multiple Oracle Functions instances and balance the load amongst them using `fnlb` as follows:
## Loadbalancing several Fn
You can run multiple Fn instances and balance the load amongst them using `fnlb` as follows:
```sh
fnlb --listen <address-for-incoming> --nodes <node1>,<node2>,<node3>
@@ -23,15 +23,15 @@ To start the `fnlb` proxy with the addresses of functions nodes in a docker
container:
```sh
docker run -d --name fnlb -p 8081:8081 funcy/fnlb:latest --nodes <node1>,<node2>
docker run -d --name fnlb -p 8081:8081 fnproject/fnlb:latest --nodes <node1>,<node2>
```
If running locally with functions servers in docker, running with docker links
can make things easier (can use local addresses). for example:
```sh
docker run -d --name fn-8080 --privileged -p 8080:8080 funcy/functions:latest
docker run -d --name fnlb --link fn-8080 -p 8081:8081 funcy/fnlb:latest --nodes 127.0.0.1:8080
docker run -d --name fn-8080 --privileged -p 8080:8080 fnproject/functions:latest
docker run -d --name fnlb --link fn-8080 -p 8081:8081 fnproject/fnlb:latest --nodes 127.0.0.1:8080
```
## Operating / usage

View File

@@ -46,10 +46,6 @@ import:
- package: github.com/go-sql-driver/mysql
version: 21d7e97c9f760ca685a01ecea202e1c84276daa1
- package: github.com/google/btree
- package: github.com/iron-io/iron_go3
subpackages:
- config
- mq
- package: github.com/jmoiron/jsonq
- package: github.com/lib/pq
- package: github.com/docker/docker

View File

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

View File

@@ -4,7 +4,7 @@ ADD . /src
RUN cd /src && go build -o goapp
# final stage
FROM funcy/base
FROM fnproject/base
WORKDIR /app
COPY --from=build-env /src/goapp /app/
ENTRYPOINT ./goapp

View File

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

View File

@@ -1,4 +1,4 @@
Oracle Functions integration API tests
FN integration API tests
======================================
@@ -7,7 +7,7 @@ Test dependencies
```bash
DOCKER_HOST - for building images
API_URL - Oracle Functions API endpoint
API_URL - Fn API endpoint
```
How to run tests?

View File

@@ -1,8 +1,8 @@
FROM funcy/go:dev as build-stage
FROM fnproject/go:dev as build-stage
WORKDIR /function
ADD . /src
RUN cd /src && go build -o func
FROM funcy/go
FROM fnproject/go
WORKDIR /function
COPY --from=build-stage /src/func /function/
ENTRYPOINT ["./func"]

View File

@@ -1,8 +1,8 @@
FROM funcy/go:dev as build-stage
FROM fnproject/go:dev as build-stage
WORKDIR /function
ADD . /src
RUN cd /src && go build -o func
FROM funcy/go
FROM fnproject/go
WORKDIR /function
COPY --from=build-stage /src/func /function/
ENTRYPOINT ["./func"]

View File

@@ -1,4 +1,4 @@
name: funcy/multi-log
name: fnproject/multi-log
version: 0.0.1
runtime: go
entrypoint: ./func

View File

@@ -1,8 +1,8 @@
FROM funcy/go:dev as build-stage
FROM fnproject/go:dev as build-stage
WORKDIR /function
ADD . /src
RUN cd /src && go build -o func
FROM funcy/go
FROM fnproject/go
WORKDIR /function
COPY --from=build-stage /src/func /function/
ENTRYPOINT ["./func"]

View File

@@ -1,7 +1,7 @@
# fnlb-test-harness
Test harness that exercises the fnlb load balancer in order to verify that it works properly.
## How it works
This is a test harness that makes calls to an Oracle Functions route through the fnlb load balancer, which routes traffic to multiple Oracle Functions nodes.
This is a test harness that makes calls to an Fn route through the fnlb load balancer, which routes traffic to multiple Fn nodes.
The test harness keeps track of which node each request was routed to so we can assess how the requests are being distributed across the nodes. The functionality
of fnlb is to normally route traffic to the same small number of nodes so that efficiences can be achieved and to support reuse of hot functions.
### Primes function
@@ -14,25 +14,25 @@ where:
- *loops*: number of times to calculate the primes (repeating the count consumes additional CPU without consuming additional memory)
## How to use it
The test harness requires running one or more Oracle Functions nodes and one instance of fnlb. The list of nodes must be provided both to fnlb and to the test harness
The test harness requires running one or more Fn nodes and one instance of fnlb. The list of nodes must be provided both to fnlb and to the test harness
because the test harness must call each node directly one time in order to discover the node's container id.
After it has run, examine the results to see how the requests were distributed across the nodes.
### How to run it locally
Each of the Oracle Functions nodes needs to connect to the same database.
Each of the Fn nodes needs to connect to the same database.
STEP 1: Create a route for the primes function. Example:
```
fn apps create primesapp
fn routes create primesapp /primes jconning/primes:0.0.1
```
STEP 2: Run five Oracle Functions nodes locally. Example (runs five nodes in the background using Docker):
STEP 2: Run five Fn nodes locally. Example (runs five nodes in the background using Docker):
```
sudo docker run -d -it --name functions-8082 --privileged -v ${HOME}/data-8082:/app/data -p 8082:8080 -e "DB_URL=postgres://dbUser:dbPassword@dbHost:5432/dbName" treeder/functions
sudo docker run -d -it --name functions-8083 --privileged -v ${HOME}/data-8083:/app/data -p 8083:8080 -e "DB_URL=postgres://dbUser:dbPassword@dbHost:5432/dbName" treeder/functions
sudo docker run -d -it --name functions-8084 --privileged -v ${HOME}/data-8084:/app/data -p 8084:8080 -e "DB_URL=postgres://dbUser:dbPassword@dbHost:5432/dbName" treeder/functions
sudo docker run -d -it --name functions-8085 --privileged -v ${HOME}/data-8085:/app/data -p 8085:8080 -e "DB_URL=postgres://dbUser:dbPassword@dbHost:5432/dbName" treeder/functions
sudo docker run -d -it --name functions-8086 --privileged -v ${HOME}/data-8086:/app/data -p 8086:8080 -e "DB_URL=postgres://dbUser:dbPassword@dbHost:5432/dbName" treeder/functions
sudo docker run -d -it --name functions-8082 --privileged -v ${HOME}/data-8082:/app/data -p 8082:8080 -e "DB_URL=postgres://dbUser:dbPassword@dbHost:5432/dbName" fnproject/functions
sudo docker run -d -it --name functions-8083 --privileged -v ${HOME}/data-8083:/app/data -p 8083:8080 -e "DB_URL=postgres://dbUser:dbPassword@dbHost:5432/dbName" fnproject/functions
sudo docker run -d -it --name functions-8084 --privileged -v ${HOME}/data-8084:/app/data -p 8084:8080 -e "DB_URL=postgres://dbUser:dbPassword@dbHost:5432/dbName" fnproject/functions
sudo docker run -d -it --name functions-8085 --privileged -v ${HOME}/data-8085:/app/data -p 8085:8080 -e "DB_URL=postgres://dbUser:dbPassword@dbHost:5432/dbName" fnproject/functions
sudo docker run -d -it --name functions-8086 --privileged -v ${HOME}/data-8086:/app/data -p 8086:8080 -e "DB_URL=postgres://dbUser:dbPassword@dbHost:5432/dbName" fnproject/functions
```
STEP 3: Run fnlb locally. Example (runs fnlb on the default port 8081):
```

View File

@@ -107,7 +107,7 @@ func invokeLoadBalancer(hostPort, path string, numExecutions, max, loops int) {
func discoverContainerIds() {
// Discover the Docker hostname of each node; create a mapping of hostnames to host/port.
// This is needed because Oracle Functions doesn't make the host/port available to the function (as of Mar 2017).
// This is needed because FN doesn't make the host/port available to the function (as of Mar 2017).
fmt.Println("Discovering container ids for every node (use Docker's HOSTNAME env var as a container id)...")
for _, s := range nodes {
if e, err := executeFunction(s, route, 100, 1); err == nil {