docs: remove old docs

This commit is contained in:
Alexis Couvreur
2022-11-01 18:00:56 +00:00
parent 9d943d457b
commit 4f2f48c0b4
17 changed files with 0 additions and 553 deletions

View File

@@ -1,65 +0,0 @@
version: "3.7"
services:
traefik:
image: traefik
entrypoint: sh -c "sed 's/$$TRAEFIK_PILOT_TOKEN/$TRAEFIK_PILOT_TOKEN/' /etc/traefik/traefik-template.yml > /etc/traefik/traefik.yml && traefik"
ports:
- "8000:80"
- "8080:8080"
volumes:
- './traefik_dev.yml:/etc/traefik/traefik-template.yml'
- '/var/run/docker.sock:/var/run/docker.sock'
- '.:/plugins-local/src/github.com/acouvreur/sablier/plugins/traefik'
environment:
- TRAEFIK_PILOT_TOKEN
deploy:
labels:
- traefik.enable=true
- traefik.http.services.traefik.loadbalancer.server.port=8080
sablier:
image: ghcr.io/acouvreur/sablier:feature-merge-repositories
command:
- --swarmMode=true
volumes:
- '/var/run/docker.sock:/var/run/docker.sock'
whoami:
image: containous/whoami
deploy:
replicas: 0
labels:
- traefik.enable=true
# If you do not use the swarm load balancer, traefik will evict the service from its pool
# as soon as the service is 0/0. If you do not set that, fallback to dynamic-config.yml file usage.
- traefik.docker.lbswarm=true
- traefik.http.middlewares.ondemand_whoami.plugin.sablier.name=whoami
- traefik.http.middlewares.ondemand_whoami.plugin.sablier://sablier:10000
- traefik.http.middlewares.ondemand_whoami.plugin.sablier
- traefik.http.routers.whoami.middlewares=ondemand_whoami@docker
- traefik.http.routers.whoami.rule=PathPrefix(`/whoami`)
- traefik.http.services.whoami.loadbalancer.server.port=80
nginx:
image: nginx
healthcheck:
test: "true"
interval: 1m30s
timeout: 30s
retries: 5
start_period: 30s
deploy:
replicas: 0
labels:
- traefik.enable=true
# If you do not use the swarm load balancer, traefik will evict the service from its pool
# as soon as the service is 0/0. If you do not set that, fallback to dynamic-config.yml file usage.
- traefik.docker.lbswarm=true
- traefik.http.middlewares.ondemand_nginx.plugin.sablier.name=nginx
- traefik.http.middlewares.ondemand_nginx.plugin.sablier.serviceurl=http://sablier:10000
- traefik.http.middlewares.ondemand_nginx.plugin.sablier.timeout=5m
- traefik.http.middlewares.ondemand_nginx.plugin.sablier.waitui=false
- traefik.http.routers.nginx.middlewares=ondemand_nginx@docker
- traefik.http.routers.nginx.rule=PathPrefix(`/nginx`)
- traefik.http.services.nginx.loadbalancer.server.port=80

View File

@@ -1,22 +0,0 @@
# Docker classic
## Run the demo
1. `git clone git@github.com:acouvreur/sablier.git`
2. `cd sablier/plugins/traefik/examples/docker_classic`
3. `export TRAEFIK_PILOT_TOKEN=...`
4. `docker-compose up`
The log: `level=error msg="middleware \"ondemand@docker\" does not exist" entryPointName=http routerName=whoami@file` is expected because the file provider is parsed before the docker containers. However this should appear only once and not cause any issue.
5. `docker stop docker_classic_whoami_1`
6. Load `http://localhost/whoami`
7. Wait 1 minute
8. Container is stopped
## Limitations
### Cannot use service labels
Cannot use labels because as soon as the container is stopped, the labels are not treated by Traefik.
The route doesn't exist anymore, so we use dynamic-config.yml file instead.

View File

