Last active
March 13, 2018 16:06
-
-
Save ismailyenigul/cee62494e67e3160d6d2bb463656e7b6 to your computer and use it in GitHub Desktop.
traefik reverse proxy for kibana and elasticsearch with basic auth
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#modifed version of docker-compose.yml from https://github.com/deviantony/docker-elk | |
# I will write an article about this later. | |
version: '2' | |
services: | |
elasticsearch: | |
build: | |
context: elasticsearch/ | |
volumes: | |
- ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro | |
- elasticdata:/usr/share/elasticsearch/data | |
ports: | |
- "9200:9200" | |
- "9300:9300" | |
restart: always | |
environment: | |
ES_JAVA_OPTS: "-Xmx1024m -Xms1024m" | |
labels: | |
- "traefik.enable=true" | |
- "traefik.protocol=http" | |
- "traefik.port=9200" | |
- "traefik.frontend.rule=Host:elastic.mydomain.io" | |
networks: | |
- elk | |
kibana: | |
build: | |
context: kibana/ | |
volumes: | |
- ./kibana/config/:/usr/share/kibana/config:ro | |
ports: | |
- "5601:5601" | |
restart: always | |
labels: | |
- "traefik.enable=true" | |
- "traefik.protocol=http" | |
- "traefik.port=5601" | |
- "traefik.frontend.rule=Host:kibana.mydomain.io" | |
networks: | |
- elk | |
depends_on: | |
- elasticsearch | |
traefik: | |
image: traefik:alpine | |
ports: | |
- 80:80 | |
- 443:443 | |
restart: always | |
volumes: | |
- /var/run/docker.sock:/var/run/docker.sock:ro | |
- ./traefik/traefik.toml:/etc/traefik/traefik.toml | |
- ./traefik/acme.json:/acme.json | |
networks: | |
- elk | |
networks: | |
elk: | |
driver: bridge | |
volumes: | |
elasticdata: | |
----traefik.toml---- | |
defaultEntryPoints = ["http", "https"] | |
InsecureSkipVerify = true | |
debug = false | |
logLevel = "ERROR" | |
[entryPoints] | |
[entryPoints.http] | |
address = ":80" | |
[entryPoints.http.redirect] | |
entryPoint = "https" | |
[entryPoints.https] | |
address = ":443" | |
[entryPoints.https.tls] | |
[entryPoints.https.auth.basic] | |
users = ["test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/", "test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0"] | |
#user/pass: test:test and test2:test2 you can use your htpasswd generated pass | |
[retry] | |
[docker] | |
endpoint = "unix:///var/run/docker.sock" | |
domain = "mydomain.io" | |
watch = true | |
exposedbydefault = false | |
[acme] | |
email = "[email protected]" | |
storage = "acme.json" | |
entryPoint = "https" | |
onHostRule = true | |
onDemand = true | |
[acme.httpChallenge] | |
entryPoint = "http" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment