diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d9d067194..e88c9ca37 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ -# Contributing to Oracle Functions +# Contributing to Fn We welcome all contributions! @@ -32,7 +32,7 @@ The first time after you fork or after dependencies get updated, run: make dep ``` -Then after every change, run +Then after every change, run ```sh make run diff --git a/Makefile b/Makefile index 5ae5448dd..eac577768 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/README.md b/README.md index c251c1770..eda73928b 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ Now run the following CLI commands: fn init # Set your Docker Hub username -export FN_REGISTRY= +export Fn_REGISTRY= # Test your function # This will run inside a container exactly how it will on the server diff --git a/api/mqs/ironmq.go b/api/mqs/ironmq.go deleted file mode 100644 index 792289368..000000000 --- a/api/mqs/ironmq.go +++ /dev/null @@ -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 -} diff --git a/api/mqs/new.go b/api/mqs/new.go index 0f46af388..803f55d64 100644 --- a/api/mqs/new.go +++ b/api/mqs/new.go @@ -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) } diff --git a/build.ps1 b/build.ps1 index 5fd40a214..a2abb27e4 100644 --- a/build.ps1 +++ b/build.ps1 @@ -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) diff --git a/clients/build.rb b/clients/build.rb index f0853f231..b80e16145 100644 --- a/clients/build.rb +++ b/clients/build.rb @@ -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}" @@ -83,7 +83,7 @@ languages.each do |l| clone_dir = clone(l) end p options - lv = "#{lshort}-#{version}" + lv = "#{lshort}-#{version}" destdir = "tmp/fn_#{lshort}" if l == 'go' # This is using https://goswagger.io/ instead @@ -126,7 +126,7 @@ languages.each do |l| stream_exec "git commit -am \"Updated to api version #{version}\"" begin stream_exec "git tag -a #{version} -m \"Version #{version}\"" - rescue => ex + rescue => ex puts "WARNING: Tag #{version} already exists." end stream_exec "git push --follow-tags" diff --git a/docs/README.md b/docs/README.md index cd0a6b133..74995fec3 100644 --- a/docs/README.md +++ b/docs/README.md @@ -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) diff --git a/docs/faq.md b/docs/faq.md index cee842ed2..9b45c690d 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -2,20 +2,20 @@ ## Which languages are supported? -Since we use containers as the base building block, all languages can be used. There may not be higher level -helper libraries like our Lambda wrapper for every language, but you can use any language if you follow the +Since we use containers as the base building block, all languages can be used. There may not be higher level +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, +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 needed. For instance, we may add rkt support. diff --git a/docs/lambda/README.md b/docs/lambda/README.md index bea05608d..dc7861fc1 100644 --- a/docs/lambda/README.md +++ b/docs/lambda/README.md @@ -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 @@ -14,4 +14,4 @@ fn init --runtime lambda-node-4 --name lambda-node Be sure the filename for your main handler is `func.js`. -TODO: Make Java and Python use the new workflow too. +TODO: Make Java and Python use the new workflow too. diff --git a/docs/lambda/create.md b/docs/lambda/create.md index 1d2a8bdc9..a0bcb7a26 100644 --- a/docs/lambda/create.md +++ b/docs/lambda/create.md @@ -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 diff --git a/docs/lambda/environment.md b/docs/lambda/environment.md index 077172638..5c8aef82a 100644 --- a/docs/lambda/environment.md +++ b/docs/lambda/environment.md @@ -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. diff --git a/docs/lambda/import.md b/docs/lambda/import.md index 0538053a2..f94d47d8e 100644 --- a/docs/lambda/import.md +++ b/docs/lambda/import.md @@ -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 `/`. This is used to uniquely identify images on Docker Hub. Please use the `/` as the image name with `aws-import` to create a correctly named image. @@ -54,4 +54,4 @@ You can then deploy the imported lambda as follows: ``` ./fn deploy --app myapp ```` -Now the function can be reached via ```http://$HOSTNAME/r/user/my-function``` \ No newline at end of file +Now the function can be reached via ```http://$HOSTNAME/r/user/my-function``` diff --git a/docs/operating/databases/boltdb.md b/docs/operating/databases/boltdb.md index 0f447b11e..c4c5eeab9 100644 --- a/docs/operating/databases/boltdb.md +++ b/docs/operating/databases/boltdb.md @@ -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 ``` diff --git a/docs/operating/databases/mysql.md b/docs/operating/databases/mysql.md index 3ea0689eb..cc579bf8e 100644 --- a/docs/operating/databases/mysql.md +++ b/docs/operating/databases/mysql.md @@ -1,4 +1,4 @@ -# Oracle Functions using Postgres +# Fn using Postgres Let's presuppose you don't have even a MySQL DB ready. @@ -6,8 +6,8 @@ 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 ``` diff --git a/docs/operating/databases/postgres.md b/docs/operating/databases/postgres.md index baca7af4e..b8cfd5ef9 100644 --- a/docs/operating/databases/postgres.md +++ b/docs/operating/databases/postgres.md @@ -1,27 +1,27 @@ -# 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 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 ``` diff --git a/docs/operating/extending.md b/docs/operating/extending.md index 941bfc4a7..0921f173b 100644 --- a/docs/operating/extending.md +++ b/docs/operating/extending.md @@ -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). \ No newline at end of file diff --git a/docs/operating/logging.md b/docs/operating/logging.md index 9df73fb2f..3ce8176f2 100644 --- a/docs/operating/logging.md +++ b/docs/operating/logging.md @@ -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 diff --git a/docs/operating/mqs/README.md b/docs/operating/mqs/README.md index b6f846dc1..2bad892f8 100644 --- a/docs/operating/mqs/README.md +++ b/docs/operating/mqs/README.md @@ -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. - diff --git a/docs/operating/options.md b/docs/operating/options.md index 283a3fa91..3077f4979 100644 --- a/docs/operating/options.md +++ b/docs/operating/options.md @@ -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 diff --git a/docs/operating/production.md b/docs/operating/production.md index e67b5f94a..a5b5c094a 100644 --- a/docs/operating/production.md +++ b/docs/operating/production.md @@ -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. diff --git a/docs/operating/routes.md b/docs/operating/routes.md index 2236ad479..b0b069d0a 100644 --- a/docs/operating/routes.md +++ b/docs/operating/routes.md @@ -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 diff --git a/docs/operating/scaling.md b/docs/operating/scaling.md index b0fdc5ee4..a82faae1f 100644 --- a/docs/operating/scaling.md +++ b/docs/operating/scaling.md @@ -1,2 +1,2 @@ -# Scaling Oracle Functions +# Scaling Fn diff --git a/docs/operating/triggers.md b/docs/operating/triggers.md index 180ffaeca..9f24c2c3f 100644 --- a/docs/operating/triggers.md +++ b/docs/operating/triggers.md @@ -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 diff --git a/docs/operating/ui.md b/docs/operating/ui.md index dc35dfa9e..05f33dc4e 100644 --- a/docs/operating/ui.md +++ b/docs/operating/ui.md @@ -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 diff --git a/docs/operating/windows.md b/docs/operating/windows.md index 3c03a83df..ddfa094e7 100644 --- a/docs/operating/windows.md +++ b/docs/operating/windows.md @@ -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. diff --git a/docs/serverless.md b/docs/serverless.md index f9ab8624a..f18b688ac 100644 --- a/docs/serverless.md +++ b/docs/serverless.md @@ -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) diff --git a/docs/usage.md b/docs/usage.md index 68c37aa5d..a6716980e 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -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. diff --git a/docs/writing.md b/docs/writing.md index 8ee61e56e..8d390023e 100644 --- a/docs/writing.md +++ b/docs/writing.md @@ -1,5 +1,5 @@ # Writing Functions - + This will give you the basic overview of writing base level functions. You can also use higher level abstractions that make it easier such as [lambda](lambda/README.md). @@ -34,11 +34,11 @@ You will also have access to a set of environment variables. * `FN_PATH` - the matched route, eg: `/hello` * `FN_METHOD` - the HTTP method for the request, eg: `GET` or `POST` * `FN_CALL_ID` - a unique ID for each function execution. -* `FN_FORMAT` - a string representing one of the [function formats](function-format.md), currently either `default` or `http`. Default is `default`. +* `FN_FORMAT` - a string representing one of the [function formats](function-format.md), currently either `default` or `http`. Default is `default`. * `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 @@ -87,7 +87,7 @@ fn init --runtime lambda-node --name lambda-node Be sure the filename for your main handler is `func.js`. -TODO: Make Java and Python use the new workflow too. +TODO: Make Java and Python use the new workflow too. ## Next Steps diff --git a/examples/Dockerfile.glide b/examples/Dockerfile.glide index c525a8438..3af7b739b 100644 --- a/examples/Dockerfile.glide +++ b/examples/Dockerfile.glide @@ -1,4 +1,4 @@ -FROM funcy/go:dev +FROM fnproject/go:dev RUN mkdir -p /go/src/github.com/Masterminds ENV GOPATH=/go diff --git a/examples/README.md b/examples/README.md index caa49f893..3de9385b7 100644 --- a/examples/README.md +++ b/examples/README.md @@ -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! diff --git a/examples/blog/README.md b/examples/blog/README.md index 4652206cf..5faaec9d1 100644 --- a/examples/blog/README.md +++ b/examples/blog/README.md @@ -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 diff --git a/examples/blog/build.sh b/examples/blog/build.sh index 663610afd..2ffcea092 100755 --- a/examples/blog/build.sh +++ b/examples/blog/build.sh @@ -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 . diff --git a/examples/blog/glide.yaml b/examples/blog/glide.yaml index a2a6fe334..fb716eee2 100644 --- a/examples/blog/glide.yaml +++ b/examples/blog/glide.yaml @@ -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 diff --git a/examples/caddy-lb/README.md b/examples/caddy-lb/README.md index e46032477..738f61e40 100644 --- a/examples/caddy-lb/README.md +++ b/examples/caddy-lb/README.md @@ -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 diff --git a/examples/caddy-lb/docker-compose.yml b/examples/caddy-lb/docker-compose.yml index 582beee81..bee0a6758 100644 --- a/examples/caddy-lb/docker-compose.yml +++ b/examples/caddy-lb/docker-compose.yml @@ -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: diff --git a/examples/checker/Dockerfile b/examples/checker/Dockerfile index 61cec63cd..8c71de1c2 100644 --- a/examples/checker/Dockerfile +++ b/examples/checker/Dockerfile @@ -1,4 +1,4 @@ -FROM funcy/ruby:dev +FROM fnproject/ruby:dev WORKDIR /function ADD Gemfile* /function/ diff --git a/examples/checker/README.md b/examples/checker/README.md index 9847cd71f..ea4a1f007 100644 --- a/examples/checker/README.md +++ b/examples/checker/README.md @@ -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 diff --git a/examples/checker/function.rb b/examples/checker/function.rb index 9d5c5f218..89e577a7d 100644 --- a/examples/checker/function.rb +++ b/examples/checker/function.rb @@ -8,23 +8,23 @@ puts "payload #{payload}" p ENV if payload != "" payload = JSON.parse(payload) - + # payload contains checks - if payload["env_vars"] + if payload["env_vars"] payload["env_vars"].each do |k,v| - if ENV[k] != v + if ENV[k] != v raise "Env var #{k} does not match" end - end + end end 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) -if !uri.scheme.start_with?('http') +if !uri.scheme.start_with?('http') raise "invalid REQUEST_URL, does not start with http" end e = ENV["FN_METHOD"] diff --git a/examples/echo/Dockerfile b/examples/echo/Dockerfile index 5cd308034..7a2e9d2c3 100644 --- a/examples/echo/Dockerfile +++ b/examples/echo/Dockerfile @@ -1,4 +1,4 @@ -FROM funcy/ruby:dev +FROM fnproject/ruby:dev WORKDIR /function ADD Gemfile /function/ diff --git a/examples/echo/README.md b/examples/echo/README.md index 193edf9a1..97a529312 100644 --- a/examples/echo/README.md +++ b/examples/echo/README.md @@ -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 diff --git a/examples/hash/README.md b/examples/hash/README.md index 6e92d746b..c5626e82a 100644 --- a/examples/hash/README.md +++ b/examples/hash/README.md @@ -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 diff --git a/examples/middleware/README.md b/examples/middleware/README.md index 0f77044f5..35e41b12f 100644 --- a/examples/middleware/README.md +++ b/examples/middleware/README.md @@ -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 diff --git a/examples/postgres/README.md b/examples/postgres/README.md index 9bfeffcb8..637f9386c 100644 --- a/examples/postgres/README.md +++ b/examples/postgres/README.md @@ -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 --config SERVER= fn routes create --config TABLE= --config COMMAND=INSERT //insert fn routes create --config TABLE= --config COMMAND=SELECT //select ``` -Now you can call your function on Oracle Functions: +Now you can call your function on Fn: ``` echo | fn call ///insert diff --git a/examples/postgres/glide.yaml b/examples/postgres/glide.yaml index 7f6dcc8e6..13da41afd 100644 --- a/examples/postgres/glide.yaml +++ b/examples/postgres/glide.yaml @@ -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 diff --git a/examples/redis/Dockerfile b/examples/redis/Dockerfile index aa1c6aa99..7b8dc9aee 100644 --- a/examples/redis/Dockerfile +++ b/examples/redis/Dockerfile @@ -1,4 +1,4 @@ -FROM funcy/go +FROM fnproject/go ADD func . diff --git a/examples/redis/README.md b/examples/redis/README.md index 26f3fbbeb..d05e1cd7e 100644 --- a/examples/redis/README.md +++ b/examples/redis/README.md @@ -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 diff --git a/examples/redis/build.sh b/examples/redis/build.sh index 174e294c5..5568c1b15 100755 --- a/examples/redis/build.sh +++ b/examples/redis/build.sh @@ -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 . \ No newline at end of file diff --git a/examples/redis/glide.yaml b/examples/redis/glide.yaml index b180b07f3..4f8085aad 100644 --- a/examples/redis/glide.yaml +++ b/examples/redis/glide.yaml @@ -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 diff --git a/examples/slackbot/guppy/README.md b/examples/slackbot/guppy/README.md index ecbc773da..c6009e5f6 100644 --- a/examples/slackbot/guppy/README.md +++ b/examples/slackbot/guppy/README.md @@ -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). diff --git a/examples/testframework/local/README.md b/examples/testframework/local/README.md index 94b0bdbcf..d24e5a71a 100644 --- a/examples/testframework/local/README.md +++ b/examples/testframework/local/README.md @@ -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. diff --git a/examples/testframework/remote/README.md b/examples/testframework/remote/README.md index f4ee674d8..e29d2a89e 100644 --- a/examples/testframework/remote/README.md +++ b/examples/testframework/remote/README.md @@ -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. diff --git a/examples/tutorial/async/go/README.md b/examples/tutorial/async/go/README.md index 49d6a9fad..e72a12c7d 100644 --- a/examples/tutorial/async/go/README.md +++ b/examples/tutorial/async/go/README.md @@ -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 ``` diff --git a/examples/tutorial/hello/go/README.md b/examples/tutorial/hello/go/README.md index 2e59ba40c..2edfad6e7 100644 --- a/examples/tutorial/hello/go/README.md +++ b/examples/tutorial/hello/go/README.md @@ -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 ``` diff --git a/examples/tutorial/hello/go/usingdeps/README.md b/examples/tutorial/hello/go/usingdeps/README.md index a176f9ad3..fc4ce8bd0 100644 --- a/examples/tutorial/hello/go/usingdeps/README.md +++ b/examples/tutorial/hello/go/usingdeps/README.md @@ -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 ``` diff --git a/examples/tutorial/hello/java/README.md b/examples/tutorial/hello/java/README.md index ba4af2c5b..b2dbe2da6 100644 --- a/examples/tutorial/hello/java/README.md +++ b/examples/tutorial/hello/java/README.md @@ -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 ``` diff --git a/examples/tutorial/hello/node/README.md b/examples/tutorial/hello/node/README.md index 3fa6650e2..1da9b7873 100644 --- a/examples/tutorial/hello/node/README.md +++ b/examples/tutorial/hello/node/README.md @@ -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 diff --git a/examples/tutorial/hello/php/README.md b/examples/tutorial/hello/php/README.md index d91f3a6ff..d5642117c 100644 --- a/examples/tutorial/hello/php/README.md +++ b/examples/tutorial/hello/php/README.md @@ -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 diff --git a/examples/tutorial/hello/python/README.md b/examples/tutorial/hello/python/README.md index 7ee2f2d8f..493a50a33 100644 --- a/examples/tutorial/hello/python/README.md +++ b/examples/tutorial/hello/python/README.md @@ -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 diff --git a/examples/tutorial/hello/ruby/README.md b/examples/tutorial/hello/ruby/README.md index 5631d293e..9deb97d22 100644 --- a/examples/tutorial/hello/ruby/README.md +++ b/examples/tutorial/hello/ruby/README.md @@ -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`. diff --git a/examples/tutorial/hello/rust/README.md b/examples/tutorial/hello/rust/README.md index 4f46b153f..1ec537175 100644 --- a/examples/tutorial/hello/rust/README.md +++ b/examples/tutorial/hello/rust/README.md @@ -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 ``` diff --git a/examples/tutorial/hotfunctions/http/go/README.md b/examples/tutorial/hotfunctions/http/go/README.md index 6b3560a70..1a118098d 100644 --- a/examples/tutorial/hotfunctions/http/go/README.md +++ b/examples/tutorial/hotfunctions/http/go/README.md @@ -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= +export Fn_REGISTRY= ``` Build and deploy the function to the Fn server (default localhost:8080) diff --git a/examples/tutorial/logging/Dockerfile b/examples/tutorial/logging/Dockerfile index 162432515..1c1b324fd 100644 --- a/examples/tutorial/logging/Dockerfile +++ b/examples/tutorial/logging/Dockerfile @@ -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"] diff --git a/examples/tutorial/logging/func.yaml b/examples/tutorial/logging/func.yaml index 61995f938..b029fed6b 100644 --- a/examples/tutorial/logging/func.yaml +++ b/examples/tutorial/logging/func.yaml @@ -1,4 +1,4 @@ -name: funcy/stderr-logging +name: fnproject/stderr-logging version: 0.0.1 runtime: go entrypoint: ./func diff --git a/examples/twitter/Dockerfile b/examples/twitter/Dockerfile index aa1c6aa99..7b8dc9aee 100644 --- a/examples/twitter/Dockerfile +++ b/examples/twitter/Dockerfile @@ -1,4 +1,4 @@ -FROM funcy/go +FROM fnproject/go ADD func . diff --git a/examples/twitter/README.md b/examples/twitter/README.md index e299dcded..9bced9c1c 100644 --- a/examples/twitter/README.md +++ b/examples/twitter/README.md @@ -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 diff --git a/examples/twitter/build.sh b/examples/twitter/build.sh index 881b1b8a0..a188c1c5c 100755 --- a/examples/twitter/build.sh +++ b/examples/twitter/build.sh @@ -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 . diff --git a/examples/twitter/glide.yaml b/examples/twitter/glide.yaml index 81eaf0ccf..d7a1474b7 100644 --- a/examples/twitter/glide.yaml +++ b/examples/twitter/glide.yaml @@ -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: diff --git a/fnlb/Makefile b/fnlb/Makefile index fbbe9e277..b2840cb03 100644 --- a/fnlb/Makefile +++ b/fnlb/Makefile @@ -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 diff --git a/fnlb/README.md b/fnlb/README.md index 63d08ed6e..c88c810fe 100644 --- a/fnlb/README.md +++ b/fnlb/README.md @@ -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 --nodes ,, @@ -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 , +docker run -d --name fnlb -p 8081:8081 fnproject/fnlb:latest --nodes , ``` 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 diff --git a/glide.yaml b/glide.yaml index 3e4ebecf6..6aeb01076 100644 --- a/glide.yaml +++ b/glide.yaml @@ -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 diff --git a/images/error/Dockerfile b/images/error/Dockerfile index 5beecb496..cf4699ac2 100644 --- a/images/error/Dockerfile +++ b/images/error/Dockerfile @@ -1,4 +1,4 @@ -FROM funcy/ruby:dev +FROM fnproject/ruby:dev WORKDIR /function ADD Gemfile* /function/ diff --git a/images/hello/Dockerfile b/images/hello/Dockerfile index 6ee6fc7b6..3d9e57cce 100644 --- a/images/hello/Dockerfile +++ b/images/hello/Dockerfile @@ -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 diff --git a/images/sleeper/Dockerfile b/images/sleeper/Dockerfile index 5beecb496..cf4699ac2 100644 --- a/images/sleeper/Dockerfile +++ b/images/sleeper/Dockerfile @@ -1,4 +1,4 @@ -FROM funcy/ruby:dev +FROM fnproject/ruby:dev WORKDIR /function ADD Gemfile* /function/ diff --git a/test/fn-api-tests/README.md b/test/fn-api-tests/README.md index 3b8dbd072..a541554f6 100644 --- a/test/fn-api-tests/README.md +++ b/test/fn-api-tests/README.md @@ -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? diff --git a/test/fn-api-tests/fn/log/Dockerfile b/test/fn-api-tests/fn/log/Dockerfile index 162432515..1c1b324fd 100644 --- a/test/fn-api-tests/fn/log/Dockerfile +++ b/test/fn-api-tests/fn/log/Dockerfile @@ -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"] diff --git a/test/fn-api-tests/fn/multi-log/Dockerfile b/test/fn-api-tests/fn/multi-log/Dockerfile index 162432515..1c1b324fd 100644 --- a/test/fn-api-tests/fn/multi-log/Dockerfile +++ b/test/fn-api-tests/fn/multi-log/Dockerfile @@ -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"] diff --git a/test/fn-api-tests/fn/multi-log/func.yaml b/test/fn-api-tests/fn/multi-log/func.yaml index 7dbac8d96..2da938b93 100644 --- a/test/fn-api-tests/fn/multi-log/func.yaml +++ b/test/fn-api-tests/fn/multi-log/func.yaml @@ -1,4 +1,4 @@ -name: funcy/multi-log +name: fnproject/multi-log version: 0.0.1 runtime: go entrypoint: ./func diff --git a/test/fn-api-tests/fn/timeout/Dockerfile b/test/fn-api-tests/fn/timeout/Dockerfile index 162432515..1c1b324fd 100644 --- a/test/fn-api-tests/fn/timeout/Dockerfile +++ b/test/fn-api-tests/fn/timeout/Dockerfile @@ -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"] diff --git a/test/fnlb-test-harness/README.md b/test/fnlb-test-harness/README.md index ab0978ff1..09f4ce391 100644 --- a/test/fnlb-test-harness/README.md +++ b/test/fnlb-test-harness/README.md @@ -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): ``` diff --git a/test/fnlb-test-harness/main.go b/test/fnlb-test-harness/main.go index bfe317a96..d4ecc4ad0 100644 --- a/test/fnlb-test-harness/main.go +++ b/test/fnlb-test-harness/main.go @@ -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 {