pass the feed URL via env var rather than config map so that standalone Docker usage is simplified

This commit is contained in:
James Wilson
2021-08-14 11:32:48 +01:00
parent 502fd2e91a
commit 8793d0fd5b
5 changed files with 12 additions and 25 deletions
+1 -1
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
+7 -6
View File
@@ -15,18 +15,19 @@ FROM docker.io/nginx:stable-alpine
LABEL maintainer="Chevdor <chevdor@gmail.com>"
LABEL description="Polkadot Telemetry frontend"
# When we run the built docker image, the default command uses this
# env var to tell the UI where to look to get feed info.
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/nginx/default /etc/nginx/sites-available/default
COPY --from=builder /opt/builder/build /usr/share/nginx/html
EXPOSE 80
#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;\""]
-7
View File
@@ -59,19 +59,12 @@ spec:
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: "",
}
+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