From 9438fd69193e3235e531f2cef5600b8872889802 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 17 Dec 2016 01:24:53 +0100 Subject: [PATCH] openresty proxy --- openresty/build/Dockerfile | 5 +++++ openresty/build/build.sh | 3 +++ openresty/build/nginx.conf | 29 +++++++++++++++++++++++++++++ openresty/build/profile.sh | 1 + openresty/start.sh | 15 +++++++++++++++ openresty/start_service.sh | 12 ++++++++++++ 6 files changed, 65 insertions(+) create mode 100644 openresty/build/Dockerfile create mode 100755 openresty/build/build.sh create mode 100644 openresty/build/nginx.conf create mode 100644 openresty/build/profile.sh create mode 100755 openresty/start.sh create mode 100755 openresty/start_service.sh diff --git a/openresty/build/Dockerfile b/openresty/build/Dockerfile new file mode 100644 index 0000000..bd3b6f1 --- /dev/null +++ b/openresty/build/Dockerfile @@ -0,0 +1,5 @@ +# See https://github.com/openresty/docker-openresty/blob/master/alpine/Dockerfile +FROM openresty/openresty:1.11.2.2-alpine + +COPY nginx.conf /usr/local/openresty/nginx/conf/nginx.conf +COPY profile.sh /etc/profile.d/netcomposer.sh diff --git a/openresty/build/build.sh b/openresty/build/build.sh new file mode 100755 index 0000000..414ad36 --- /dev/null +++ b/openresty/build/build.sh @@ -0,0 +1,3 @@ +NAME="netcomposer/elastic-openresty:1.11.2-0" +docker build -t $NAME . # && docker push $NAME + diff --git a/openresty/build/nginx.conf b/openresty/build/nginx.conf new file mode 100644 index 0000000..9409701 --- /dev/null +++ b/openresty/build/nginx.conf @@ -0,0 +1,29 @@ +worker_processes 1; + +events { + worker_connections 1024; +} + + +http { + default_type application/octet-stream; + sendfile on; + #tcp_nopush on; + #keepalive_timeout 0; + keepalive_timeout 65; + + upstream elastic { + server elastic:9200; + keepalive 15; + } + + server { + listen 9200; + location / { + proxy_pass http://elastic; + proxy_http_version 1.1; + proxy_set_header Connection "Keep-Alive"; + proxy_set_header Proxy-Connection "Keep-Alive"; + } + } +} diff --git a/openresty/build/profile.sh b/openresty/build/profile.sh new file mode 100644 index 0000000..26e2dad --- /dev/null +++ b/openresty/build/profile.sh @@ -0,0 +1 @@ +export PATH=$PATH:/usr/local/openresty/nginx/sbin diff --git a/openresty/start.sh b/openresty/start.sh new file mode 100755 index 0000000..490adfb --- /dev/null +++ b/openresty/start.sh @@ -0,0 +1,15 @@ +#!/bin/bash +IMAGE=netcomposer/elastic-openresty:1.11.2-0 + +docker rm elastic_openresty > /dev/null 2>&1 + +docker run \ + -ti \ + --name elastic_openresty \ + --network elastic \ + -p 9201:9200 \ + -v /etc/letsencrypt:/etc/letsencrypt:ro \ + $IMAGE + +# --restart unless-stopped \ + diff --git a/openresty/start_service.sh b/openresty/start_service.sh new file mode 100755 index 0000000..4a8262e --- /dev/null +++ b/openresty/start_service.sh @@ -0,0 +1,12 @@ +#!/bin/bash +IMAGE=netcomposer/elastic-openresty:1.11.2-0 + +docker service create \ + --name elastic_openresty \ + --network elastic \ + -p 9201:9200 \ + --mount type=bind,src=/etc/letsencrypt,dst=/etc/letsencrypt:ro \ + $IMAGE + +# --restart unless-stopped \ +