File tree Expand file tree Collapse file tree 4 files changed +74
-5
lines changed
Expand file tree Collapse file tree 4 files changed +74
-5
lines changed Original file line number Diff line number Diff line change @@ -10,12 +10,15 @@ PHONY: *
1010
1111build :
1212 docker-compose -f local-compose.yml -p elk build kibana logstash
13+ cd nginx && docker build -t=" elk_nginx_demo" .
1314
1415ship :
1516 docker tag -f elk_kibana autopilotpattern/kibana
1617 docker tag -f elk_logstash autopilotpattern/logstash
18+ docker tag -f elk_nginx_demo autopilotpattern/elk-nginx-demo
1719 docker push autopilotpattern/kibana
1820 docker push autopilotpattern/logstash
21+ docker push autopilotpattern/elk-nginx-demo
1922
2023
2124# -------------------------------------------
Original file line number Diff line number Diff line change 1+ FROM autopilotpattern/nginx
2+ COPY nginx.conf.ctmpl /etc/nginx/
Original file line number Diff line number Diff line change 1+ # This is an example Nginx configuration template file.
2+ # Adjust the values below as required for your application.
3+
4+ user nginx;
5+ worker_processes 1;
6+
7+ error_log /var/log/nginx/error.log warn;
8+ pid /var/run/nginx.pid;
9+
10+ events {
11+ worker_connections 1024;
12+ }
13+
14+
15+ http {
16+ include /etc/nginx/mime.types;
17+ default_type application/octet-stream;
18+
19+ log_format main '$remote_addr - $remote_user [$time_local] "$request" '
20+ '$status $body_bytes_sent "$http_referer" '
21+ '"$http_user_agent" "$http_x_forwarded_for"';
22+
23+ access_log /var/log/nginx/access.log main;
24+
25+ sendfile on;
26+ #tcp_nopush on;
27+
28+ keepalive_timeout 65;
29+
30+ #gzip on;
31+
32+ {{ if service "kibana" }}
33+ upstream backend {
34+ # write the address:port pairs for each healthy backend instance
35+ {{range service "kibana" }}
36+ server {{.Address}}:{{.Port}};
37+ {{end}}
38+ least_conn;
39+ }{{ end }}
40+
41+ server {
42+ listen 80;
43+ server_name _;
44+
45+ location /health {
46+ stub_status;
47+ allow 127.0.0.1;
48+ deny all;
49+ }
50+
51+ location / {
52+ root /usr/share/nginx/html;
53+ index index.html index.htm;
54+ }
55+
56+ {{ if service "kibana" }}
57+ location /kibana {
58+ # strip '/kibana' from the request before passing
59+ # it along to the Kibana upstream
60+ rewrite ^/kibana(/.*)$ $1 break;
61+ proxy_pass http://backend;
62+ proxy_redirect off;
63+ }{{ end }}
64+ }
65+ }
Original file line number Diff line number Diff line change @@ -78,7 +78,6 @@ test() {
7878
7979 echo ' Starting Nginx log source...'
8080
81- local consul=$( getPrivateIpPort consul 8500 tcp)
8281 local logstash=$( getPrivateIpPort logstash $port $protocol )
8382
8483 docker run -d -m 128m -p 80 \
@@ -88,11 +87,11 @@ test() {
8887 --log-driver=${logtype} \
8988 --log-opt ${logtype} -address=${protocol} ://${logstash} \
9089 --link ${COMPOSE_PROJECT_NAME} _consul_1:consul \
91- -e CONSUL=" ${ consul} " \
92- -e BACKEND=none \
93- autopilotpattern/nginx
90+ -e CONSUL=consul \
91+ -e BACKEND=kibana \
92+ autopilotpattern/elk- nginx-demo
9493
95- poll-for-page " http://$( getPublicUrl nginx-$logtype 80) " \
94+ poll-for-page " http://$( getPublicUrl nginx-${ logtype} 80) " \
9695 ' Waiting for Nginx to register as healthy...' \
9796 ' Opening web page.'
9897}
You can’t perform that action at this time.
0 commit comments