Welcome To How To Install Traefik
This page will go through how to install traefik
Setting the software up
First steps
Ensure you have docker installed
Now create the config folder
To do this cd to /etc using the
cd /etc command
now type
sudo mkdir traefik
this will make the directory we need
Sudo Nano /etc/traefik/traefik.yml
Once you have opened traefik.yml paste in the below commands
global:
checkNewVersion: true
sendAnonymousUsage: false # true by default
# (Optional) Log information
# —
# log:
# level: ERROR # DEBUG, INFO, WARNING, ERROR, CRITICAL
# format: common # common, json, logfmt
# filePath: /var/log/traefik/traefik.log
# (Optional) Accesslog
# —
# accesslog:
# format: common # common, json, logfmt
# filePath: /var/log/traefik/access.log
# (Optional) Enable API and Dashboard
# —
# api:
# dashboard: true # true by default
# insecure: true # Don’t do this in production!
# Entry Points configuration
# —
entryPoints:
web:
address: :80
# (Optional) Redirect to HTTPS
# —
# http:
# redirections:
# entryPoint:
# to: websecure
# scheme: https
websecure:
address: :443
# Configure your CertificateResolver here…
# —
# certificatesResolvers:
# staging:
# acme:
# email: your-email@example.com
# storage: /etc/traefik/certs/acme.json
# caServer: “https://acme-staging-v02.api.letsencrypt.org/directory”
# httpChallenge:
# entryPoint: web
#
# production:
# acme:
# email: your-email@example.com
# storage: /etc/traefik/certs/acme.json
# caServer: “https://acme-v02.api.letsencrypt.org/directory”
# httpChallenge:
# entryPoint: web
# (Optional) Overwrite Default Certificates
# tls:
# stores:
# default:
# defaultCertificate:
# certFile: /etc/traefik/certs/cert.pem
# keyFile: /etc/traefik/certs/cert-key.pem
# (Optional) Disable TLS version 1.0 and 1.1
# options:
# default:
# minVersion: VersionTLS12
providers:
docker:
exposedByDefault: false # Default is true
file:
# watch for dynamic configuration changes
directory: /etc/traefik
watch: true
Next steps
uncomment the api section
# api:
# dashboard: true # true by default
# insecure: true # Don’t do this in production!
uncomment the certification parts
# certificatesResolvers:
# staging:
# acme:
# email: your-email@example.com
# storage: /etc/traefik/certs/acme.json
# caServer: “https://acme-stagingv02.api.letsencrypt.org/directory”
# httpChallenge:
# entryPoint: web
to uncomment remove the #
once that is done if you used nano to edit the file press ctrl + x
if you used VIM :qw
Starting Traefik Using Portainer
Check out my other guide and install portainer Here
then just create a new stack
call it traefik and paste the following commands in
version: ‘3’ | |
services: | |
traefik: | |
image: “traefik:v2.5” | |
container_name: “traefik” | |
ports: | |
– “80:80” | |
– “443:443” | |
# (Optional) Expose Dashboard | |
– “8080:8080” # Don’t do this in production! | |
volumes: | |
– /etc/traefik:/etc/traefik | |
– /var/run/docker.sock:/var/run/docker.sock:ro |
then hit create and it should all be up and working
to access the gui go to
http://IPAddressofserver:8080/dashboard#/