Skip to content

Commit 9f1ec8b

Browse files
committed
Docs on pre-loading functions
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
1 parent dc6e29b commit 9f1ec8b

2 files changed

Lines changed: 86 additions & 7 deletions

File tree

docs/edge/overview.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,24 @@ The handbook and reference documentation for OpenFaaS Edge are available in the
66

77
Most of the [OpenFaaS Pro documentation](/docs/openfaas-pro/) and [Helm charts](https://github.com/openfaas/faas-netes/tree/master/chart) can be used or adapted, however you'll find some specifics here:
88

9+
## Packaging/deployment
10+
911
* [OpenFaaS Edge Deployment](/deployment/edge)
10-
* [Services](/edge/services)
11-
* [TLS](/edge/tls)
12-
* [Scale to Zero for OpenFaaS Edge](/edge/scale-to-zero)
12+
* [Upgrading OpenFaaS Edge - itself and its containers](/deployment/edge/#upgrading-openfaas-edge)
13+
* [Preloading functions for distribution](/edge/preloading.md)
14+
* [Air Gap](/edge/airgap)
1315
* [Custom DNS servers](/edge/custom-dns)
14-
* [Kafka Connector for OpenFaaS Edge](/edge/kafka-deployment)
15-
* [GPU support for services](/edge/gpus)
1616
* [Improve container security with gVisor](/edge/gvisor)
17+
18+
## OpenFaaS Edge guides
19+
20+
* [Services](/edge/services) - stateful containers defined in `docker-compose.yaml`
21+
* [TLS](/edge/tls) - secure the gateway for requests from the Internet
22+
* [Scale to Zero for OpenFaaS Edge](/edge/scale-to-zero)
23+
* [Kafka Connector for OpenFaaS Edge](/edge/kafka-deployment)
24+
* [GPU support for services](/edge/gpus) - package i.e. Ollama and an LLM for use by functions
1725
* [OpenTelemetry](/edge/open-telemetry)
18-
* [Air Gap](/edge/airgap)
19-
* [Resource constraints](/reference/yaml/#function-memorycpu-limits)
26+
* [Resource constraints](/reference/yaml/#function-memorycpu-limits) - limit RAM/CPU consumption by functions
2027

2128
## Looking for something else?
2229

docs/edge/preloading.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Preloading Functions for Distribution
2+
3+
OpenFaaS Edge is licensed for distribution of bespoke solutions to end customers. The product itself can shipped as a convenient DEB/RPM package, or pre-installed in a VM image.
4+
5+
But when it comes to functions, you generally have to deploy these via `faas-cli`.
6+
7+
Preloading is a solution to this problem.
8+
9+
On the first boot of the `faasd-provider` service, any YAML files found will be deployed automatically.
10+
11+
So before you install OpenFaaS Edge, create the: `/var/lib/faasd-provider/functions` folder, and place any number of OpenFaaS function YAML files within it.
12+
13+
## A single stack.yaml
14+
15+
You can ship a single stack.yaml file with all your functions defined separately within it.
16+
17+
*stack.yaml*
18+
19+
```yaml
20+
functions:
21+
env:
22+
image: ghcr.io/openfaas/env:latest
23+
fprocess: env
24+
nodeinfo:
25+
image: ghcr.io/openfaas/nodeinfo:latest
26+
```
27+
28+
You can leave in build data such as the template and handler folder, or you can trim it away for brevity. It won't be used at deployment time.
29+
30+
Copy the files to the destination:
31+
32+
```bash
33+
sudo mkdir -p /var/lib/faasd-provider/functions/
34+
sudo cp stack.yaml /var/lib/faasd-provider/functions/
35+
```
36+
37+
## Multiple YAML files
38+
39+
You could also create multiple YAML files - one per function:
40+
41+
*env.yaml*
42+
43+
```yaml
44+
functions:
45+
env:
46+
image: ghcr.io/openfaas/env:latest
47+
fprocess: env
48+
```
49+
50+
*nodeinfo.yaml*
51+
52+
```yaml
53+
functions:
54+
nodeinfo:
55+
image: ghcr.io/openfaas/nodeinfo:latest
56+
fprocess: nodeinfo
57+
```
58+
59+
Copy the files to the destination:
60+
61+
```bash
62+
sudo mkdir -p /var/lib/faasd-provider/functions/
63+
sudo cp nodeinfo.yaml /var/lib/faasd-provider/functions/
64+
sudo cp env.yaml /var/lib/faasd-provider/functions/
65+
```
66+
67+
## Running the preload a second time
68+
69+
By default, the preload will only run once, then a file is written out to prevent it from running again.
70+
71+
To have the preload run a second time i.e. during testing, simply remove the run file: `sudo rm -rf /var/lib/faasd-provider/bootstrap.ran`.
72+

0 commit comments

Comments
 (0)