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: docs/openfaas-pro/builder.md
+47-13
Original file line number
Diff line number
Diff line change
@@ -99,6 +99,10 @@ faas-cli up --remote-builder http://127.0.0.1:8081/build \
99
99
100
100
### Remote builds via `curl`
101
101
102
+
As an alternative to a private or authenticated registry, you can use [ttl.sh by Replicated](https://ttl.sh) as a temporary registry for testing (only). It allows you to publish containers that are removed after a certain time-limit, try `ttl.sh/test-image-hello:1h` for an image that is removed after 1 hour.
103
+
104
+
You can use any registry that is configured in your `config.json` file by changing the `image` field in the configuration file.
105
+
102
106
Create a build context using the `faas-cli build --shrinkwrap` command:
103
107
104
108
```bash
@@ -108,7 +112,7 @@ mkdir -p /tmp/functions
108
112
cd /tmp/functions
109
113
110
114
# Create a new function
111
-
faas-cli new --lang node16 hello-world
115
+
faas-cli new --lang node20 hello-world
112
116
113
117
# The shrinkwrap command performs the templating
114
118
# stage, then stops before running "docker build"
@@ -126,12 +130,11 @@ mv hello-world context
126
130
# Create a config file with the registry and the
127
131
# image name that you want to use for publishing the
> As an alternative to a private or authenticated registry, you can use [ttl.sh by Replicated](https://ttl.sh) as a temporary registry for testing (only). It allows you to publish containers that are removed after a certain time-limit, try `ttl.sh/test-image-hello:1h` for an image that is removed after 1 hour.
134
-
135
138
If you wish, you can also construct this filesystem using your own application, but it is easier to execute the `faas-cli` command from your own code.
136
139
137
140
Then create a tar archive of the context of the `/tmp/functions/build/` directory:
The initial build is likely to take some time, however, if you run the build again or only change some text within a file the subsequent build could complete with single-digit seconds.
188
+
184
189
### Remote builds with a HTTP client
185
190
186
191
A HTTP client has three tasks to perform:
@@ -229,7 +234,7 @@ There are several examples available of how to call the Function Builder's API v
229
234
230
235
You should be able to translate the example given with curl into any programming language, but if you need additional support, feel free to [reach out to us](https://openfaas.com/support).
231
236
232
-
## Monitor the builder
237
+
## How to monitor the builder
233
238
234
239
The builder has additional metrics which will be scraped by the Prometheus instance installed by the OpenFaaS helm chart.
235
240
@@ -239,28 +244,57 @@ The builder has additional metrics which will be scraped by the Prometheus insta
239
244
240
245
* [Download the Grafana JSON file from the Customer Community](https://github.com/openfaas/customers/tree/master/dashboards)
241
246
242
-
## In-cluster access
247
+
## How to gain in-cluster access
243
248
244
-
You can access the Function Builder via your code, or an OpenFaaS function by specifying its URL and its in-cluster service name. You do not need to expose the builder's API publicly.
249
+
You can access the Function Builder via your code, or an OpenFaaS function by specifying its URL and its in-cluster service name.
245
250
246
251
```
247
252
http://pro-builder.openfaas:8080/build
248
253
```
249
254
250
-
## Build arguments
255
+
Even though the endpoint is authenticated, we recommend you do not expose the builder's API to the Internet.
256
+
257
+
## How to specify build arguments
251
258
252
259
You may need to enable build arguments for the Dockerfile, these can be passed through the configuration file.
You may wish to cross-compile a function to run on an arm64 host, if so, you can provide a `platform` key in the configuration file.
273
+
274
+
The below will build an image for arm64 only and must be deployed only to an arm64 host using OpenFaaS Profiles to ensure it is scheduled correctly to an arm64 host.
275
+
276
+
```json
277
+
{
278
+
"image": "ttl.sh/alexellis/test-image:0.1.0",
279
+
"platforms": ["linux/arm64"]
280
+
}
281
+
```
282
+
283
+
Multiple platforms can be specified, the below will build an image for arm64 and amd64, and can be deployed to either type of host.
284
+
285
+
```json
286
+
{
287
+
"image": "ttl.sh/alexellis/test-image:0.1.0",
288
+
"platforms": ["linux/arm64", "linux/amd64"]
289
+
}
290
+
```
291
+
292
+
Bear in mind:
293
+
294
+
* multi-arch images will usually take longer to publish than single-arch images due to emulation with QEMU
295
+
* any steps performed under a TARGETARCH which differs from BUILDARCH will be emulated with QEMU which will add overhead to the build process - you can mitigate this by running a dedicated arm64 and amd64 pro-builder Helm chart installation
296
+
297
+
## How to scale the builder
264
298
265
299
The Function Builder can be scaled out, which also deploys additional replicas of the Function Builder:
## How to limiting the amount of concurrent builds
273
307
274
308
You can limit the amount of concurrent requests that a builder will accept by setting `proBuilder.maxInflight: N` within the helm chart or the `max_inflight` environment variable on the Deployment.
0 commit comments