Skip to content

👍 An example for setting auto proxy and auto setup SSL with Traefik 2.0

License

Notifications You must be signed in to change notification settings

oanhnn/example-traefik-proxy-auto-ssl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

oanhnn/example-traefik-proxy-auto-ssl

An example for setting auto proxy and auto setup SSL with Traefik 2

Refs

Requirements

  • Docker Engine 17.12.0+
  • Docker Compose 1.18.0+

Usage

  • Clone this project and set environment variables by .env file (see .env.example file).

  • Create docker network for reverse proxy

    $ docker network create --driver=overlay reverse-proxy
  • Update docker node label if you run with Docker Swarm mode

    docker node update --label-add node-has-traefik-service=true $(docker info -f '{{.Swarm.NodeID}}') > /dev/null
  • Launch the traefik-proxy stack
    With docker-compose

    $ docker-compose -f docker-compose/traefik.yml up -d

    With Docker Swarm mode

    $ set -a; source .env; set +a; docker stack deploy -c docker-swarm/traefik.yml

    NOTE Docker dosen't load .env file. So that you load it by add set -a; source .env; set +a; before docker command

  • Create example service in reverse-proxy docker network like whoami service
    With docker-compose

    $ docker-compose -f docker-compose/whoami.yml up -d

    With Docker Swarm mode

    set -a; source .env; set +a; docker stack deploy -c docker-swarm/whoami.yml
  • Now your service was lauch and proxy with SSL.

    $ curl -H "Host: app.example.com" https://127.0.0.1/
  • Traefik dashboard was lauch in URL https://traefik.example.com/dashboard and secured with basic authentication and whilelist IP

NOTE You can use setup.sh script in docker-compose and docker-swarm for easier

Contributing

All code contributions must go through a pull request and approved by a core developer before being merged. This is to ensure proper review of all the code.

Fork the project, create a feature branch, and send a pull request.

If you would like to help take a look at the list of issues.

License

This project is released under the MIT License.
Copyright © 2021 Oanh Nguyen
Please see License File for more information.

About

👍 An example for setting auto proxy and auto setup SSL with Traefik 2.0

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages