-
-
Notifications
You must be signed in to change notification settings - Fork 332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update traefik to v2.x #396
base: main
Are you sure you want to change the base?
Changes from all commits
cfca328
b2d33ce
262ea88
ebdd51f
6aa4d31
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
services: | ||
registry-ui: | ||
image: joxit/docker-registry-ui:latest | ||
environment: | ||
- SINGLE_REGISTRY=true | ||
- REGISTRY_TITLE=Docker Registry UI | ||
# For deleting images, you need to activate the delete feature in the UI with DELETE_IMAGES=true and in your registry. | ||
- DELETE_IMAGES=true | ||
- SHOW_CONTENT_DIGEST=true | ||
- NGINX_PROXY_PASS_URL=http://registry:5000 | ||
- SHOW_CATALOG_NB_TAGS=true | ||
- CATALOG_MIN_BRANCHES=1 | ||
- CATALOG_MAX_BRANCHES=1 | ||
- TAGLIST_PAGE_SIZE=100 | ||
- REGISTRY_SECURED=true | ||
- CATALOG_ELEMENTS_LIMIT=1000 | ||
networks: | ||
- traefik-net | ||
deploy: | ||
replicas: 1 | ||
restart_policy: | ||
condition: on-failure | ||
labels: | ||
- "traefik.enable=true" | ||
- "traefik.http.routers.registryui.rule=Host(`myregistry.com`)" | ||
- "traefik.http.routers.registryui.entrypoints=web" | ||
- "traefik.http.services.registryui.loadbalancer.server.port=80" | ||
- "traefik.http.routers.registryui.service=registryui" | ||
registry: | ||
image: registry:2.8.3 | ||
volumes: | ||
- ./images:/var/lib/registry | ||
- ./htpasswd:/auth | ||
environment: | ||
- REGISTRY_AUTH=htpasswd | ||
- REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm | ||
- REGISTRY_AUTH_HTPASSWD_PATH=/auth | ||
- REGISTRY_HTTP_RELATIVEURLS=true | ||
# For deleting images, you need to activate the delete feature in the registry. | ||
- REGISTRY_STORAGE_DELETE_ENABLED=true | ||
deploy: | ||
replicas: 1 | ||
restart_policy: | ||
condition: on-failure | ||
placement: | ||
constraints: | ||
- node.role == manager | ||
networks: | ||
- traefik-net | ||
|
||
networks: | ||
traefik-net: | ||
external: true |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
services: | ||
traefik: | ||
image: traefik:v2.11.8 | ||
ports: | ||
- "80:80" | ||
command: | ||
- --api.insecure=false # set to 'false' on production | ||
- --api.dashboard=true # see https://docs.traefik.io/v2.11/operations/dashboard/#secure-mode for how to secure the dashboard | ||
- --api.debug=false # enable additional endpoints for debugging and profiling | ||
- --log.level=INFO # debug while we get it working, for more levels/info see https://docs.traefik.io/observability/logs/ | ||
- --log.format=common | ||
- --accesslog=true | ||
- --accesslog.fields.names.StartUTC=drop | ||
- --providers.docker=true | ||
- --providers.docker.swarmMode=true | ||
- --providers.docker.exposedbydefault=false | ||
- --providers.docker.network=public | ||
- --entryPoints.web.address=:80 | ||
- --entryPoints.web.transport.respondingTimeouts.readTimeout=0 # https://doc.traefik.io/traefik/v2.11/routing/entrypoints/#respondingtimeouts | ||
- --entryPoints.web.transport.respondingTimeouts.idleTimeout=0 | ||
- --entryPoints.web.forwardedHeaders.insecure | ||
# - --entryPoints.websecure.address=:443 | ||
environment: | ||
- TZ=Asia/Shanghai | ||
volumes: | ||
- /var/run/docker.sock:/var/run/docker.sock | ||
networks: | ||
- traefik-net | ||
deploy: | ||
resources: | ||
limits: | ||
cpus: '4' | ||
memory: 8g | ||
reservations: | ||
cpus: '1' | ||
memory: 2g | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SUGGESTION: These limits and reservations are way to egregious for testing (even for some swarm productions)! I understand it's an example, but I feel we can be a little bit more responsible with examples. Traefik v2 takes up ~40MB RAM idle, you don't need reserve 2G (it's not V3! HA!) Suggested:
|
||
replicas: 1 | ||
restart_policy: | ||
condition: on-failure | ||
placement: | ||
constraints: | ||
- node.role == manager | ||
labels: | ||
- "traefik.enable=true" | ||
- "traefik.http.routers.dashboard.rule=Host(`mytraefik.com`) && (PathPrefix(`/api`) || PathPrefix(`/dashboard`))" | ||
- "traefik.http.routers.dashboard.service=api@internal" # Let the dashboard access the traefik api | ||
- "traefik.http.routers.dashboard.entrypoints=web" # Let the dashboard access the traefik api | ||
- "traefik.http.services.traefik.loadbalancer.server.port=9090" | ||
- "traefik.http.middlewares.auth.basicauth.users=admin:$apr1$XXrpwZre$ItZSXpoeB6bdPLCGT7eXG0" | ||
- "traefik.http.routers.dashboard.middlewares=auth" | ||
|
||
networks: | ||
traefik-net: | ||
external: true |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
admin:$apr1$XXrpwZre$ItZSXpoeB6bdPLCGT7eXG0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,37 +6,6 @@ if ! [[ `docker network ls | grep "traefik-net"` ]] &>/dev/null; then | |
fi | ||
|
||
|
||
if ! [[ `docker service ls | grep "traefik2"` ]] &>/dev/null; then | ||
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
docker stack deploy --compose-file docker-compose-swarm-traefik.yml docker-traefik | ||
|
||
# ensure acme.json wich will contains the letsencrypt certificates | ||
touch "$dir"/acme.json && chmod 600 "$dir"/acme.json | ||
|
||
docker service create --name traefik2 --detach=false \ | ||
--constraint node.role==manager \ | ||
--update-parallelism 1 --update-delay 10s \ | ||
--mode global \ | ||
--publish 80:80 \ | ||
--publish 443:443 \ | ||
--read-only \ | ||
--mount type=bind,source="$(pwd)"/acme.json,target=/etc/traefik/acme.json \ | ||
--mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock \ | ||
--network traefik-net \ | ||
traefik:1.7.4-alpine \ | ||
--entrypoints='Name:http Address::80 Redirect.EntryPoint:https' \ | ||
--entrypoints='Name:https Address::443 TLS' \ | ||
--defaultentrypoints=http,https \ | ||
--acme \ | ||
--acme.storage=/etc/traefik/acme.json \ | ||
--acme.entryPoint=https \ | ||
--acme.httpChallenge.entryPoint=http \ | ||
[email protected] \ | ||
--docker \ | ||
--docker.swarmMode \ | ||
--docker.domain=mydomain.com \ | ||
--docker.exposedByDefault=false \ | ||
--docker.watch \ | ||
--api | ||
fi | ||
|
||
docker stack deploy --compose-file docker-compose-swarm.yml docker-registry | ||
docker stack deploy --compose-file docker-compose-swarm-registry.yml docker-registry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SUGGESTION:
Again, make it neutral to the most amount of people.
TZ=UTC
would be neutral.