Skip to content
Snippets Groups Projects
Commit 3f98c856 authored by Alex Ellis (OpenFaaS Ltd)'s avatar Alex Ellis (OpenFaaS Ltd)
Browse files

Remove Swarm references

parent 8a5b3123
No related branches found
No related tags found
No related merge requests found
......@@ -42,7 +42,7 @@
* Docker version `docker version` (e.g. Docker 17.0.05 ):
* Are you using Docker Swarm or Kubernetes (FaaS-netes)?
* Are you using Kubernetes or faasd?
* Operating System and version (e.g. Linux, Windows, MacOS):
......@@ -50,11 +50,6 @@
* Other diagnostic information / logs from [troubleshooting guide](https://docs.openfaas.com/deployment/troubleshooting)
If using Swarm, run the following and include the output:
```
curl -sLS https://raw.githubusercontent.com/moby/moby/master/contrib/check-config.sh | bash
```
## Next steps
......
......@@ -461,7 +461,7 @@ definitions:
example: nodeinfo
network:
type: string
description: Docker swarm network, usually func_functions
description: Network, usually func_functions for Swarm (deprecated)
example: func_functions
image:
type: string
......
#!/bin/bash
docker swarm init --advertise-addr=127.0.0.1
set -e
./deploy_stack.sh --no-auth
# The timeout is required on Travis due to some tasks not starting in
# time and being deemed to have failed.
docker service update func_gateway --image=ghcr.io/openfaas/gateway:latest-dev \
--update-failure-action=continue \
--update-monitor=20s
# Script makes sure OpenFaaS API gateway is ready before running tests
wait_success=false
for i in {1..30};
do
echo "Checking if 127.0.0.1:8000 is up.. ${i}/30"
status_code=$(curl --silent --output /dev/stderr --write-out "%{http_code}" http://127.0.0.1:8080/)
if [ "$status_code" -ge 200 -a "$status_code" -lt 400 ]; then
echo "Deploying gateway success"
wait_success=true
break
fi
sleep 0.5
done
if [ "$wait_success" != true ] ; then
echo "Failed to wait for gateway"
exit 1
fi
cd ..
if [ -z "$GOPATH" ]
then
export GOPATH=$GITHUB_WORKSPACE
fi
if [ ! -d "$GOPATH/src/github.com/openfaas/" ]; then
mkdir -p $GOPATH/src/github.com/openfaas/
fi
if [ ! -d "$GOPATH/src/github.com/openfaas/certifier" ]; then
git clone https://github.com/openfaas/certifier
fi
echo "Deploying OpenFaaS stack.yml from $(pwd)/faas"
command -v faas-cli >/dev/null 2>&1 || curl -sSL https://cli.openfaas.com | sudo sh
faas-cli deploy -f ./faas/stack.yml
wait_success=false
for i in {1..30}
do
echo "Checking if 127.0.0.1:8080/function/echoit is up.. ${i}/30"
status_code=$(curl --silent --output /dev/stderr --write-out "%{http_code}" http://127.0.0.1:8080/function/echoit -d "hello")
if [ "$status_code" -ge 200 -a "$status_code" -lt 400 ]; then
echo "Deploying OpenFaaS stack.yml success"
wait_success=true
break
else
echo "Attempt $i lets try again"
fi
printf '.'
sleep 0.5
done
if [ "$wait_success" != true ] ; then
echo "Failed to wait for stack.yml to deploy"
exit 1
fi
echo Running integration tests
cd $GOPATH/src/github.com/openfaas/faas/gateway/tests/integration && \
go test -v -count=1
echo Running certifier
export OPENFAAS_URL=http://127.0.0.1:8080/
cd $GOPATH/src/github.com/openfaas/certifier && \
make test-swarm
echo Integration tests all PASSED
exit 0
# Managing images
Any Docker images you build for your FaaS functions need to be accessible by any Docker Swarm worker or manager in your cluster. The only exception is during development - when you may have a single-node cluster and the image is in your local image library.
All images should be pushed to either a private repository or the Docker Hub:
* Manually built FaaS images
* Images build with the FaaS-CLI
Repositories that need authentication will require configuration when deploying your FaaS functions.
## Using private Docker registries
FaaS supports running functions from Docker images in private Docker registries.
The registry credentials can be passed on function deployment, and are then handled by Swarm for image polling.
### Deploy functions with private registries credentials
A `POST` request on `/system/function` allows you to specify private registry credentials, as a base64-encoded basic auth (user:password).
```
curl -XPOST /system/functions -d {
"service": "functionName",
"image": "privateregistry.domain.com/user/function",
"envProcess": "/usr/bin/myprocess",
"network": "func_functions",
"registryAuth": "dXNlcjpwYXNzd29yZA=="
}
```
Base64-encoded basic auth can be resolved using your registry username and password:
````
$ echo -n "user:password" | base64
````
or (to prevent tracking in `history` command):
```
$ base64 -
(type in) user:password (hit control+D twice)
```
You can also find this string your `~/.docker/config.json` file. Docker stores credentials here after you run the `docker login` command:
```
cat ~/.docker/config.json
{
"auths": {
"privateregistry.domain.com": {
"auth": "dXNlcjpwYXNzd29yZA=="
}
}
}
```
### Deploy your own private Docker registry
If you wish to deploy your own private registry, you can follow [Docker official documentation](https://docs.docker.com/registry/deploying/).
A quick way to get started for a private registry with TLS and authentication
is to create a VM with port 443 open to the world (for letsencrypt registration), and a registered DNS ($YOURHOST).
Then, create these two files in the current directory:
```
# docker-compose.yml
version: '2'
services:
registry:
restart: always
image: registry:2
ports:
- 5000:5000
- 443:5000
environment:
REGISTRY_AUTH: htpasswd
REGISTRY_AUTH_HTPASSWD_PATH: /auth/htpasswd
REGISTRY_AUTH_HTPASSWD_REALM: Registry Realm
REGISTRY_HTTP_TLS_LETSENCRYPT_CACHEFILE: /letsencrypt/cache
REGISTRY_HTTP_TLS_LETSENCRYPT_EMAIL: your@email.com
volumes:
- ./data:/var/lib/registry
- ./auth:/auth
- ./letsencrypt:/letsencrypt
```
```
# auth/htpasswd (generated with `docker run --entrypoint htpasswd registry:2 -Bbn testuser testpassword`)
testuser:$2y$05$Bl9siDMe7ieQHLM8e7ifaOklKrHmXymbMqfmqXs7zssj6MMGQW4le
```
Your registry is ready to be deployed by running `docker-compose up -d`.
On the client machine, you can now login and use the newly setup registry:
```
docker pull ubuntu && docker tag ubuntu $YOURHOST/ubuntu
docker login $YOURHOST # will add encoded registry credentials to ~/.docker/config.json
Username: testuser
Password: testpassword
docker push $YOURHOST/ubuntu
```
Images pushed to this registry can be used as functions with FaaS, provided you pass the appropriate `registryAuth` parameter at deployment time.
......@@ -2,7 +2,7 @@
The API Gateway provides an external route into your functions and collects Cloud Native metrics through Prometheus. The gateway also has a UI built-in which can be used to deploy your own functions or functions from the OpenFaaS Function Store then invoke them.
The gateway will scale functions according to demand by altering the service replica count in the Docker Swarm or Kubernetes API. Custom alerts generated by AlertManager are received on the /system/alert endpoint.
The gateway will scale functions according to demand by altering the service replica count in the Kubernetes API. Custom alerts generated by AlertManager are received on the /system/alert endpoint.
In summary:
......@@ -19,7 +19,7 @@ In summary:
## Function Providers
Providers for functions can be written using the [faas-provider](https://github.com/openfaas/faas-provider/) interface in Golang which provides the REST API for interacting with the gateway. The gateway originally interacted with Docker Swarm directly and anything else via a Function Provider - this support was moved into a separate project [faas-swarm](https://github.com/openfaas/faas-swarm/).
Providers for functions can be written using the [faas-provider](https://github.com/openfaas/faas-provider/) interface in Golang which provides the REST API for interacting with the gateway.
## REST API
......
......@@ -54,7 +54,7 @@
<div layout-gt-xs="row">
<md-input-container class="md-block" flex-gt-sm>
<md-tooltip md-direction="bottom">Docker Swarm network, not required for other providers. Default: func_functions</md-tooltip>
<label>Network (Swarm):</label>
<label>Network (Deprecated):</label>
<input name="network" ng-model="item.network" md-maxlength="200" minlength="0">
</md-input-container>
</div>
......
......@@ -20,7 +20,7 @@ Here is a list of some of the sample functions included this repository.
| Name | Details |
|--------------------------|----------------------------------------- |
| AlpineFunction | BusyBox - a useful base image with busybox utilities pre-installed |
| apikey-secret | Example in Golang showing how to read a secret from a HTTP header and validate with a Swarm/Kubernetes secret |
| apikey-secret | Example in Golang showing how to read a secret from a HTTP header and validate with a Kubernetes secret |
| CaptainsIntent | Alexa skill - find the count of Docker Captains |
| ChangeColorIntent | Alexa skill - change the colour of IoT-connected lights |
| CHelloWorld | Use C to build a function |
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment