diff --git a/README.md b/README.md index e105df7..8b86c1f 100644 --- a/README.md +++ b/README.md @@ -126,7 +126,7 @@ If you'd like to get things runing manually using Docker, you can do the followi ``` docker run --rm -it --network=telemetry \ --name frontend \ - -p 3000:80 \ + -p 3000:8000 \ -e SUBSTRATE_TELEMETRY_URL=ws://localhost:8000/feed \ substrate-telemetry-frontend ``` diff --git a/docker-compose.yml b/docker-compose.yml index 1f0db07..7c10a7d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,15 +5,8 @@ services: build: dockerfile: Dockerfile context: ./frontend/ - # Copy in changes to the ui, so no need to rebuild the images. - volumes: - - /app/node_modules - - ./packages:/app/packages - - ./nginx/nginx.conf:/etc/nginx/nginx.conf - - ./nginx/default:/etc/nginx/sites-available/default - - ./env-config.js:/usr/share/nginx/html/env-config.js ports: - - 3000:80 + - 3000:8000 expose: - 3000 telemetry-backend-shard: diff --git a/frontend/Dockerfile b/frontend/Dockerfile index ae7d6ca..52d0a00 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -25,9 +25,8 @@ COPY --from=builder /opt/builder/env.sh /usr/bin/ RUN apk add --no-cache bash; chmod +x /usr/bin/env.sh COPY --from=builder /opt/builder/nginx/nginx.conf /etc/nginx/nginx.conf -COPY --from=builder /opt/builder/nginx/default /etc/nginx/sites-available/default COPY --from=builder /opt/builder/build /usr/share/nginx/html -EXPOSE 80 +EXPOSE 8000 CMD ["/bin/bash", "-c", "/usr/bin/env.sh && nginx -g \"daemon off;\""] diff --git a/frontend/nginx/default b/frontend/nginx/default deleted file mode 100644 index 26e9e04..0000000 --- a/frontend/nginx/default +++ /dev/null @@ -1,48 +0,0 @@ - -## -# You should look at the following URL's in order to grasp a solid understanding -# of Nginx configuration files in order to fully unleash the power of Nginx. -# http://wiki.nginx.org/Pitfalls -# http://wiki.nginx.org/QuickStart -# http://wiki.nginx.org/Configuration -# -# Generally, you will want to move this file somewhere, and start with a clean -# file but keep this around for reference. Or just disable in sites-enabled. -# -# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples. -## - -server { - root /usr/share/nginx/html; - - index index.html; - - listen 3000; - listen [::]:3000; - server_name telemetry.polkadot.io localhost; - - location /feed/ { - proxy_pass http://127.0.0.1:8000; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "Upgrade"; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - limit_req zone=zone burst=5; - } - - location /submit/ { - proxy_pass http://127.0.0.1:8000; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "Upgrade"; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - limit_req zone=zone burst=5; - } - - location /health/ { - proxy_pass http://127.0.0.1:8000; - proxy_http_version 1.1; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - limit_req zone=zone burst=5; - } -} diff --git a/frontend/nginx/nginx.conf b/frontend/nginx/nginx.conf index b04791f..e203744 100644 --- a/frontend/nginx/nginx.conf +++ b/frontend/nginx/nginx.conf @@ -10,19 +10,25 @@ events { } http { - include /etc/nginx/mime.types; default_type application/octet-stream; + include /etc/nginx/mime.types; 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 /var/log/nginx/access.log main; - sendfile on; #tcp_nopush on; - keepalive_timeout 65; gzip on; include /etc/nginx/conf.d/*.conf; + + server { + root /usr/share/nginx/html; + index index.html; + listen 8000; + listen [::]:8000; + server_name telemetry.polkadot.io localhost; + } } diff --git a/helm/templates/frontend-deployment.yaml b/helm/templates/frontend-deployment.yaml index 5bb4039..a0a6110 100644 --- a/helm/templates/frontend-deployment.yaml +++ b/helm/templates/frontend-deployment.yaml @@ -54,17 +54,8 @@ spec: httpGet: path: / port: http - volumeMounts: - - name: nginx - mountPath: /etc/nginx/nginx.conf - subPath: nginx.conf - readOnly: true resources: {{- toYaml .Values.resources | nindent 12 }} - volumes: - - name: nginx - configMap: - name: frontend-nginx {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/helm/templates/frontend-nginx-configmap.yaml b/helm/templates/frontend-nginx-configmap.yaml deleted file mode 100644 index 15dbb01..0000000 --- a/helm/templates/frontend-nginx-configmap.yaml +++ /dev/null @@ -1,41 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: frontend-nginx -data: - nginx.conf: | - user nginx; - worker_processes auto; - worker_rlimit_nofile 30000; - error_log /var/log/nginx/error.log warn; - pid /var/run/nginx.pid; - - events { - worker_connections 8000; - } - - http { - default_type application/octet-stream; - include /etc/nginx/mime.types; - 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 /var/log/nginx/access.log main; - sendfile on; - #tcp_nopush on; - keepalive_timeout 65; - gzip on; - include /etc/nginx/conf.d/*.conf; - #server_tokens off; - - server { - root /usr/share/nginx/html; - index index.html; - listen 8000; - server_name _; - - location = /favicon.ico { - return 204; - } - } - }