readme cleanup and simplification

This commit is contained in:
Chad Arimura
2017-05-25 10:40:53 -07:00
parent 8899361545
commit 235a8219c2

104
README.md
View File

@@ -1,13 +1,8 @@
# Oracle Functions
[![GoDoc](https://godoc.org/github.com/treeder/functions?status.svg)](https://godoc.org/github.com/treeder/functions)
<!-- [![GoDoc](https://godoc.org/github.com/treeder/functions?status.svg)](https://godoc.org/github.com/treeder/functions) -->
Welcome to Oracle Functions! The open source serverless platform.
## What is Oracle Functions?
Oracle Functions is an open source [serverless](serverless.md) platform, or as we like to refer to it, Functions as a
Service (FaaS) platform that you can run anywhere.
Oracle Functions is an open source [serverless](serverless.md) platform, or as we like to refer to it, Functions as a Service (FaaS) platform that you can run anywhere. Some of it's key features:
* Write once
* [Any language](docs/faq.md#which-languages-are-supported)
@@ -19,20 +14,19 @@ Service (FaaS) platform that you can run anywhere.
* Easy to manage [for operators](docs/README.md#for-operators)
* Written in [Go](https://golang.org)
## Join Our Community
TODO: Slack or Discord community.
## Prequisites
* Docker 17.05 or later installed and running
* Logged into Docker Hub (`docker login`)
## Installation
## Usage
The following instructions apply while the project is a private repo. They'll
build Oracle Functions and the CLI tool directly from the repo instead of
using pre-built containers. Will be much easier once public.
### Installation
NOTE: The following instructions apply while the project is a private repo. This will
build the Functions server and the CLI tool directly from the repo instead of
using pre-built containers. Once the project is public, these steps will be unnecessary.
```sh
# Build and Install CLI tool
@@ -71,63 +65,75 @@ configuration options [here](docs/operating/options.md). If you are on Windows,
-->
### Write a Function
### Writing Your First Function
Functions are small, bite sized bits of code that do one simple thing. Forget about monoliths when using functions,
just focus on the task that you want the function to perform.
Functions are small but powerful blocks of code that generally do one simple thing. Forget about monoliths when using functions, just focus on the task that you want the function to perform.
The following is a Go function that just returns "Hello ${NAME}!":
Start with this readme tutorial, and then you can learn more about function best practices in
our section [Writing Functions](docs/writing.md).
The following is a simple Go program that outputs a string to STDOUT. Copy and paste the code below into a file called `func.go`.
```go
package main
import (
"encoding/json"
"fmt"
"os"
)
type Person struct {
Name string
}
func main() {
p := &Person{Name: "World"}
json.NewDecoder(os.Stdin).Decode(p)
fmt.Printf("Hello %v!", p.Name)
fmt.Println("Boom. Oracle Functions.")
}
```
Copy and paste the code above into a file called `func.go`, then run the following commands to build your function
and deploy it.
Now run the following commands to build your function and deploy it:
```sh
# Initilize your function, replace $USERNAME with your Docker Hub username.
fn init $USERNAME/hello
# Test it - you can pass data into it too by piping it in, eg: `cat hello.payload.json | fn run`
fn run
# Once it's ready, deploy it to your functions server (default localhost:8080)
# Create your first application
fn apps create myapp
# Initilizes your function w/ prebuilt func.yaml
# Replace $USERNAME with your DockerHub username
fn init $USERNAME/hello
# Test your function
# This will run inside a container exactly how it will on the server
fn run
# Deploy it to your functions server (default localhost:8080)
# This will create a route to your function as well
fn deploy myapp
```
Now you can call your function:
Boom. Now you can call your function:
```sh
curl http://localhost:8080/r/myapp/hello
```
Or surf to it: http://localhost:8080/r/myapp/hello
Or in a browser: [http://localhost:8080/r/myapp/hello](http://localhost:8080/r/myapp/hello)
To update your function:
That's it! You just deployed your first function and called it. Now to update your function
you can update your code and run ```fn deploy myapp``` again.
```sh
# Just update your code and run:
fn deploy myapp
```
## Learning More
### Documentation
See [docs/](docs/README.md) for full documentation.
More on [Writing Functions](docs/writing.md).
And you can find a bunch of examples in the [/examples](/examples) directory.
You can also write your functions in AWS's [Lambda format](docs/lambda/README.md).
### Get Involved
TODO: Slack or Discord community.
See [contributing](CONTRIBUTING.md).
See the [documentation](docs/README.md) for more information. And you can find a bunch of examples in various languages in the [examples](examples/) directory. You can also
write your functions in AWS's [Lambda format](docs/lambda/README.md).
## Functions UI
@@ -137,21 +143,9 @@ docker run --rm -it --link functions:api -p 4000:4000 -e "API_URL=http://api:808
For more information, see: https://github.com/treeder/functions-ui
## Writing Functions
See [Writing Functions](docs/writing.md).
And you can find a bunch of examples in the [/examples](/examples) directory.
## More Documentation
See [docs/](docs/README.md) for full documentation.
## Roadmap
See [milestones](https://gitlab.oracledx.com/odx/functions/milestones) for detailed issues.
## Want to contribute to Oracle Functions?
See [contributing](CONTRIBUTING.md).