@@ -1,46 +0,0 @@
version: "3.9"
services:
traefik:
image: traefik
command:
- --api=true
- --api.insecure=true
- --pilot.token=$TRAEFIK_PILOT_TOKEN
- --experimental.plugins.sablier.moduleName=github.com/acouvreur/sablier/plugins/traefik
- --experimental.plugins.sablier.version=v1.2.0
- --providers.docker=true
- --providers.file.filename=/etc/traefik/dynamic-config.yml
- --entrypoints.http.address=:80
- --entrypoints.https.address=:443
ports:
- "80:80"
- "443:443"
- "8080:8080"
volumes:
- '/var/run/docker.sock:/var/run/docker.sock'
- './dynamic-config.yml:/etc/traefik/dynamic-config.yml'
labels:
- traefik.enable=true
sablier:
image: ghcr.io/acouvreur/sablier:1
command:
- --swarmMode=false
volumes:
- '/var/run/docker.sock:/var/run/docker.sock'
labels:
- traefik.enable=true
- traefik.http.middlewares.ondemand.plugin.sablier.name=docker_classic_whoami_1
- traefik.http.middlewares.ondemand.plugin.sablier.serviceUrl=http://sablier:10000
- traefik.http.middlewares.ondemand.plugin.sablier.timeout=1m
- traefik.http.services.ondemand.loadbalancer.server.port=10000
whoami:
image: containous/whoami
# Cannot use labels because as soon as the container is stopped, the labels are not treated by Traefik
# The route doesn't exist anymore. Use dynamic-config.yml file instead.
# labels:
# - traefik.enable
# - traefik.http.routers.whoami.rule=PathPrefix(`/whoami`)
# - traefik.http.routers.whoami.middlewares=ondemand

View File

@@ -1,16 +0,0 @@
http:
services:
whoami:
loadBalancer:
servers:
- url: "http://whoami:80"
routers:
whoami:
rule: PathPrefix(`/whoami`)
entryPoints:
- "http"
middlewares:
- ondemand@docker
service: "whoami"

View File

@@ -1,12 +0,0 @@
# Docker swarm
## Run the demo
1. `git clone git@github.com:acouvreur/sablier.git`
2. `cd sablier/plugins/traefik/examples/docker_swarm`
3. `docker swarm init`
4. `export TRAEFIK_PILOT_TOKEN=...`
5. `docker stack deploy -c docker-stack.yml DOCKER_SWARM`
6. Load `http://localhost/nginx`
7. Wait 1 minute
8. Service is scaled to 0/0

View File

@@ -1,51 +0,0 @@
version: "3.9"
services:
traefik:
image: traefik
command:
- --api=true
- --api.insecure=true
- --pilot.token=$TRAEFIK_PILOT_TOKEN
- --experimental.plugins.sablier.moduleName=github.com/acouvreur/sablier/plugins/traefik
- --experimental.plugins.sablier.version=v1.2.0
- --providers.docker=true
- --providers.docker.swarmmode=true
- --providers.file.filename=/etc/traefik/dynamic-config.yml
- --entrypoints.http.address=:80
- --entrypoints.https.address=:443
ports:
- "80:80"
- "443:443"
- "8080:8080"
volumes:
- '/var/run/docker.sock:/var/run/docker.sock'
sablier:
image: ghcr.io/acouvreur/sablier:1
command:
- --swarmMode=true
volumes:
- '/var/run/docker.sock:/var/run/docker.sock'
deploy:
labels:
- traefik.enable=true
- traefik.http.middlewares.ondemand.plugin.sablier.name=DOCKER_SWARM_nginx
- traefik.http.middlewares.ondemand.plugin.sablier.serviceUrl=http://sablier:10000
- traefik.http.middlewares.ondemand.plugin.sablier.timeout=1m
- traefik.http.services.ondemand.loadbalancer.server.port=10000
nginx:
image: nginx
deploy:
replicas: 0
labels:
- traefik.enable=true
# If you do not use the swarm load balancer, traefik will evict the service from its pool
# as soon as the service is 0/0. If you do not set that, fallback to dynamic-config.yml file usage.
- traefik.docker.lbswarm=true
- traefik.http.routers.nginx.middlewares=ondemand@docker
- traefik.http.routers.nginx.rule=PathPrefix(`/nginx`)
- traefik.http.services.nginx.loadbalancer.server.port=80

View File

