From 342e71ee655d9583836053a88f04a422239e0942 Mon Sep 17 00:00:00 2001 From: Paul Melnikow Date: Mon, 4 Dec 2017 19:08:48 -0500 Subject: [PATCH] Update docs re production builds (#1316) --- README.md | 2 +- doc/self-hosting.md | 20 +++++++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d01c622ea1db8..d16642fd90702 100644 --- a/README.md +++ b/README.md @@ -127,7 +127,7 @@ Development 6. Open `http://[::]:8080/` to view the home page. To generate the frontend using production cache settings – that is, -badge preview URIs with `maxAge` – run `npm run build:production`. +badge preview URIs with `maxAge` – run `LONG_CACHE=true npm run build`. To analyze the frontend bundle, run `npm install webpack-bundle-analyzer` and then `ANALYZE=true npm start`. diff --git a/doc/self-hosting.md b/doc/self-hosting.md index d6e29d564369c..9974610f6d9ec 100644 --- a/doc/self-hosting.md +++ b/doc/self-hosting.md @@ -26,7 +26,7 @@ Build the frontend ------------------ ```sh -BASE_URL=https://your-server.example.com npm run build:production +LONG_CACHE=true npm run build ``` @@ -147,15 +147,18 @@ Separate frontend hosting ------------------------- If you want to host the frontend on a separate server, such as cloud storage -or a CDN, you can do that. Just copy the built `index.html` there. +or a CDN, you can do that. -To help out users, you can make the Shields server redirect the server root. -Set the `REDIRECT_URI` environment variable: +First, build the frontend, pointing `BASE_URL` to your server. ```sh -REDIRECT_URI=http://my-custom-shields.s3.amazonaws.com/ +LONG_CACHE=true BASE_URL=https://your-server.example.com npm run build ``` +Then copy the contents of the `build/` folder to your static hosting / CDN. + +There are also a couple settings you should configure on the server. + If you want to use server suggestions, you should also set `ALLOWED_ORIGIN`: ```sh @@ -164,3 +167,10 @@ ALLOWED_ORIGIN=http://my-custom-shields.s3.amazonaws.com,https://my-custom-shiel This should be a comma-separated list of allowed origin headers. They should not have paths or trailing slashes. + +To help out users, you can make the Shields server redirect the server root. +Set the `REDIRECT_URI` environment variable: + +```sh +REDIRECT_URI=http://my-custom-shields.s3.amazonaws.com/ +```