博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[Zipkin] zipkin-ui修改后单独打成镜像
阅读量:2341 次
发布时间:2019-05-10

本文共 4095 字,大约阅读时间需要 13 分钟。

由于要在zipkin的界面基础上进行修改,所以需要单独打包zipkin-ui并以docker形式跑起来(zipkin后台一直运行着)。一个学长曾经做过,记录如下,亲测可用:

  1. Maven打包zipkin:parent(root) -> package

  2. 把打好的zipkin-ui.jar包放到文件夹zipkin-ui中,里面还要放入三个文件:

  • nginx.conf文件
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 9091; 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; } }}
  • run.sh文件
#!/bin/shenvsubst '\$ZIPKIN_BASE_URL' < /etc/nginx/conf.d/zipkin.conf.template > /etc/nginx/nginx.confexec nginx
  • Dockerfile文件
# pins on 1.11 as it is built against Alpine 3.4 which doesn't die with SSL certificate problemFROM nginx:1.11-alpineENV ZIPKIN_VERSION 2.10.1#!!!!!!change to your zipkin backend ip:port!!!!!!!!!!ENV ZIPKIN_BASE_URL=http://xxxxx:xxx#!!!!!!change to your zipkin-ui.jar name!!!!!!!!!!!COPY zipkin-ui-2.10.1-SNAPSHOT.jar zipkin-ui-2.10.1-SNAPSHOT.jar# Setup servicesADD nginx.conf /etc/nginx/conf.d/zipkin.conf.templateADD run.sh /usr/local/bin/nginx.shRUN apk add --update --no-cache nginx curl &&    rm -rf /var/cache/apk/* /tmp/* /var/tmp/* && \    mkdir /var/www/html && \    unzip zipkin-ui-2.10.1-SNAPSHOT.jar 'zipkin-ui/*' -d /var/www/html && \    mv /var/www/html/zipkin-ui /var/www/html/zipkin && \    rm -rf zipkin-ui-2.10.1-SNAPSHOT.jar && \    chmod +x /usr/local/bin/nginx.shEXPOSE 9091CMD ["/usr/local/bin/nginx.sh"]
  1. 镜像生成、上传:
#【docker build -t (镜像名) -f (Dockerfile文件的路径) (上下文路径)】#(最后的点号不要忘记)docker build -t zipkin-ui -f Dockerfile .#跑一下试试docker run -p 9091:9091 zipkin-ui#打tag、push到docker hubdocker tag zipkin-ui xxx/zipkin-uidocker push xxx/zipkin-ui
  1. 使用docker-compose跑,可以修改zipkin后台地址:
  • docker-compose.yml
# This file uses the version 2 docker-compose file format, described here:# https://docs.docker.com/compose/compose-file/#version-2## It extends the default configuration from docker-compose.yml, hosting the# ui on port 80 using NGINXversion: '2'services:  zipkin-ui:    build: zipkin-ui    #change to your image uri    image: xxxx/zipkin-ui    container_name: zipkin-ui    environment:      # Change this if connecting to a different zipkin server      - ZIPKIN_BASE_URL=http://xxxxx:xxx    ports:      - 9091:9091

转载地址:http://tokvb.baihongyu.com/

你可能感兴趣的文章
栈和堆的具体区别
查看>>
如何判断一个点在矩形内
查看>>
析构函数何时被调用
查看>>
C++虚函数底层机制
查看>>
面试题:随机数生成、蓄水池抽样、海量数据、设计秒杀系统
查看>>
linux清除cache的方法
查看>>
memmove 和 memcpy的区别以及处理内存重叠问题
查看>>
费雪耶兹(Fisher–Yates) 也被称作高纳德( Knuth)随机置乱算法
查看>>
C/C++中变量的存储位置
查看>>
C++中四种强制类型转换区别详解
查看>>
linux gdb的详细用法 运行与断点
查看>>
删除vector中重复元素
查看>>
和为s的连续正数序列
查看>>
什么是Redis?什么是nosql?NoSQL数据库的四大分类
查看>>
为什么说Redis是单线程的以及Redis为什么这么快!
查看>>
redis的过期健删除策略以及内存淘汰机制
查看>>
redis 双写一致性问题
查看>>
map 如何使用结构体作为自定义键值
查看>>
Mysql几种索引类型的区别及适用情况
查看>>
Redis缓存穿透、缓存雪崩、redis并发问题分析
查看>>