Skip to content

Commit

Permalink
enbale traceing for nginx
Browse files Browse the repository at this point in the history
  • Loading branch information
Lincyaw committed May 23, 2024
1 parent af102fd commit cf09e9a
Show file tree
Hide file tree
Showing 4 changed files with 263 additions and 215 deletions.
12 changes: 9 additions & 3 deletions ts-ui-dashboard/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
FROM nginx:1.23.1


RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
RUN apt-get update ; apt-get install unzip

ADD https://github.com/open-telemetry/opentelemetry-cpp-contrib/releases/download/webserver%2Fv1.0.3/opentelemetry-webserver-sdk-x64-linux.tgz /opt

RUN cd /opt ; unzip opentelemetry-webserver-sdk-x64-linux.tgz.zip; tar xvfz opentelemetry-webserver-sdk-x64-linux.tgz
RUN cd /opt/opentelemetry-webserver-sdk; ./install.sh

ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/opentelemetry-webserver-sdk/sdk_lib/lib
RUN echo "load_module /opt/opentelemetry-webserver-sdk/WebServerModule/Nginx/1.23.1/ngx_http_opentelemetry_module.so;\n$(cat /etc/nginx/nginx.conf)" > /etc/nginx/nginx.conf

COPY opentelemetry_module.conf /etc/nginx/conf.d
COPY nginx.conf /etc/nginx/nginx.conf
COPY server.conf /etc/nginx/conf.d
COPY static /usr/share/nginx/html
RUN ulimit -n 65535
COPY docker-entrypoint.sh /docker-entrypoint.sh

ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["nginx", "-g", "daemon off;"]
41 changes: 41 additions & 0 deletions ts-ui-dashboard/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/sh
# vim:sw=4:ts=4:et

set -e

# 设置文件描述符限制
ulimit -n 65535

if [ -z "${NGINX_ENTRYPOINT_QUIET_LOGS:-}" ]; then
exec 3>&1
else
exec 3>/dev/null
fi

if [ "$1" = "nginx" -o "$1" = "nginx-debug" ]; then
if /usr/bin/find "/docker-entrypoint.d/" -mindepth 1 -maxdepth 1 -type f -print -quit 2>/dev/null | read v; then
echo >&3 "$0: /docker-entrypoint.d/ is not empty, will attempt to perform configuration"

echo >&3 "$0: Looking for shell scripts in /docker-entrypoint.d/"
find "/docker-entrypoint.d/" -follow -type f -print | sort -V | while read -r f; do
case "$f" in
*.sh)
if [ -x "$f" ]; then
echo >&3 "$0: Launching $f";
"$f"
else
# warn on shell scripts without exec bit
echo >&3 "$0: Ignoring $f, not executable";
fi
;;
*) echo >&3 "$0: Ignoring $f";;
esac
done

echo >&3 "$0: Configuration complete; ready for start up"
else
echo >&3 "$0: No files found in /docker-entrypoint.d/, skipping configuration"
fi
fi

exec "$@"
217 changes: 5 additions & 212 deletions ts-ui-dashboard/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
load_module /opt/opentelemetry-webserver-sdk/WebServerModule/Nginx/1.23.1/ngx_http_opentelemetry_module.so;
worker_processes 1;
error_log error.log;

