Skip to content

Commit 540b8eb

Browse files
committed
Notes on OPENFAAS_STORE override
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
1 parent b78f1fe commit 540b8eb

2 files changed

Lines changed: 127 additions & 1 deletion

File tree

docs/cli/function-store.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# The Function Store
2+
3+
The Function Store makes it easy to share pre-built functions with other users.
4+
5+
The project maintains a number of official functions for testing and exploration, plus some contributions from the community.
6+
7+
## Find and explore functions in the store
8+
9+
To list available functions run:
10+
11+
```bash
12+
$ faas-cli store list
13+
14+
FUNCTION AUTHOR DESCRIPTION
15+
nodeinfo openfaas NodeInfo
16+
env openfaas env
17+
sleep openfaas sleep
18+
shasum openfaas shasum
19+
figlet openfaas figlet
20+
printer openfaas printer
21+
curl openfaas curl
22+
external-ip openfaas external-ip
23+
markdown openfaas markdown
24+
youtube-dl openfaas youtube-dl
25+
sentimentanalysis openfaas SentimentAnalysis
26+
hey openfaas hey
27+
nslookup openfaas nslookup
28+
certinfo stefanprodan SSL/TLS cert info
29+
nvidia-smi openfaas nvidia-smi
30+
alpine openfaas alpine
31+
cows openfaas ASCII Cows
32+
```
33+
34+
For a given function say `env`, you can find more information by describing it:
35+
36+
```bash
37+
$ faas-cli store describe env
38+
39+
Title: env
40+
Author: openfaas
41+
Description:
42+
Print the environment variables present in the function and HTTP request
43+
44+
Image: ghcr.io/openfaas/alpine:latest
45+
Process: env
46+
Repo URL: https://github.com/openfaas/store-functions
47+
```
48+
49+
Certain functions have a minimum memory requirement, or set additional timeout values.
50+
51+
Try to describe something like the `inception` model:
52+
53+
```bash
54+
faas-cli store describe inception --platform x86_64
55+
Title: Inception
56+
Author: alexellis
57+
Description:
58+
This is a forked version of the work by Magnus Erik Hvass Pedersen - it has been
59+
re-packaged as an OpenFaaS serverless function.
60+
61+
Image: alexellis/inception:2019-02-17
62+
Process: python3 index.py
63+
Repo URL: https://github.com/faas-and-furious/inception-function
64+
Environment:
65+
- read_timeout: 60s
66+
- write_timeout: 60s
67+
```
68+
69+
You'll notice it's not available for Arm or Apple Silicon, so I specified a `--platform` directly.
70+
71+
In this case a minimum timeout is set of 60s.
72+
73+
## Deploy a function from the store
74+
75+
To deploy a function as it is, simply run:
76+
77+
```bash
78+
faas-cli store deploy nodeinfo
79+
```
80+
81+
Then invoke it via `faas-cli invoke`, or obtain its URL on the gateway via `faas-cli describe nodeinfo`.
82+
83+
You can set additional labels, annotations, environment variables, and memory/CPU constraints by passing additional flags to the `store deploy command`.
84+
85+
For instance, to enable scale to zero:
86+
87+
```bash
88+
faas-cli store deploy nodeinfo \
89+
--label com.openfaas.scale.zero=true \
90+
--label com.openfaas.scale.zero-duration=5m
91+
```
92+
93+
## Create your own custom function store
94+
95+
You can create your own custom function store by creating a new Git repository, and placing a functions.json file in the root.
96+
97+
Then pass the `--url` flag to instruction the CLI to use your store instead of the official one.
98+
99+
```bash
100+
faas-cli store list \
101+
--url https://raw.githubusercontent.com/openfaas/store/refs/heads/master/functions.json
102+
```
103+
104+
When using GitHub to store your functions.json file make sure you specify the *raw* URL.
105+
106+
From `faas-cli` version 0.17.8 and higher, to avoid repeating the `--url` flag on each command, you can also set the `OPENFAAS_STORE` environment variable.
107+
108+
For convenience, if you want to persist the change, introduce the following in your .zshrc or .bashrc file:
109+
110+
```bash
111+
export OPENFAAS_STORE=https://raw.githubusercontent.com/openfaas/store/refs/heads/master/functions.json
112+
```

docs/cli/templates.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,14 @@ Languages available as templates:
100100

101101
You can create your own template store by following the convention found in the official templates store repository, then provide the `--url` flag when pulling or listing templates. If you're using GitHub, you'll need to reference the *raw* file rather than the view in a webbrowser.
102102

103+
For instance:
104+
105+
```bash
106+
faas-cli template store pull --url https://raw.githubusercontent.com/openfaas/store/refs/heads/master/templates.json
107+
```
108+
109+
This is the format for the file:
110+
103111
```json
104112
[
105113
{
@@ -113,7 +121,13 @@ You can create your own template store by following the convention found in the
113121
]
114122
```
115123

116-
For the official templates, this would be: `https://raw.githubusercontent.com/openfaas/store/refs/heads/master/templates.json`
124+
As an alternative to repeating the `--url` flag on each command, you can also set the `OPENFAAS_TEMPLATE_STORE_URL` environment variable in your .zshrc or .bashrc file.
125+
126+
For instance, you could add these lines to override installations to use your company or team repository:
127+
128+
```bash
129+
export OPENFAAS_TEMPLATE_STORE_URL=https://raw.githubusercontent.com/openfaas/store/refs/heads/master/functions.json
130+
```
117131

118132
The classic templates are held in the [openfaas/templates](https://github.com/openfaas/templates) repository.
119133

0 commit comments

Comments
 (0)