@@ -1,30 +0,0 @@
# Kubernetes
## Run the demo
# you need docker-compose, kubectl and helm (v3) installed
1. `git clone git@github.com:acouvreur/sablier.git`
2. `cd sablier/plugins/traefik/examples/kubernetes`
3. `docker-compose up`
4. Wait 1 minute
5. `export KUBECONFIG=./kubeconfig.yaml`
5. `helm repo add traefik https://helm.traefik.io/traefik`
6. `helm repo update`
7. Edit values.yaml and add your traefik pilot.token
8. `helm install traefik traefik/traefik -f values.yaml --namespace kube-system `
9. `kubectl apply -f deploy-whoami.yml`
10. `kubectl apply -f manifests.yml`
11. `kubectl scale deploy whoami --replicas=0`
12. Browse to http://localhost/
13. `kubectl get deployments -o wide`
```
NAME READY UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR
whoami 1/1 1 1 16m whoami containous/whoami app=whoami
```
13. After 1 minute: `kubectl get deployments -o wide`
```
NAME READY UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR
whoami 0/0 0 0 17m whoami containous/whoami app=whoami`
```
14. Browse to http://localhost/

View File

@@ -1,49 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: whoami
spec:
replicas: 1
selector:
matchLabels:
app: whoami
template:
metadata:
labels:
app: whoami
spec:
containers:
- name: whoami
image: containous/whoami
---
apiVersion: v1
kind: Service
metadata:
name: whoami-service
spec:
ports:
- name: http
targetPort: 80
port: 80
selector:
app: whoami
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: whoami-ingress
annotations:
kubernetes.io/ingress.class: traefik
traefik.ingress.kubernetes.io/router.middlewares: default-ondemand-whoami@kubernetescrd
spec:
rules:
- host: localhost
http:
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
name: whoami-service
port:
number: 80

View File

@@ -1,29 +0,0 @@
version: '3'
services:
server:
image: "rancher/k3s:${K3S_VERSION:-latest}"
command: server --no-deploy traefik
tmpfs:
- /run
- /var/run
ulimits:
nproc: 65535
nofile:
soft: 65535
hard: 65535
privileged: true
restart: always
environment:
- K3S_KUBECONFIG_OUTPUT=/output/kubeconfig.yaml
- K3S_KUBECONFIG_MODE=666
volumes:
- k3s-server:/var/lib/rancher/k3s
# This is just so that we get the kubeconfig file out
- .:/output
ports:
- 6443:6443 # Kubernetes API Server
- 80:80 # Ingress controller port 80
- 443:443 # Ingress controller port 443
volumes:
k3s-server: {}

View File

@@ -1,86 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: sablier
namespace: kube-system
labels:
app: sablier
spec:
replicas: 1
selector:
matchLabels:
app: sablier
template:
metadata:
labels:
app: sablier
spec:
serviceAccountName: sablier
serviceAccount: sablier
containers:
- name: sablier
image: ghcr.io/acouvreur/sablier:1
args: ["--swarmMode=false", "--kubernetesMode=true"]
ports:
- containerPort: 10000
---
apiVersion: v1
kind: Service
metadata:
name: sablier
namespace: kube-system
spec:
selector:
app: sablier
ports:
- protocol: TCP
port: 10000
targetPort: 10000
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: sablier
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: sablier
namespace: kube-system
rules:
- apiGroups:
- apps
resources:
- deployments
- deployments/scale
verbs:
- patch
- get
- update
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: sablier
namespace: kube-system
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: sablier
subjects:
- kind: ServiceAccount
name: sablier
namespace: kube-system
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: ondemand-whoami
namespace: default
spec:
plugin:
sablier:
name: deployment_default_whoami_1
serviceUrl: 'http://sablier:10000'
timeout: 1m

View File

@@ -1,10 +0,0 @@
# traefik helm values
additionalArguments:
- "--pilot.token=XXXXX_YOURTOKEN_XXXXXXXXXXXXXXXX"
- "--experimental.plugins.sablier.modulename=github.com/acouvreur/sablier/plugins/traefik"
- "--experimental.plugins.sablier.version=v1.2.0"
- "--providers.kubernetesingress.allowEmptyServices=true"
experimental:
plugins:
enabled: true

View File

@@ -1,24 +0,0 @@
# Docker swarm
## Run the demo
1. `git clone git@github.com:acouvreur/sablier.git`
2. `cd sablier/plugins/traefik/examples/multiple_containers`
3. `docker swarm init`
4. `export TRAEFIK_PILOT_TOKEN=...`
5. `docker stack deploy -c docker-stack.yml DOCKER_SWARM`
6. Load `http://localhost/nginx`
7. Load `http://localhost/whoami`
8. After 1 minute whoami is scaled to 0/0
9. After 5 minutes nginx is scaled to 0/0
10. `docker stack rm DOCKER_SWARM`
## Limitations
### Define a middleware per service/container
Due to Traefik plugin, the interface is to provide a config and a `ServeHTTP` request.
This function has no access to the Traefik configuration, thus no way to determine the container/service associated to the request.
See https://github.com/acouvreur/sablier/issues/8#issuecomment-931940533.

