charliecano / dockerize-traefik

Traefik reverse proxy inside a container.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dockerize Traefik

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.

Prerequisites

Up and Running

  1. Create a directory that will serve as the home for your docker services.

    mkdir ~/docker && cd ~/docker
  2. Clone this repo into the newly created directory as "traefik".

    git clone https://github.com/sonofborge/dockerize-traefik.git traefik && cd traefik
  3. Create .env file and modify the variables to fit your needs.

    cp .env-example .env
    vim .env
    # Example: .env file
    
    CF_API_KEY=mycloudflareapikey
    CF_API_EMAIL=admin@domain.com
    DOMAIN_NAME=domain.com
  4. Generate a user/password hash with htpasswd and store the output in config/usersfile.

    htpasswd -nB $USER
  5. Create "acme.json" and restrict file permissions.

    touch letsencrypt/acme.json && chmod 600 letsencrypt/acme.json
  6. Create the docker network.

    docker network create traefik_proxy
  7. 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!

About

Traefik reverse proxy inside a container.

License:MIT License