Skip to content

Streamline microservices deployment with Traefik and Docker Compose.

License

Notifications You must be signed in to change notification settings

Lindwen/traefik-docker-compose

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

traefik-docker-compose

Streamline microservices deployment with Traefik and Docker Compose. And secure your website with security headers.

Traefik

Traefik is a modern HTTP reverse proxy and load balancer that makes deploying microservices easy. Traefik integrates with your existing infrastructure components and configures itself automatically and dynamically.

Docker Compose

Docker Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application's services.

Usage

Prerequisites

Make sure you have the following installed:

Configuration

  1. Clone the repository and navigate to it:
git clone https://github.com/Lindwen/traefik-docker-compose.git
cd traefik-docker-compose
  1. Create acme.json file for traefik:
touch acme.json
chmod 600 acme.json
  1. Configure the traefik.toml file by changing the email address:
# Change the email address
[certificatesResolvers.letsencrypt.acme]
  email = "YOUR_EMAIL_ADDRESS"
  1. Configure labels:

Edit docker-compose.yml and example/docker-compose.yml :

vi docker-compose.yml
# [required] Change the domain name
- "traefik.http.routers.<service>.rule=Host(`YOUR_DOMAIN_NAME`)"
# example:
- "traefik.http.routers.dashboard.rule=Host(`traefik.example.com`)"

# [required] Add auth
- "traefik.http.routers.<service>.middlewares=auth"
- "traefik.http.middlewares.auth.basicauth.users=<username>:<password>" # password generated with htpasswd (Bcrypt) and double $
# example:
- "traefik.http.routers.dashboard.middlewares=auth"
- "traefik.http.middlewares.auth.basicauth.users=Example:$$2a$$10$$Bls.hNkCW3m4lBz9a592IOfom6U0dmFvIP9UUz.4VWbWF0x8Kn3WG"

Start

To start traefik:

docker compose up -d

Stop

To stop the container:

docker compose down

Logs

To view live logs:

docker compose logs -f

You can go to check your website to: https://traefik.example.com And register with your user / password

Example website

  1. Go to example dir: traefik-docker-compose/example
  2. Edit .env (remove .dist)
# The service name (for example "website")
service=
# The domain name (for example "website.domain.tld")
domain=
  1. Launch : docker compose up -d

Need Help?

If you encounter any issues, need help, or have questions, please don't hesitate to reach out. You can create an issue here on GitHub. We're here to assist you and improve this project based on your feedback.

How to Create an Issue

  1. Click on the "Issues" tab at the top of this repository.
  2. Click the green "New Issue" button.
  3. Provide a descriptive title and detailed description of the problem you're facing or the help you need.
  4. Submit the issue, and we'll get back to you as soon as possible.

Your feedback is valuable, and we appreciate your contributions to making this project better.


Thanks

About

Streamline microservices deployment with Traefik and Docker Compose.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages