2020-04-25 09:13:45 +00:00
|
|
|
# traefik
|
|
|
|
|
2020-04-28 12:56:02 +00:00
|
|
|
[![Build Status](https://drone.autonomic.zone/api/badges/autonomic-cooperative/traefik/status.svg)](https://drone.autonomic.zone/autonomic-cooperative/traefik)
|
|
|
|
|
2020-04-25 09:13:45 +00:00
|
|
|
> https://docs.traefik.io/
|
2020-04-28 13:07:48 +00:00
|
|
|
|
|
|
|
> https://traefik.swarm.autonomic.zone
|
2020-04-30 10:21:28 +00:00
|
|
|
|
2020-04-30 10:23:18 +00:00
|
|
|
## Development
|
2020-04-30 10:21:28 +00:00
|
|
|
|
|
|
|
```bash
|
2020-04-30 10:23:18 +00:00
|
|
|
$ python3 -m venv .venv && source .venv/bin/activate
|
|
|
|
$ pip install -U pip setuptools docker-compose
|
2020-04-30 10:21:28 +00:00
|
|
|
$ docker-compose up
|
|
|
|
```
|
|
|
|
|
|
|
|
Traefik dashboard:
|
|
|
|
|
|
|
|
> http://traefik.localhost
|
|
|
|
|
|
|
|
Test application:
|
|
|
|
|
|
|
|
> http://whoami.localhost
|
|
|
|
|
|
|
|
Also available via (testing routing of proxy):
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ curl -H Host:whoami.localhost http://127.0.0.1
|
|
|
|
```
|
|
|
|
|
|
|
|
## Production
|
|
|
|
|
|
|
|
Our [drone.autonomic.zone](https://drone.autonomic.zone/autonomic-cooperative/traefik/) configuration automatically deploys.
|
|
|
|
|
2020-04-30 10:23:18 +00:00
|
|
|
To do it manually, you need to follow 3 steps.
|
2020-04-30 10:21:28 +00:00
|
|
|
|
2020-04-30 10:23:18 +00:00
|
|
|
1. Create the remote docker context locally.
|
2020-04-30 10:21:28 +00:00
|
|
|
|
|
|
|
```bash
|
|
|
|
$ cp .envrc.sample .envrc
|
|
|
|
$ direnv allow # ensure password store works
|
|
|
|
$ make config
|
|
|
|
$ make context
|
|
|
|
$ docker context use swarm.autonomic.zone
|
|
|
|
```
|
|
|
|
|
|
|
|
2. Deploy the application to the remote docker context.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ docker stack deploy \
|
|
|
|
--compose-file docker-compose.yml \
|
|
|
|
-c docker-compose.production.yml \
|
|
|
|
traefik
|
|
|
|
```
|
|
|
|
|
2020-04-30 10:23:18 +00:00
|
|
|
You can track logs via `docker service logs traefik_traefik`
|
|
|
|
|
2020-04-30 10:21:28 +00:00
|
|
|
3. Switch back to your local context.
|
|
|
|
|
|
|
|
```
|
|
|
|
$ docker context use default
|
|
|
|
```
|