mirror of
https://github.com/openfaas/faas.git
synced 2025-06-09 08:46:48 +00:00
Update traefik_integration.md
This commit is contained in:
parent
877e9d2940
commit
17a3564ca0
@ -25,7 +25,7 @@ $ ./deploy_stack.sh
|
|||||||
|
|
||||||
## Configure Traefik for Basic Authentication
|
## Configure Traefik for Basic Authentication
|
||||||
|
|
||||||
#### Generate an MD5 hashed password
|
### Generate an MD5 hashed password
|
||||||
|
|
||||||
Use htpasswd to generate a hashed password
|
Use htpasswd to generate a hashed password
|
||||||
```
|
```
|
||||||
@ -34,7 +34,7 @@ $ htpasswd -c ./password.txt user
|
|||||||
Add a new password when prompted. The new credentials can be found in
|
Add a new password when prompted. The new credentials can be found in
|
||||||
the `password.txt` file.
|
the `password.txt` file.
|
||||||
|
|
||||||
#### Add Traefik configuration to docker-compose.yml
|
### Add Traefik configuration to docker-compose.yml
|
||||||
|
|
||||||
Add an entry under `services` with the Traefik configuration
|
Add an entry under `services` with the Traefik configuration
|
||||||
```
|
```
|
||||||
@ -63,7 +63,7 @@ services:
|
|||||||
constraints: [node.role == manager]
|
constraints: [node.role == manager]
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Update the Gateway service
|
### Update the Gateway service
|
||||||
|
|
||||||
Traefik requires some service labels to discover the gateway service.
|
Traefik requires some service labels to discover the gateway service.
|
||||||
Update the gateway configuration to remove the port property and add
|
Update the gateway configuration to remove the port property and add
|
||||||
@ -93,14 +93,14 @@ include the username and the hashed password. Remember to escape any special
|
|||||||
characters, so if the password contains a `$`, you can escape it by
|
characters, so if the password contains a `$`, you can escape it by
|
||||||
doubling up `$$` just like the above.
|
doubling up `$$` just like the above.
|
||||||
|
|
||||||
#### Re-Deploy OpenFaaS
|
### Re-Deploy OpenFaaS
|
||||||
|
|
||||||
Redeploy OpenFaaS to update the service with the new changes.
|
Redeploy OpenFaaS to update the service with the new changes.
|
||||||
```
|
```
|
||||||
$ ./deploy_stack.sh
|
$ ./deploy_stack.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Test
|
### Test
|
||||||
|
|
||||||
```
|
```
|
||||||
$ curl -u user:password -X POST http://localhost/function/func_echoit -d "hello OpenFaaS"
|
$ curl -u user:password -X POST http://localhost/function/func_echoit -d "hello OpenFaaS"
|
||||||
@ -113,13 +113,16 @@ be greeted with a login alert.
|
|||||||
|
|
||||||
## Configure Traefik with SSL Support
|
## Configure Traefik with SSL Support
|
||||||
|
|
||||||
#### Update Traefik configuration
|
### Update Traefik configuration
|
||||||
|
|
||||||
Traefik makes it extremely easy to add SSL support using
|
Traefik makes it extremely easy to add SSL support using
|
||||||
LetsEncrypt. Add `443` to the list of ports in the `traefik`
|
LetsEncrypt. Add `443` to the list of ports in the `traefik`
|
||||||
service, add the following flags to the command property
|
service, add the following flags to the command property
|
||||||
of the `traefik` service in the `docker-compose.yml` file,
|
of the `traefik` service in the `docker-compose.yml` file,
|
||||||
and add a new `acme` volume under the `volumes` property.
|
and add a new `acme` volume under the `volumes` property.
|
||||||
|
|
||||||
|
> Note: if you're using the default EC2 DNS entry it may be black-listed by LetsEncrypt, so you will need to obtain your own domain name.
|
||||||
|
|
||||||
```
|
```
|
||||||
# docker-compose.yml
|
# docker-compose.yml
|
||||||
version: "3.2"
|
version: "3.2"
|
||||||
@ -158,12 +161,14 @@ volumes:
|
|||||||
# end of file
|
# end of file
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Re-Deploy the OpenFaaS service
|
### Re-Deploy the OpenFaaS service
|
||||||
|
|
||||||
```
|
```
|
||||||
$ ./deploy_stack.sh
|
$ ./deploy_stack.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Test
|
### Test
|
||||||
|
|
||||||
```
|
```
|
||||||
$ curl -u user:password -X POST https://your-domain.com/function/func_echoit -d "hello OpenFaaS"
|
$ curl -u user:password -X POST https://your-domain.com/function/func_echoit -d "hello OpenFaaS"
|
||||||
hello OpenFaaS
|
hello OpenFaaS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user