Merge pull request #368 from paritytech/jsdw-simpler-docker

Simplify Helm/Docker usage
This commit is contained in:
James Wilson
2021-08-16 14:26:32 +01:00
committed by GitHub
9 changed files with 29 additions and 136 deletions
+2 -2
View File
@@ -65,7 +65,7 @@ If you started the backend binaries with their default arguments, you can connec
polkadot --dev --telemetry-url 'ws://localhost:8001/submit 0'
```
**Note:** The "0" at the end of the URL is a verbosity level, and not part of the URL itself. Verbosity levels range from 0-9, with 0 denoting the lowest verbosity.
**Note:** The "0" at the end of the URL is a verbosity level, and not part of the URL itself. Verbosity levels range from 0-9, with 0 denoting the lowest verbosity. The URL and this verbosity level are parts of a single argument and must therefore be surrounded in quotes (as seen above) in order to be treated as such by your shell.
## Docker
@@ -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
```
+8 -8
View File
@@ -1,19 +1,19 @@
version: "3"
networks:
default:
# Give the default network created below a sensible name:
name: substrate-telemetry
services:
telemetry-frontend:
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
environment:
SUBSTRATE_TELEMETRY_URL: ws://localhost:8000/feed
ports:
- 3000:80
- 3000:8000
expose:
- 3000
telemetry-backend-shard:
+7 -7
View File
@@ -15,18 +15,18 @@ FROM docker.io/nginx:stable-alpine
LABEL maintainer="Chevdor <chevdor@gmail.com>"
LABEL description="Polkadot Telemetry frontend"
# Each time this container is ran, the value that's provided for this env var
# determines where the frontend will try to request feed information from:
ENV SUBSTRATE_TELEMETRY_URL=
WORKDIR /usr/share/nginx/html
#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/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/nginx/nginx.conf /etc/nginx/nginx.conf
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;\""]
CMD [ "nginx", "-g" ,"daemon off;"]
CMD ["/bin/bash", "-c", "/usr/bin/env.sh && nginx -g \"daemon off;\""]
-48
View File
@@ -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;
}
}
+8 -3
View File
@@ -10,19 +10,24 @@ 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;
}
}
-16
View File
@@ -54,24 +54,8 @@ spec:
httpGet:
path: /
port: http
volumeMounts:
- name: nginx
mountPath: /etc/nginx/nginx.conf
subPath: nginx.conf
readOnly: true
- name: env-config
mountPath: /usr/share/nginx/html/env-config.js
subPath: env-config.js
readOnly: true
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumes:
- name: nginx
configMap:
name: frontend-nginx
- name: env-config
configMap:
name: frontend-env-config
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
-10
View File
@@ -1,10 +0,0 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: frontend-env-config
data:
env-config.js: |
window.process_env = {
SUBSTRATE_TELEMETRY_URL: "wss://feed.telemetry.parity-stg.parity.io/feed",
SUBSTRATE_TELEMETRY_SAMPLE: "",
}
@@ -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;
}
}
}
+4 -1
View File
@@ -26,7 +26,10 @@ fullnameOverride: ""
envVars:
shard: {}
core: {}
frontend: {}
frontend:
# The frontend docker container makes this available to the UI,
# so that it knows where to look for feed information:
SUBSTRATE_TELEMETRY_URL: wss://feed.telemetry.parity-stg.parity.io/feed