Skip to content

Commit

Permalink
update version traefik to 2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
smilelikeshit committed Jul 22, 2021
1 parent 8b28cc3 commit 22d05e8
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 8 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,18 @@

# for more documentation #

https://docs.traefik.io/v2.1/
https://docs.traefik.io/v2.4/

# providers
- default using redis


# how to use
```bash
make start
make stop
```


# support tls
- put your certificates on the folder cert/
Empty file modified bin/start.sh
100644 → 100755
Empty file.
Empty file modified bin/stop.sh
100644 → 100755
Empty file.
21 changes: 18 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
version: '3.7'
services:
reverse-proxy:
image: traefik:v2.1
traefik:
image: traefik:v2.4
# Enables the web UI and tells Traefik to listen to docker
restart: unless-stopped
container_name: traefik-app
ports:
# The HTTP port
- "80:80"
Expand All @@ -16,7 +17,8 @@ services:
- ./cert:/data
- ./log:/log
- ./traefik.toml:/etc/traefik/traefik.toml # Traefik static config
- ./traefik.config.toml:/etc/traefik/traefik.config.toml # Traefik dynamic config
# enable if u want using providers file
#- ./traefik.config.toml:/etc/traefik/traefik.config.toml # Traefik dynamic config
networks:
- traefik-gateway
deploy:
Expand All @@ -25,9 +27,22 @@ services:
cpus: '0.25'
memory: '256M'

redis:
image: redis:6.2.4-alpine
restart: unless-stopped
container_name: traefik-redis
networks:
- traefik-gateway
deploy:
resources:
limits:
cpus: '0.15'
memory: '128M'


networks:
#make sure u've created the network below
#docker network create traefik-gateway -d bridge
traefik-gateway:
external:
name: gateway
2 changes: 1 addition & 1 deletion traefik.config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@
[tls]
[[tls.certificates]]
certFile = "/data/fullchain.pem"
keyFile = "/data/privkey.pem"
keyFile = "/data/privkey.pem"
56 changes: 53 additions & 3 deletions traefik.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,61 @@
# This is how you tell traefik that it has to get the dynamic config from a config file
# Note that the path is the path to the file inside Docker, not insider your machine!
# If you want do use Docker itself for this check traefik docs!
[providers.file]
filename = "/etc/traefik/traefik.config.toml"
watch = true

# uncomment below if you want providers file
#[providers.file]
# filename = "/etc/traefik/traefik.config.toml"
# watch = true
[providers.redis]
endpoints = ["127.0.0.1:6379"]

[api]
# With this you enable the web UI
insecure = false
dashboard = true

[http]
[http.routers]
#########################################################################
# http #
[http.routers.http-to-app]
# You can change the rules here and make it more complex. Check traefik
# docs!
rule = "Host(`app.example.com`)"
service = "app"
entrypoints = ["http"]
# enable if u want redirect to https
#middlewares = ["redirect"]

## https #
[http.routers.https-to-app]
rule = "Host(`app.example.com`)"
service = "app"
entrypoints = ["https"]
middlewares = ["app-compress"]
[http.routers.https-to-app.tls]

[http.services]
# service
[http.services.app]
[http.services.app.loadBalancer]
passHostHeader = true
[[http.services.app.loadBalancer.servers]]
# This is where your dev app lives.
url = "http://url/"


########################################################################

[http.middlewares]
[http.middlewares.redirect.redirectScheme]
scheme = "https"
average = 100
burst = 50
[http.middlewares.app-compress.compress]


[tls]
[[tls.certificates]]
certFile = "/data/fullchain.pem"
keyFile = "/data/privkey.pem"

0 comments on commit 22d05e8

Please sign in to comment.