Skip to content

behnambm/traefik

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Traefik Configuration

Welcome to my very first Traefik configuration! I've got some things that you need to manage your web traffic, including routers, middlewares, and TLS.

Routers: Keep Your Traffic Flowing

To ensure a seamless user experience, I've set up the following routers:

  • Dashboard: Manage your traffic like a pro with Traefik's user-friendly dashboard.
  • Cat app: Let users access your cat app.
  • Whoami: Check that your configurations are working smoothly with this useful tool.
  • Prometheus: Monitor your traffic and gather key insights with this powerful tool.
  • Grafana: Get a comprehensive overview of your web traffic metrics and stay ahead of the game.
  • Custom error page: Keep your users engaged even when things go wrong with a custom error page.

Middlewares: Take Your Traffic Management to the Next Level

My middlewares provide the following features to take your traffic management to the next level:

  • Basic Auth (admin:admin): Keep your content secure with basic authentication.
  • Rate limit: Prevent server overload by setting limits on the number of requests.
  • Custom error page: Engage your users even when something goes wrong with a custom error page.
  • Compress: Make your website load faster and reduce bandwidth usage.

TLS: Secure Your Traffic

I'm using Let's Encrypt with DNS challenge and Cloudflare API to ensure your traffic is always secure.


Configuration

Ready to get started? Here's what you need to do:

Clone the Repo

Clone my repo with this command:

git clone https://github.com/behnambm/traefik.git

Env File

Create a file named .compose.env and store your Cloudflare API key (Global API Key) with the following format:

CF_API_KEY=YOUR_KEY
CF_API_EMAIL=YOUR_EMAIL@MAIL.COM

Don't forget to set an A record pointing to your domain in Cloudflare. Make sure it's a wildcard record, e.g., *.example.com.

Host Name

Some files, like docker-compose.yml and dynamic.yml, require you to change the host name to your own.

Create acme file

touch configs/letsencrypt/acme.json

chmod 600 configs/letsencrypt/acme.json

Run

Start Traefik with the following command:

docker compose up -d

To check for any errors, run the following command:

docker compose logs traefik

Screenshots

Traefik dashboard

Screenshot from 2023-02-17 23-57-25 Screenshot from 2023-02-17 23-57-47

Prometheus

Screenshot from 2023-02-18 00-01-29

Grafana

Screenshot from 2023-02-18 00-10-15

And that's it! Your web traffic is now under your control with Traefik. Thanks for checking out my configuration!

About

Traefik training practice configurations

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published