summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty Taylor <mordred@inaugust.com>2019-02-05 16:34:14 +0000
committerMonty Taylor <mordred@inaugust.com>2019-02-05 17:23:24 +0000
commitb4f6ef7b702691e48c575dc43c66155155cfbf4e (patch)
tree79a425c95e1384cce4fed99cc2bcab3be25ebf84
parent73feab3b13caeee7ee4c01fa49a9c3d2c16f82e5 (diff)
Disable service workers by default
The Service Workers seem to be consistently causing issues for people that are strange, meaning many of our deployers are disabling them. Since they aren't super necessary for the Zuul use case, change the default behavior to be to disable them instead of enable them. Change-Id: Iea8348a3b007badaae74fc1837b55bb0b076ac65
Notes
Notes (review): Code-Review+2: Tobias Henkel <tobias.henkel@bmw.de> Code-Review+2: James E. Blair <corvus@inaugust.com> Workflow+1: James E. Blair <corvus@inaugust.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Tue, 05 Feb 2019 19:16:34 +0000 Reviewed-on: https://review.openstack.org/634975 Project: openstack-infra/zuul Branch: refs/heads/master
-rw-r--r--Dockerfile4
-rw-r--r--doc/source/developer/javascript.rst7
-rw-r--r--releasenotes/notes/service-worker-default-b6f6d5c277657ced.yaml6
-rw-r--r--web/src/registerServiceWorker.js3
4 files changed, 14 insertions, 6 deletions
diff --git a/Dockerfile b/Dockerfile
index 33e7e3d..1ed44d1 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -17,8 +17,8 @@ FROM opendevorg/python-builder as builder
17 17
18# Optional location of Zuul API endpoint. 18# Optional location of Zuul API endpoint.
19ARG REACT_APP_ZUUL_API 19ARG REACT_APP_ZUUL_API
20# Optional flag to disable React Service Worker. (set to true to disable) 20# Optional flag to enable React Service Worker. (set to true to enable)
21ARG REACT_APP_DISABLE_SERVICE_WORKER 21ARG REACT_APP_ENABLE_SERVICE_WORKER
22 22
23COPY . /tmp/src 23COPY . /tmp/src
24RUN /tmp/src/tools/install-js-tools.sh 24RUN /tmp/src/tools/install-js-tools.sh
diff --git a/doc/source/developer/javascript.rst b/doc/source/developer/javascript.rst
index 72b8865..ae39663 100644
--- a/doc/source/developer/javascript.rst
+++ b/doc/source/developer/javascript.rst
@@ -193,6 +193,7 @@ As long as `yarn`_ is installed, the installation of zuul will run
193.. _Patternfly: https://www.patternfly.org/ 193.. _Patternfly: https://www.patternfly.org/
194.. _create-react-app: https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md 194.. _create-react-app: https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md
195 195
196In some cases there is the need to disable the service worker which does 196By default, zuul-web provides a Progressive Web Application but does
197advanced caching. In order to do that set the environment variable 197not run a Service Worker. For deployers who would like to enable one,
198``REACT_APP_DISABLE_SERVICE_WORKER=true`` during installation. 198set the environment variable
199``REACT_APP_ENABLE_SERVICE_WORKER=true`` during installation.
diff --git a/releasenotes/notes/service-worker-default-b6f6d5c277657ced.yaml b/releasenotes/notes/service-worker-default-b6f6d5c277657ced.yaml
new file mode 100644
index 0000000..a98fc2b
--- /dev/null
+++ b/releasenotes/notes/service-worker-default-b6f6d5c277657ced.yaml
@@ -0,0 +1,6 @@
1---
2upgrade:
3 - |
4 Service Workers are now disabled by default in the Javascript
5 dashboard. Deployers who wish to enable them need to set
6 ``REACT_APP_ENABLE_SERVICE_WORKER``
diff --git a/web/src/registerServiceWorker.js b/web/src/registerServiceWorker.js
index 3180ade..483e5d5 100644
--- a/web/src/registerServiceWorker.js
+++ b/web/src/registerServiceWorker.js
@@ -21,8 +21,9 @@ const isLocalhost = Boolean(
21) 21)
22 22
23export default function register () { 23export default function register () {
24 if (process.env.REACT_APP_DISABLE_SERVICE_WORKER === 'true') { 24 if (process.env.REACT_APP_ENABLE_SERVICE_WORKER !== 'true') {
25 console.log('Disabled service worker') 25 console.log('Disabled service worker')
26 unregister()
26 return 27 return
27 } 28 }
28 29