add docs for --net=host hackery (#1105)

I've found this to be extremely useful. Not that I expect anyone to be able to
find this document on their own accord considering the breadth of
documentation that we have, this can still be useful for linking to from slack
at least (what docs are really for, right?)

also the triggers doc stuck out as confusing considering all the triggers
stuff going on, I was unable to comprehend how exactly it was helpful other
than making people aware that openstack exists and they could build an
extension into fn for it if they want to, but this seems true of most things?
so, removed it, if anyone objects maybe we could improve it a little?
This commit is contained in:
Reed Allman
2018-07-02 11:40:00 -07:00
committed by GitHub
parent 128c9a5182
commit 35e5f81bc8
4 changed files with 35 additions and 25 deletions

View File

@@ -4,7 +4,7 @@ To get the best performance, you'll want to ensure that Docker is configured pro
1. Linux 4.7 or newer with aufs or overlay2 module.
2. Ubuntu 16.04 LTS or newer with aufs or overlay2 module.
3. Docker 17.06 or newer to be available.
3. Docker 17.10 or newer to be available.
It is important to reconfigure host's Docker with this filesystem module. Thus, in your Docker start scripts you must do as following:

View File

@@ -0,0 +1,32 @@
# Testing a running Fn locally
Running functions that call other functions in a local testing environment can
be challenging. This document will outline best practices in functions to make
this work more easily between deployments as well as some tips to help testing
locally.
### Best Practices
Included in each function invocation will be the request url for how the
function was invoked, see [formats](../developers/function-format.md) for where exactly,
this will look something like `request_url` or `FN_REQUEST_URL` depends on the
format. In FDKs, this will be exposed in the context object for each language.
If your function invokes other functions, it's recommended to either configure
the host that your function should use to invoke the other functions yourself
(by sending it in the payload, or elsewhere), or to parse the `request_url`
that Fn includes in a function invocation and use that. This makes it easy to
switch between e.g. `localhost:8080` and `fn.my-company.com`.
### Configuring functions to invoke locally
When running functions that call other functions locally, they will need to be
able to address the fn server to do so. Since functions run in a docker
container, this can be more challenging when using a `localhost` url. One
option is to use something more heavyweight like [ngrok](https://ngrok.com/),
and this will work. It is also possible in a local environment to start `fn`
with the option `FN_DOCKER_NETWORKS=host`, this is equivalent to running each
function container with `--net=host`, where each function can address the
locally running `fn` server to invoke functions against on `localhost`; this
setting is not recommended for production and any behaviors therein should not
be expected in production, it is extremely convenient for testing locally
nonetheless.

View File

@@ -31,8 +31,8 @@ docker run -e VAR_NAME=VALUE ...
| `FN_API_CORS_ORIGINS` | A comma separated list of URLs to enable [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) for (or `*` for all domains). This corresponds to the allowed origins in the `Acccess-Control-Allow-Origin` header. | None |
| `FN_API_CORS_HEADERS` | A comma separated list of Headers to enable [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) for. This corresponds to the allowed headers in the `Access-Control-Allow-Headers` header. | Origin,Content-Length,Content-Type |
| `FN_FREEZE_IDLE_MSECS` | Set this option to specify the amount of time to wait in milliseconds before pausing/freezing an idle hot container. Set to 0 to freeze idle containers without any delay. Set to negative integer to disable freeze/pause of idle hot containers. | 50 |
`FN_EJECT_IDLE_MSECS` | Set this option to specify the amount of time in milliseconds to periodically check to terminate an idle hot container if the system is starved for CPU and Memory resources. Set to negative integer to disable this feature. | 1000 |
`FN_MAX_RESPONSE_SIZE` | Set this option to specify the http body or json response size in bytes from the containers. | 0 (off) |
| `FN_EJECT_IDLE_MSECS` | Set this option to specify the amount of time in milliseconds to periodically check to terminate an idle hot container if the system is starved for CPU and Memory resources. Set to negative integer to disable this feature. | 1000 |
| `FN_MAX_RESPONSE_SIZE` | Set this option to specify the http body or json response size in bytes from the containers. | 0 (off) |
| `DOCKER_HOST` | Docker remote API URL. | /var/run/docker.sock |
| `DOCKER_API_VERSION` | Docker remote API version. | 1.24 |
| `DOCKER_TLS_VERIFY` | Set this option to enable/disable Docker remote API over TLS/SSL. | 0 |

View File

@@ -1,22 +0,0 @@
# Triggers
Triggers are integrations that you can use in other systems to fire off functions in Fn.
## OpenStack
### Requirements
1. OpenStack or DevStack environment.
* OS: Ubuntu 16.04 LTS or newer
* 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 Fn.
Please refer to the [Picasso on DevStack](https://github.com/openstack/picasso/blob/master/devstack/README.md) guide for setup instructions.
### Examples
* [Alarm event triggers from Telemetry and Aodh](https://github.com/openstack/picasso/blob/master/examples/openstack-alarms/README.md)
* Swift notifications - *Status: On roadmap*
* [Blueprint](https://blueprints.launchpad.net/picasso/+spec/swift-notifications)