Hi,
today, traefik stopped working, with the error traefik error: field not found, node: swarmModeRefreshSeconds
I do not use swarm, but I do have that option in traefik.yml
What should I do?
version: '3'
services:
traefik:
container_name: traefik
image: traefik:latest
ports:
- 80:80
- 443:443
# - 8383:8080 # Dashboard port
volumes:
# - /var/run/docker.sock:/var/run/docker.sock:ro
- /volume1/docker/security/traefik/:/etc/traefik/
- /var/log/crowdsec/:/var/log/crowdsec/
- /volume1/docker/security/traefik/plugins:/plugins-local
# networks:
# - proxy # rename this to your custom docker network
networks:
macvlan_nas:
ipv4_address: 192.168.1.6
lan-traefik:
labels:
traefik.http.routers.api.rule: Host(`traefik.xxxx.duckdns.org`) # Define the subdomain for the traefik dashboard.
traefik.http.routers.api.entryPoints: https # Set the Traefik entry point.
traefik.http.routers.api.service: api@internal # Enable Traefik API.
traefik.http.services.dummy.loadBalancer.server.port: 65535
# traefik.http.routers.traefik.middlewares: local-ipwhitelist@file
traefik.http.routers.api.middlewares: dashboard-ipwhitelist
traefik.http.middlewares.dashboard-ipwhitelist.ipWhiteList.sourceRange: "127.0.0.1/32,192.168.1.0/24"
# traefik.http.routers.traefik-secure.middlewares: local-ipwhitelist
traefik.enable: true # Enable Traefik reverse proxy for the Traefik dashboard.
environment:
DOCKER_HOST: dockersocket
DUCKDNS_TOKEN: token
restart: unless-stopped
depends_on:
- dockersocket
Thanks!
Share Traefik static config file traefik.yml
.
traefik:latest
Docker image was probably changed from v2 to v3 (tags ).
global:
checkNewVersion: true
sendAnonymousUsage: false
serversTransport:
insecureSkipVerify: true
entryPoints:
# Not used in apps, but redirect everything from HTTP to HTTPS
http:
address: :80
# forwardedHeaders:
# trustedIPs: &trustedIps
# # Start of Clouflare public IP list for HTTP requests, remove this if you don't use it
# - 173.245.48.0/20
# - 103.21.244.0/22
# - 103.22.200.0/22
# - 103.31.4.0/22
# - 141.101.64.0/18
# - 108.162.192.0/18
# - 190.93.240.0/20
# - 188.114.96.0/20
# - 197.234.240.0/22
# - 198.41.128.0/17
# - 162.158.0.0/15
# - 104.16.0.0/12
# - 172.64.0.0/13
# - 131.0.72.0/22
# - 2400:cb00::/32
# - 2606:4700::/32
# - 2803:f800::/32
# - 2405:b500::/32
# - 2405:8100::/32
# - 2a06:98c0::/29
# - 2c0f:f248::/32
# # End of Cloudlare public IP list
http:
redirections:
entryPoint:
to: https
scheme: https
# HTTPS endpoint, with domain wildcard
https:
address: :443
# forwardedHeaders:
# Reuse list of Cloudflare Trusted IP's above for HTTPS requests
# trustedIPs: *trustedIps
http:
tls:
# Generate a wildcard domain certificate
certResolver: letsencrypt
domains:
- main: xxxx.duckdns.org
sans:
- '*.xxxx.duckdns.org'
middlewares:
- securityHeaders@file
- crowdsec-bouncer@file
providers:
providersThrottleDuration: 2s
# File provider for connecting things that are outside of docker / defining middleware
file:
filename: /etc/traefik/fileConfig.yml
watch: true
# Docker provider for connecting all apps that are inside of the docker network
docker:
watch: true
network: macvlan_nas # Add Your Docker Network Name Here
# Default host rule to containername.domain.example
defaultRule: "Host(`{{ index .Labels \"com.docker.compose.service\"}}.xxxx.duckdns.org`)"
swarmModeRefreshSeconds: 15s
exposedByDefault: false
endpoint: "tcp://dockersocket:2375" # Uncomment if you are using docker socket proxy
# Enable traefik ui
api:
dashboard: true
insecure: true
# Log level INFO|DEBUG|ERROR
log:
level: DEBUG
# Use letsencrypt to generate ssl serficiates
certificatesResolvers:
letsencrypt:
acme:
email: xxxx@gmail.com
storage: /etc/traefik/acme.json
dnsChallenge:
provider: duckdns
# Used to make sure the dns challenge is propagated to the rights dns servers
resolvers:
- "192.168.1.172:53"
accessLog:
filePath: "/var/log/crowdsec/traefik.log"
bufferingSize: 50
experimental:
plugins:
geoblock:
moduleName: github.com/nscuro/traefik-plugin-geoblock
version: v0.14.0
JohnDF
April 30, 2024, 8:38am
4
HI, find this line
swarmModeRefreshSeconds: 15s
and comment it out.
This worked for me (not sure what impact it might have later!)
John DF
Working, thanks. I assume nothing will happen if we do not use swarm
Guys, read the website: Traefik V3 Migration Documentation - Traefik
Docker image has moved to Traefik v3, so there are migration changes required.
'In v3, the provider Docker has been split into 2 providers:
Docker provider (without Swarm support)
Swarm provider (Swarm support only)'
'In v3, the swarmMode
should not be used with the Docker provider, and, to use Swarm, the Swarm provider should be used instead'
Read the linked page above for config file changes. Commenting out those lines will be fine.
JohnDF
April 30, 2024, 10:48pm
7
Thanks. I’ll need to read up a bit more … instead of automatically updating. RTFM
Traefik has versioning according to semver :
Major.Minor.Patch
Major versions usually include breaking changes.
When using Docker, an image with tag like traefik:v2
will usually keep you updated for a while without breaking changes. Note that you need to pull
for updates.
At some point the old major release will not be maintained anymore (bug & security fixes), so you need to update to next major version (in a controlled manner).