minor optimisations

This commit is contained in:
Steve Waterworth
2020-10-21 12:53:31 +01:00
parent 83ab82407c
commit d98d955fae
5 changed files with 19 additions and 11 deletions

2
.env
View File

@@ -1,3 +1,3 @@
# environment file for docker-compose
REPO=robotshop
TAG=0.5.1
TAG=0.5.2

View File

@@ -107,8 +107,9 @@ services:
- "8080:8080"
networks:
- robot-shop
# Uncomment to enable Instana EUM
# environment:
#environment:
# NGINX_INJECT_FAKE_IP: "1"
# Uncomment to enable Instana EUM
# INSTANA_EUM_KEY: <your eum key>
# INSTANA_EUM_REPORTING_URL: https://eum-us-west-2.instana.io
# INSTANA_EUM_REPORTING_URL: https://eum-eu-west-1.instana.io

View File

@@ -2,13 +2,9 @@ FROM nginx:1.19
EXPOSE 8080
RUN echo "js_path /opt/nginx_js;" > /etc/nginx/conf.d/njs.conf
RUN echo "\njs_import instana_random_geo.js;\n" >> /etc/nginx/conf.d/njs.conf
RUN echo "\njs_set \$fake_ip instana_random_geo;\n" >> /etc/nginx/conf.d/njs.conf
RUN sed -i '1i load_module \"modules/ngx_http_js_module.so\";' /etc/nginx/nginx.conf
RUN sed -i '1i load_module \"modules/ngx_stream_js_module.so\";' /etc/nginx/nginx.conf
RUN apt update -yqq && apt install nginx-module-njs -y
RUN mkdir -p /opt/nginx_js
RUN sed -i '1i load_module \"modules/ngx_http_js_module.so\";' /etc/nginx/nginx.conf && \
sed -i '1i load_module \"modules/ngx_stream_js_module.so\";' /etc/nginx/nginx.conf
COPY instana_random_geo.js /opt/nginx_js/instana_random_geo.js
ENV CATALOGUE_HOST=catalogue \
@@ -18,6 +14,7 @@ ENV CATALOGUE_HOST=catalogue \
PAYMENT_HOST=payment \
RATINGS_HOST=ratings
COPY njs.conf /etc/nginx/conf.d/njs.conf
COPY entrypoint.sh /root/
ENTRYPOINT ["/root/entrypoint.sh"]

View File

@@ -6,7 +6,9 @@ var items = [
// Chicago
"98.142.103.241",
// Los Angeles
"192.241.230.151"
"192.241.230.151",
// Europe
"34.105.212.119"
];
// we get a random ip address to simulate specific locations of the requester

8
web/njs.conf Normal file
View File

@@ -0,0 +1,8 @@
# geo tags for calls derived from x-forwarded-for header
js_path /opt/nginx_js;
js_import instana_random_geo.js;
js_set $fake_ip instana_random_geo;