events {
worker_connections 1024;
}
http {

http {
include mime.types;
default_type application/octet-stream;

Expand All @@ -22,214 +24,5 @@ http {

#gzip on;

server {
listen 8080;
proxy_http_version 1.1;
proxy_set_header Connection "";

location / {
root /usr/share/nginx/html;
index index.html index.htm;
}

location ~* \.(html)$ {
root /usr/share/nginx/html;
}


location /api/v1/adminbasicservice {
proxy_pass http://ts-admin-basic-info-service:8080;
}

# Admin Order Service
location /api/v1/adminorderservice {
proxy_pass http://ts-admin-order-service:8080;
}

# Admin Route Service
location /api/v1/adminrouteservice {
proxy_pass http://ts-admin-route-service:8080;
}

# Admin Travel Service
location /api/v1/admintravelservice {
proxy_pass http://ts-admin-travel-service:8080;
}

# Admin User Service
location /api/v1/adminuserservice/users {
proxy_pass http://ts-admin-user-service:8080;
}

# Assurance Service
location /api/v1/assuranceservice {
proxy_pass http://ts-assurance-service:8080;
}

# Auth Service
location /api/v1/auth {
proxy_pass http://ts-auth-service:8080;
}

# Auth User
location /api/v1/users {
proxy_pass http://ts-auth-service:8080;
}

# Avatar Service
location /api/v1/avatar {
proxy_pass http://ts-avatar-service:8080;
}

# Basic Service
location /api/v1/basicservice {
proxy_pass http://ts-basic-service:8080;
}

# Cancel Service
location /api/v1/cancelservice {
proxy_pass http://ts-cancel-service:8080;
}

# Config Service
location /api/v1/configservice {
proxy_pass http://ts-config-service:8080;
}

# Consign Price Service
location /api/v1/consignpriceservice {
proxy_pass http://ts-consign-price-service:8080;
}

# Consign Service
location /api/v1/consignservice {
proxy_pass http://ts-consign-service:8080;
}

# Contacts Service
location /api/v1/contactservice {
proxy_pass http://ts-contacts-service:8080;
}

# Execute Service
location /api/v1/executeservice {
proxy_pass http://ts-execute-service:8080;
}

# Food Service
location /api/v1/foodservice {
proxy_pass http://ts-food-service:8080;
}

# Inside Payment Service
location /api/v1/inside_pay_service {
proxy_pass http://ts-inside-payment-service:8080;
}

# Notification Service
location /api/v1/notifyservice {
proxy_pass http://ts-notification-service:8080;
}

# Order Other Service
location /api/v1/orderOtherService {
proxy_pass http://ts-order-other-service:8080;
}

# Order Service
location /api/v1/orderservice {
proxy_pass http://ts-order-service:8080;
}

# Payment Service
location /api/v1/paymentservice {
proxy_pass http://ts-payment-service:8080;
}

# Preserve Other Service
location /api/v1/preserveotherservice {
proxy_pass http://ts-preserve-other-service:8080;
}

# Preserve Service
location /api/v1/preserveservice {
proxy_pass http://ts-preserve-service:8080;
}

# Price Service
location /api/v1/priceservice {
proxy_pass http://ts-price-service:8080;
}

# Rebook Service
location /api/v1/rebookservice {
proxy_pass http://ts-rebook-service:8080;
}

# Route Plan Service
location /api/v1/routeplanservice {
proxy_pass http://ts-route-plan-service:8080;
}

# Route Service
location /api/v1/routeservice {
proxy_pass http://ts-route-service:8080;
}

# Seat Service
location /api/v1/seatservice {
proxy_pass http://ts-seat-service:8080;
}

# Security Service
location /api/v1/securityservice {
proxy_pass http://ts-security-service:8080;
}

# Station Food Service
location /api/v1/stationfoodservice {
proxy_pass http://ts-station-food-service:8080;
}

# Station Service
location /api/v1/stationservice {
proxy_pass http://ts-station-service:8080;
}

# Train Food Service
location /api/v1/trainfoodservice {
proxy_pass http://ts-train-food-service:8080;
}

# Train Service
location /api/v1/trainservice {
proxy_pass http://ts-train-service:8080;
}

# Travel2 Service
location /api/v1/travel2service {
proxy_pass http://ts-travel2-service:8080;
}

# Travel Plan Service
location /api/v1/travelplanservice {
proxy_pass http://ts-travel-plan-service:8080;
}

# Travel Service
location /api/v1/travelservice {
proxy_pass http://ts-travel-service:8080;
}

# User Service
location /api/v1/userservice/users {
proxy_pass http://ts-user-service:8080;
}

# Verification Code Service
location /api/v1/verifycode {
proxy_pass http://ts-verification-code-service:8080;
}

}
}
include /etc/nginx/conf.d/*.conf;
}
Loading

0 comments on commit cf09e9a

Please sign in to comment.