mirror of
https://github.com/openfaas/faas.git
synced 2025-06-10 17:26:47 +00:00
1.4 KiB
1.4 KiB
Create a .htaccess:
$ sudo apt-get install apache2-utils
$ htpasswd -c openfaas.htpasswd admin
New password:
Re-type new password:
Adding password for user admin
Example:
$ cat openfaas.htpasswd
admin:$apr1$BgwAfB5i$dfzQPXy6VliPCVqofyHsT.
Create a secret in the cluster
$ docker secret create --label openfaas openfaas_htpasswd openfaas.htpasswd
q70h0nsj9odbtv12vrsijcutx
You can now see the secret created:
$ docker secret ls
ID NAME DRIVER CREATED UPDATED
q70h0nsj9odbtv12vrsijcutx openfaas_htpasswd 13 seconds ago 13 seconds ago
Remove the exposed port on the gateway
$ docker service update func_gateway --publish-rm 8080
Build an Nginx container
Build gwnginx from contrib directory.
$ docker build -t gwnginx .
Launch nginx
Deploy Nginx
$ docker service rm gwnginx ; \
docker service create --network=func_functions \
--secret openfaas_htpasswd \
--publish 8080:8080 --name gwnginx gwnginx
Connect to the UI
You can now connect to the UI on port 8080. If you use a web-browser you will be prompted for a password.
API/CLI
The API will require Basic Auth but can stil be used with curl
. We have work under testing to support basic auth inside the faas-cli
natively.