GithubHelp home page GithubHelp logo

vegasbrianc / reverse-proxy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from containerize-my-server/reverse-proxy

0.0 3.0 0.0 4 KB

Examplary docker-compose setup for Træfik with letsencrypt.org

License: Other

reverse-proxy's Introduction

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/[email protected]/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.

  • Træfik will forward requests to https://microbot.example.com to the backend.
  • Træfik will order SSL certificates through letsencrypt.org
  • Træfik will balance the requests between multiple backends with the same name, which means additional instance created by docker-compose scale microbot=3 will automatically be used when available.
  • Requests to http://microbot.example.com will be redirected to https

Some details

  • The label traefik.frontend.rule=Host:microbot.example.com is used by Træfik to determine which container to use for which domain.
  • The option exposedbydefault = false tells Træfik to only include containers with the label traefik.enable=true.
  • Since the gist-files are inside the directory reverse-proxy, docker-compose will create a network reverseproxy_default for the container. The part
  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.

reverse-proxy's People

Contributors

nknapp avatar vegasbrianc avatar ubershmekel avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.