Last active
April 8, 2022 12:59
-
-
Save w33ble/494933b2e5fdab6111c21665b67a9ad2 to your computer and use it in GitHub Desktop.
Elastic Stack in Docker with Basic Auth via proxy
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
version: '2.2' | |
services: | |
proxy: | |
image: nginx:1-alpine | |
restart: always | |
ports: | |
- 5601:80 | |
- 9200:9201 | |
volumes: | |
- ./nginx/conf.d:/etc/nginx/conf.d | |
depends_on: | |
- kibana | |
- elasticsearch | |
elasticsearch: | |
image: docker.elastic.co/elasticsearch/elasticsearch:6.4.2 | |
restart: always | |
volumes: | |
- ./elasticsearch/data:/usr/share/elasticsearch/data | |
- ./elasticsearch/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml | |
environment: | |
- discovery.type=single-node | |
- bootstrap.memory_lock=true | |
ulimits: | |
memlock: | |
soft: -1 | |
hard: -1 | |
kibana: | |
image: localhost:5000/kibana:6.4.2 # custom kibana build, docker.elastic.co/kibana/kibana:6.4.2 would also work | |
restart: always | |
environment: | |
- ELASTICSEARCH_USERNAME=elastic | |
- ELASTICSEARCH_PASSWORD=changeme | |
- ELATSICSEARCH_URL=http://proxy:9201 |
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
cluster.name: "docker-cluster" | |
network.host: 0.0.0.0 | |
discovery.zen.minimum_master_nodes: 1 |
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
server { | |
listen 9201; | |
server_name elasticsearch; | |
# permit large uploads | |
client_max_body_size 25M; | |
location / { | |
auth_basic "Don't touch me there"; | |
auth_basic_user_file /etc/nginx/conf.d/htpasswd; | |
proxy_http_version 1.1; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_buffering off; | |
proxy_pass http://elasticsearch:9200; | |
} | |
} |
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
server { | |
listen 80; | |
server_name kibana; | |
# permit large uploads | |
client_max_body_size 25M; | |
location / { | |
auth_basic "Don't touch me there"; | |
auth_basic_user_file /etc/nginx/conf.d/htpasswd; | |
proxy_http_version 1.1; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_buffering off; | |
proxy_pass http://kibana:5601; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment