Introduction
In this guide, we will walk through the steps to deployPrerequisites
Before we begin, ensure you have the following prerequisites in place:- A server or virtual machine with Docker installed.
- A Cloudflare account with a domain configured.
- Basic knowledge of Docker and Traefik.
Logical Diagram
Step 1: Deploy Traefik with Docker
a. Create adocker-compose.yml file to define the Traefik service:
Notes:
- Replace the placeholder bcrypt hash above with a real hash. You can generate one at https://bcrypt-generator.com/ or using the
htpasswdtool. - Define external network for Traefik to communicate with other services
- Define the external network for Traefik to communicate with other services
Create the directory for Traefik data if it doesn’t exist
Create the acme.json file to store TLS certificates
Set strict permissions so only the owner can read/write (required by Traefik)
traefik.yml configuration file inside the traefik-data directory:
Step 2: Configure Cloudflare DNS
a. Log in to your Cloudflare account and navigate to the DNS settings for your domain. b. Add a CNAME record for your Traefik dashboard:- Type: CNAME
- Name: traefik
- Target: your-server-ip-or-domain
- TTL: Auto c. Ensure that the proxy status is enabled (orange cloud icon) for the CNAME record.
Step 3: Access the Traefik Dashboard
- Open your web browser and navigate to
https://traefik.your-domain.com. - You should see the Traefik dashboard login prompt. Enter the username and password you configured in the
docker-compose.ymlfile. - Once logged in, you can monitor and manage your Traefik instance.