View File

@@ -1,65 +0,0 @@
version: "3.9"
services:
traefik:
image: traefik
command:
- --api=true
- --api.insecure=true
- --pilot.token=$TRAEFIK_PILOT_TOKEN
- --experimental.plugins.sablier.moduleName=github.com/acouvreur/sablier/plugins/traefik
- --experimental.plugins.sablier.version=v1.2.0
- --providers.docker=true
- --providers.docker.swarmmode=true
- --providers.file.filename=/etc/traefik/dynamic-config.yml
- --entrypoints.http.address=:80
- --entrypoints.https.address=:443
ports:
- "80:80"
- "443:443"
- "8080:8080"
volumes:
- '/var/run/docker.sock:/var/run/docker.sock'
sablier:
image: ghcr.io/acouvreur/sablier:1
command:
- --swarmMode=true
volumes:
- '/var/run/docker.sock:/var/run/docker.sock'
deploy:
labels:
- traefik.enable=true
- traefik.http.middlewares.ondemand-nginx.plugin.sablier.name=DOCKER_SWARM_nginx
- traefik.http.middlewares.ondemand-nginx.plugin.sablier.serviceUrl=http://sablier:10000
- traefik.http.middlewares.ondemand-nginx.plugin.sablier.timeout=5m
- traefik.http.middlewares.ondemand-whoami.plugin.sablier.name=DOCKER_SWARM_whoami
- traefik.http.middlewares.ondemand-whoami.plugin.sablier.serviceUrl=http://sablier:10000
- traefik.http.middlewares.ondemand-whoami.plugin.sablier.timeout=1m
- traefik.http.services.ondemand.loadbalancer.server.port=10000
nginx:
image: nginx
deploy:
replicas: 0
labels:
- traefik.enable=true
# If you do not use the swarm load balancer, traefik will evict the service from its pool
# as soon as the service is 0/0. If you do not set that, fallback to dynamic-config.yml file usage.
- traefik.docker.lbswarm=true
- traefik.http.routers.nginx.middlewares=ondemand-nginx@docker
- traefik.http.routers.nginx.rule=PathPrefix(`/nginx`)
- traefik.http.services.nginx.loadbalancer.server.port=80
whoami:
image: containous/whoami
deploy:
replicas: 0
labels:
- traefik.enable=true
- traefik.docker.lbswarm=true
- traefik.http.routers.whoami.middlewares=ondemand-whoami@docker
- traefik.http.routers.whoami.rule=PathPrefix(`/whoami`)
- traefik.http.services.whoami.loadbalancer.server.port=80

Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -1,26 +0,0 @@
pilot:
token: "$TRAEFIK_PILOT_TOKEN"
api:
dashboard: true
insecure: true
experimental:
plugins:
sablier:
moduleName: "github.com/acouvreur/sablier/plugins/traefik"
version: "v0.1.1"
entryPoints:
http:
address: ":80"
forwardedHeaders:
insecure: true
providers:
docker:
swarmMode: true
exposedByDefault: false
file:
filename: "/etc/traefik/config.yml"
watch: true

View File

@@ -1,22 +0,0 @@
pilot:
token: "$TRAEFIK_PILOT_TOKEN"
api:
dashboard: true
insecure: true
experimental:
localPlugins:
sablier:
moduleName: github.com/acouvreur/sablier/plugins/traefik
entryPoints:
http:
address: ":80"
forwardedHeaders:
insecure: true
providers:
docker:
swarmMode: true
exposedByDefault: false