This project was heavily influenced by this tutorial and this project.
Note:
Since the time that the above mentioned resources were authored,
Traefik has undergone a huge change from 1.7
to 2.0
.
Virtually everything about Traefik configuration changed in this major version update.
Be sure to read Traefik's
documentation
and look closely at the docker-compose.yml
file in this project.
- Docker
- Docker Compose
- A domain provided by Cloudflare
- A linux box to deploy to ;)
-
Create a directory that will serve as the home for your docker services.
mkdir ~/docker && cd ~/docker
-
Clone this repo into the newly created directory as "traefik".
git clone https://github.com/sonofborge/dockerize-traefik.git traefik && cd traefik
-
Create
.env
file and modify the variables to fit your needs.cp .env-example .env vim .env
# Example: .env file CF_API_KEY=mycloudflareapikey [email protected] DOMAIN_NAME=domain.com
-
Generate a user/password hash with
htpasswd
and store the output inconfig/usersfile
.htpasswd -nB $USER
-
Create "acme.json" and restrict file permissions.
touch letsencrypt/acme.json && chmod 600 letsencrypt/acme.json
-
Create the docker network.
docker network create traefik_proxy
-
Spin up the service.
docker-compose up -d
For troubleshooting and logging, run the following command:
tail -f log/accessLog.txt tail -v log/traefik.log
If all went well, you should now have a traefik reverse proxy all set up!