Skip to content

Commit 997dd3d

Browse files
weltekialexellis
authored andcommitted
Updates and fixes for local registry on faasd
Signed-off-by: Han Verstraete (OpenFaaS Ltd) <han@openfaas.com>
1 parent b89f64a commit 997dd3d

1 file changed

Lines changed: 41 additions & 2 deletions

File tree

docs/edge/builder.md

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The builder runs as a non-root user making use of user namespaces in Linux.
99
* An OpenFaaS for Enterprises license or an additional entitlement for the Function Builder API is required to use this feature.
1010
* Your operating system must support user namespaces, generally most modern Linux distributions do.
1111
* Docker must not be installed on the host system.
12-
* faasd-pro version 0.2.23 or later is required.
12+
* faasd-pro version 0.2.26 or later is required.
1313

1414
## Configure a registry
1515

@@ -34,13 +34,14 @@ export PASSWORD=$(openssl rand -base64 16)
3434
echo $PASSWORD > ~/registry-password.txt
3535

3636
htpasswd -Bbc ./htpasswd faasd $PASSWORD
37+
sudo mkdir -p /var/lib/faasd/registry/auth
3738
sudo mv ~/htpasswd /var/lib/faasd/registry/auth/htpasswd
3839
```
3940

4041
Create a configuration file for the registry:
4142

4243
```sh
43-
sudo cat >> /var/lib/faasd/registry/config.yml <<EOF
44+
sudo tee /var/lib/faasd/registry/config.yml > /dev/null <<EOF
4445
version: 0.1
4546
log:
4647
accesslog:
@@ -77,6 +78,7 @@ The file will be created in the `.credentials` folder. Copy the file so that it
7778

7879
```sh
7980
# Ensure faasd-provider can pull images from the faasd service".
81+
sudo mkdir -p /var/lib/faasd/.docker
8082
sudo cp ./credentials/config.json /var/lib/faasd/.docker/config.json
8183
# Ensure the pro-builder can mount the credentials file.
8284
sudo cp ./credentials/config.json /var/lib/faasd/secrets/docker-config
@@ -89,6 +91,42 @@ To be able to access the registry from the host machine, update the `/etc/hosts`
8991
echo "127.0.0.1 registry" | sudo tee -a /etc/hosts
9092
```
9193

94+
Update the faasd-provider service to add the registry as an insecure registry. This is not required if you configure TLS for the registry.
95+
96+
Edit `/lib/systemd/system/faasd-provider.service` and add the flag `--insecure-registry http://registry:5000` to the `ExecStart` command:
97+
98+
```diff
99+
[Unit]
100+
Description=faasd-provider
101+
102+
[Service]
103+
MemoryMax=500M
104+
Environment="secret_mount_path=/var/lib/faasd/secrets"
105+
Environment="basic_auth=true"
106+
Environment="hosts_dir=/var/lib/faasd"
107+
ExecStart=/usr/local/bin/faasd provider \
108+
--insecure-registry http://registry:5000 \
109+
--dns-server 8.8.8.8 --dns-server 8.8.4.4 \
110+
--pull-policy Always \
111+
--license-file /var/lib/faasd/secrets/openfaas_license \
112+
+ --insecure-registry http://registry:5000
113+
Restart=on-failure
114+
RestartSec=60s
115+
# Keep logging child process running when the main process get killed.
116+
KillMode=process
117+
WorkingDirectory=/var/lib/faasd-provider
118+
119+
[Install]
120+
WantedBy=multi-user.target
121+
```
122+
123+
Make sure to reload the systemd daemon and restart the faasd-provider service:
124+
125+
```bash
126+
sudo systemctl daemon-reload
127+
sudo systemctl restart faasd-provider
128+
```
129+
92130
## Create a payload secret
93131

94132
The payload secret will be used to sign the payloads sent to the Function Builder's API.
@@ -120,6 +158,7 @@ Add the following services to your `docker-compose.yaml` file:
120158
replicas: 1
121159
ports:
122160
- "127.0.0.1:5000:5000"
161+
123162
pro-builder:
124163
depends_on: [buildkit]
125164
user: "app"

0 commit comments

Comments
 (0)