Minimal Traefik stuff to set up ur networking on a single docker host. Supports LetsEncrypt certificates.
- Clone the repository
- Create a docker network and name it proxy:
docker network create traefik-proxy - create
.envfrom.env.default - create
conf/.htpasswdfromconf/.htpasswd.default - edit
conf/traefik.prod.ymland change theemailaddress used while generating certificates - Expose containers using stuff like:
myservice:
labels:
- "traefik.enable=true"
- "traefik.http.routers.my-app.entrypoints=web"
- "traefik.http.routers.my-app.rule=Host(`my-app.localhost`)"
networks:
- traefik-proxy- Use
websecureentrypoint for SSL support:
myservice:
labels:
- "traefik.enable=true"
- "traefik.http.routers.my-app.entrypoints=websecure"
- "traefik.http.routers.my-app.rule=Host(`mystartup.com`)"
networks:
- traefik-proxy- All comands support ENV=prod/dev (dev is default)
$ make upto run in development mode (non-https)$ ENV=prod make upto run in production mode$ ENV=prod make bulidto run in production mode$ ENV=prod make downto run in production mode$ ENV=prod make stopto run in production mode$ ENV=prod make psto run in production mode
- Use *.localhost rules on your containers and services to 'expose' them.
traefik-proxyis the name of the external network- By defaul when local monitor available at: http://traefik.localhost/ (user admin, pass: admin)
- Use Apache tools:
htpasswd -nb admin my_not_so_secret_pass - Or some online editor like this one
By Daniel Morales License: Released under the MIT license