You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+45-6Lines changed: 45 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -51,6 +51,7 @@ Before you get started, make sure you have the following dependencies installed:
51
51
- Go (>=v1.22) to compile management service and reverse proxy
52
52
- Docker (>=v24)
53
53
- Make
54
+
- a writable directory (tinyFaaS writes temporary files to a `./tmp` directory)
54
55
55
56
Note that tinyFaaS is intended for Linux hosts (`x86_64` and `arm64`).
56
57
Due to limitations of Docker Desktop for Mac, installing and running [`docker-mac-net-connect`](https://github.com/chipmk/docker-mac-net-connect) is necessary to run tinyFaaS on macOS hosts.
@@ -88,32 +89,27 @@ Additionally, we provide scripts to read logs from your function and to wipe all
88
89
### Writing Functions
89
90
90
91
This tinyFaaS prototype only supports functions written for NodeJS 20, Python 3.9, and binary functions.
92
+
A good place to get started with writing functions is the selection of test functions in [`./test/fns`](./test/fns/).
91
93
92
94
#### NodeJS 20
93
95
94
96
Your function must be supplied as a Node module with the name `fn` that exports a single function that takes the `req` and `res` parameters for request and response, respectively.
95
97
`res` supports the `send()` function that has one parameter, a string that is passed to the client as-is.
96
98
97
-
To get started with functions, use the example _sieve of Eratosthenes_ function in [`./test/fns/sieve-of-eratosthenes`](./tests/fns/sieve-of-eratosthenes).
98
-
99
99
#### Python 3.9
100
100
101
101
Your function must be supplied as a file named `fn.py` that exposes a method `fn` that is invoked for every function invocation.
102
102
This method must accept a string as an input (that can also be `None`) and must provide a string as a return value.
103
103
You may also provide a `requirements.txt` file from which dependencies will be installed alongside your function.
104
104
Any other data you provide will be available.
105
105
106
-
To get started with this type of function, use the example `echo` function in [`./test/fns/echo`](./tests/fns/echo).
107
-
108
106
#### Binary
109
107
110
108
Your function must be provided as a `fn.sh` shell script that is invoked for every function call.
111
109
This shell script may also call other binaries as needed.
112
110
Input data is provided from `stdin`.
113
111
Output responses should be provided on `stdout`.
114
112
115
-
To get started with this type of function, use the example `echo-binary` function in [`./test/fns/echo-binary`](./tests/fns/echo-binary).
116
-
117
113
### Calling Functions
118
114
119
115
tinyFaaS supports different application layer protocols at its reverse proxy.
@@ -184,3 +180,46 @@ For example, to use `6000` as the port for the CoAP and deactivate GRPC, run the
Tests will output a `.` (dot) for successful tests and `E` or `F` for failed tests.
217
+
tinyFaaS output will be written to `tf_test.out`.
218
+
219
+
On macOS, [`docker-mac-net-connect`](https://github.com/chipmk/docker-mac-net-connect) is necessary to run tinyFaaS.
220
+
There is a [known issue in `docker-mac-net-connect`](https://github.com/chipmk/docker-mac-net-connect/issues/36) that silently breaks the tunnel when Docker Desktop enters its resource saver mode.
221
+
If you find that tinyFaaS does not start properly on your macOS host, try restarting the tunnel:
0 commit comments