https://github.com/oanhnn/example-traefik-proxy-auto-ssl
:+1: An example for setting auto proxy and auto setup SSL with Traefik 2.0
https://github.com/oanhnn/example-traefik-proxy-auto-ssl
auto-ssl docker docker-compose example traefik traefik-v2
Last synced: 30 days ago
JSON representation
:+1: An example for setting auto proxy and auto setup SSL with Traefik 2.0
- Host: GitHub
- URL: https://github.com/oanhnn/example-traefik-proxy-auto-ssl
- Owner: oanhnn
- License: mit
- Created: 2019-09-24T02:48:07.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-12-31T07:03:12.000Z (over 5 years ago)
- Last Synced: 2025-03-28T12:30:02.343Z (about 1 year ago)
- Topics: auto-ssl, docker, docker-compose, example, traefik, traefik-v2
- Language: Shell
- Size: 18.6 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: .github/README.md
- License: LICENSE
Awesome Lists containing this project
README
# oanhnn/example-traefik-proxy-auto-ssl
An example for setting auto proxy and auto setup SSL with Traefik 2
## Refs
- https://docs.traefik.io/
## 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
```bash
$ docker network create --driver=overlay reverse-proxy
```
- Update docker node label if you run with Docker Swarm mode
```bash
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`
```bash
$ docker-compose -f docker-compose/traefik.yml up -d
```
With Docker Swarm mode
```bash
$ 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`
```bash
$ docker-compose -f docker-compose/whoami.yml up -d
```
With Docker Swarm mode
```bash
set -a; source .env; set +a; docker stack deploy -c docker-swarm/whoami.yml
```
- Now your service was lauch and proxy with SSL.
```bash
$ 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](https://github.com/oanhnn/example-traefik-proxy-auto-ssl/issues).
## License
This project is released under the MIT License.
Copyright © 2021 [Oanh Nguyen](https://github.com/oanhnn)
Please see [License File](https://github.com/oanhnn/example-traefik-proxy-auto-ssl/blob/master/LICENSE) for more information.