Updated docs.

This commit is contained in:
Travis Reeder
2017-09-18 17:06:02 -07:00
parent 5476665ea9
commit 87deba45e2
10 changed files with 105 additions and 11 deletions

View File

@@ -8,13 +8,15 @@ If you are a developer using Fn through the API, this section is for you.
* [Usage](usage.md)
* [Writing functions](writing.md)
* [fn (CLI Tool)](https://github.com/fnproject/cli/blob/master/README.md)
* [Hot functions](hot-functions.md)
* [Async functions](async.md)
* [Organizing functions into an application](developers/apps.md)
* [Function file (func.yaml)](function-file.md)
* [Client Libraries](developers/clients.md)
* [Packaging functions](packaging.md)
* [Open Function Format](function-format.md)
* API Reference (coming soon)
* [Hot functions](hot-functions.md)
* [Async functions](async.md)
* [Object Model](developers/model.md)
* [FAQ](faq.md)
## For Operators

63
docs/developers/apps.md Normal file
View File

@@ -0,0 +1,63 @@
# Applications
In `fn`, an application is a group of functions with path mappings (routes) to each function ([learn more](model.md)).
We've tried to make it easy to work with full applications by providing tools that work with all the applications functions.
## Creating an Application
All you have to do is create a file called `app.yaml` in your applications root directory, and the only required field is a name:
```yaml
name: myawesomeapp
```
Once you have that file in place, the `fn` commands will work in the context of that application.
## The Index Function (aka: Root Function)
The root app directory can also contain a `func.yaml` which will be the function access at `/`.
## Function paths
By default, the function name and path will be the same as the directory structure. For instance, if you
have a structure like this:
```txt
- app.yaml
- func.yaml
- func.go
- hello/
- func.yaml
- func.js
- users/
- func.yaml
- func.rb
```
The URL's to access those functions will be:
```
http://abc.io/ -> root function
http://abc.io/hello -> function in hello/ directory
http://abc.io/users -> function in users/ directory
```
## Deploying an entire app at once
```sh
fn deploy --all
```
If you're just testing locally, you can speed it up with the `--local` flag.
## Deploying a single function in the app
To deploy the `hello` function only, from the root dir, run:
```sh
fn deploy hello
```
## Example app
See https://github.com/fnproject/fn/tree/master/examples/app for a simple example.

31
docs/developers/model.md Normal file
View File

@@ -0,0 +1,31 @@
# Object Model
This document describes the different objects we store and the relationships between them.
## Applications
At the root of everything are applications. In `fn`, an application is essentially a grouping of functions
with path mappings (routes) to each function. For instance, consider the following URLs for the app called `myapp`:
```
http://myapp.com/hello
http://myapp.com/users
```
This is an app with 2 routes:
1. A mapping of the path `/hello` to a function called `hello`
1. A mapping of the path `/users` to a function called `users`
## Routes
An app consists of 1 or more routes. A route stores the mapping between URL paths and functions (ie: container iamges).
## Calls
A call represents an invocation of a function. Every request for a URL as defined in the routes, a call is created.
The `call_id` for each request will show up in all logs and the status of the call, as well as the logs, can be retrieved using the `call_id`.
## Logs
Logs are stored for each `call` that is made and can be retrieved with the `call_id`.

View File

@@ -2,6 +2,4 @@
This shows you how to organize functions into a full application and deploy them easily with one command.
## TODOs
* [ ] Use a header/footer endpoint and pull them into the functions?
See [apps documentation](/docs/developers/app.md) for details on how to use this.

View File

@@ -1,5 +1,5 @@
name: footer
version: 0.0.12
version: 0.0.13
runtime: ruby
entrypoint: ruby func.rb
headers:

View File

@@ -1,4 +1,4 @@
name: app
version: 0.0.69
version: 0.0.70
runtime: go
entrypoint: ./func

View File

@@ -1,5 +1,5 @@
name: header
version: 0.0.10
version: 0.0.11
runtime: ruby
entrypoint: ruby func.rb
headers:

View File

@@ -1,4 +1,4 @@
name: node
version: 0.0.12
version: 0.0.13
runtime: node
entrypoint: node func.js

View File

@@ -1,4 +1,4 @@
name: python
version: 0.0.10
version: 0.0.11
runtime: python
entrypoint: python2 func.py

View File

@@ -1,5 +1,5 @@
name: ruby
version: 0.0.22
version: 0.0.23
runtime: ruby
entrypoint: ruby func.rb
headers: