containerize-my-server / reverse-proxy

Examplary docker-compose setup for Træfik with letsencrypt.org
Other
113 stars 35 forks source link

Motivation

Docker-compose setup for starting Træfik as reverse-proxy, loadbalancer and SSL server with lets-encrypt certificates.

Usage

Clone this repository reverse-proxy, change mail-address and domain, and then run docker-compose up -d to startup the service.

git clone https://github.com/docker-compose-examples/reverse-proxy
cd reverse-proxy
# Run `sed` or edit `traefik.toml` yourself
sed -i 's/letsencrypt\@example\.com/mail@my-domain.com/g' traefik.toml
sed -i 's/example\.com/my-domain.com/g' traefik.toml 
# Start the reverse proxy
docker-compose up -d

After that, you can "up" docker-compose.yml-files like:

version: '2'

services:
  microbot:
    image: dontrebootme/microbot
    labels:
    - "traefik.enable=true"
    - "traefik.backend=microbot"
    - "traefik.frontend.rule=Host:microbot.example.com"
    - "traefik.docker.network=reverseproxy_default"
    networks:
    - "reverseproxy_default"
    restart: always
networks:
  reverseproxy_default:
    external:
      name: reverseproxy_default

and they will be served through the Træfik proxy.

Some details

  networks:
    - "reverseproxy_default"

and

networks:
  reverseproxy_default:
    external:
      name: reverseproxy_default

of the microbot-file make sure that microbot is in the same network as Træfik.

If microbot were present in two networks, the label traefik.docker.network=reverseproxy_default will tell Træfik which IP to use to connect to the service.

LICENSING

All files are mostly derived from each sofware's documentation. Treat this example as public domain (CC0). It took a while to get it running, but the amount of work was not high enough to put it under any license.

Contributing

If you want to help out in keeping this repository up-to-date, please contact me or add a comment here