diff --git a/docker/Dockerfile b/docker/Dockerfile index 379c1bafeed..07047de22da 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -12,7 +12,7 @@ # the License. # -FROM maven:3-jdk-11-slim +FROM openzipkin/zipkin-builder COPY . /code RUN cd /code && mvn -B --no-transfer-progress package -DskipTests=true -pl zipkin-server -am diff --git a/docker/lens/Dockerfile b/docker/lens/Dockerfile new file mode 100644 index 00000000000..23d65dc9c72 --- /dev/null +++ b/docker/lens/Dockerfile @@ -0,0 +1,32 @@ +# +# Copyright 2015-2019 The OpenZipkin Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except +# in compliance with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under the License +# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express +# or implied. See the License for the specific language governing permissions and limitations under +# the License. +# + +FROM openzipkin/zipkin-builder + +COPY . /code +RUN cd /code && mvn -B --no-transfer-progress package -DskipTests=true -pl zipkin-lens -am + +FROM nginx:1.16-alpine +LABEL MAINTAINER Zipkin "https://zipkin.io/" + +COPY --from=0 /code/zipkin-lens/target/classes/zipkin-lens /var/www/html/zipkin +RUN mkdir -p /var/tmp/nginx && chown -R nginx:nginx /var/tmp/nginx + +# Setup services +COPY docker/ui/nginx.conf /etc/nginx/conf.d/zipkin.conf.template +COPY docker/ui/run.sh /usr/local/bin/nginx.sh + +EXPOSE 80 + +CMD ["/usr/local/bin/nginx.sh"] diff --git a/docker/lens/README.md b/docker/lens/README.md new file mode 100644 index 00000000000..c8549a09ef2 --- /dev/null +++ b/docker/lens/README.md @@ -0,0 +1,13 @@ +## zipkin-ui Docker image + +To build a zipkin-ui Docker image, in the top level of the repository, run something +like + +```bash +$ docker build -t openzipkin/zipkin-ui:test -f docker/Dockerfile . +``` + +### Dockerfile migration + +We are currently migrating the Docker configuration from https://github.com/openzipkin/docker-zipkin/tree/master/zipkin-ui. +If making any changes here, make sure to also reflect them there. diff --git a/docker/lens/nginx.conf b/docker/lens/nginx.conf new file mode 100644 index 00000000000..e664d9798cd --- /dev/null +++ b/docker/lens/nginx.conf @@ -0,0 +1,93 @@ +user nginx nginx; +worker_processes 2; + +error_log /dev/stderr warn; +pid /var/run/nginx.pid; + +daemon off; + +events { + worker_connections 1024; +} + + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /dev/stdout main; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 65; + + gzip on; + gzip_types application/javascript application/json text/css; + + server_tokens off; + + types { + application/font-woff2 woff2; + } + + server { + listen 80; + + root /var/www/html; + + index index.html; + + # Make site accessible from http://set-ip-address.xip.io + server_name localhost; + + charset utf-8; + + # redirect root as UI is hosted under /zipkin + location / { + return 302 /zipkin/; + } + + # the entrypoint of the app will expire every day. + # this includes links to js assets with random names. + location /zipkin/index.html { + expires 1d; + } + + location /zipkin { + try_files $uri /zipkin/index.html = 404; + } + + # accept UI config from the server + location /zipkin/config.json { + expires 10m; + proxy_pass ${ZIPKIN_BASE_URL}; + } + + # the UI looks for the api under the same relative path + location /zipkin/api { + expires off; + proxy_pass ${ZIPKIN_BASE_URL}; + } + + # due to minification, the js assets will change names. + # this makes them safe to cache longer + location ~* \.(?:ico|css|js|gif|jpe?g|png)$ { + expires 1y; + add_header Cache-Control "public"; + } + + location = /favicon.ico { log_not_found off; access_log off; } + location = /robots.txt { access_log off; log_not_found off; } + + # Deny .htaccess file access + location ~ /\.ht { + deny all; + } + + } +} diff --git a/docker/lens/run.sh b/docker/lens/run.sh new file mode 100644 index 00000000000..e8420f1125c --- /dev/null +++ b/docker/lens/run.sh @@ -0,0 +1,17 @@ +#!/bin/sh +# +# Copyright 2015-2019 The OpenZipkin Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except +# in compliance with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under the License +# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express +# or implied. See the License for the specific language governing permissions and limitations under +# the License. +# + +envsubst '\$ZIPKIN_BASE_URL' < /etc/nginx/conf.d/zipkin.conf.template > /etc/nginx/nginx.conf +exec nginx diff --git a/pom.xml b/pom.xml index 98a275a03b1..74ac418e8bb 100755 --- a/pom.xml +++ b/pom.xml @@ -649,6 +649,7 @@ etc/header.txt docker/**/*_profile hooks/** + **/nginx.conf **/.idea/** **/node_modules/** **/.babelrc