You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+32-2Lines changed: 32 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,8 @@ This repo is used to build a Docker container that serves the codeorigin site fo
5
5
6
6
## Build a local copy
7
7
8
+
### Default, no restrictions
9
+
8
10
To build a local container (defaults to "break glass" mode):
9
11
10
12
1. Install Docker
@@ -13,6 +15,8 @@ To build a local container (defaults to "break glass" mode):
13
15
1. Run the container, exposing port 80: `docker run -p 127.0.0.1:80:80/tcp releases`
14
16
1. To exit the container, press `ctrl+c`
15
17
18
+
### Redirect non-origin pulls to CDN
19
+
16
20
To build a local container in deployment mode (redirecting any requests without the magic header that indicates an origin pull), build the container with the header value in an environment variable:
17
21
18
22
1. Install Docker
@@ -27,12 +31,38 @@ Note that you will need to keep track of `$CDN_ACCESS_KEY` and add it to the hea
27
31
* This should always redirect to `code.jquery.org`: `curl -i localhost/jquery-3.1.1.js`
28
32
* This should always deliver a copy of the file (don't forget to set the environment variable in your current shell): `curl -i -H "cdn-access: ${CDN_ACCESS_KEY}" localhost/jquery-3.1.1.js`
29
33
34
+
### Add support for `purge.php`
35
+
36
+
To build a container with support for `purge.php`, set environment variables with the CDN's API key and account hash.
37
+
38
+
1. Install Docker
39
+
1. Clone this repo, and `cd` into it
40
+
1. Set environment variables for the CDN API key and account hash: `CDN_PURGE_API_TOKEN=(jQuery secret API token) && CDN_PURGE_ACCOUNT_HASH=(jQuery account hash)`
1. Run the container, exposing port 80: `docker run -p 127.0.0.1:80:80/tcp purge-releases`
43
+
1. To exit the container, press `ctrl+c`
44
+
45
+
### Production clone
46
+
47
+
To build a production clone, include the steps for both non-origin redirects and `purge.php`.
48
+
49
+
1. Install Docker
50
+
1. Clone this repo, and `cd` into it
51
+
1. Generate a random string for the environment variable: ``CDN_ACCESS_KEY=`openssl rand -hex 16` ``
52
+
1. Set environment variables for the CDN API key and account hash: `CDN_PURGE_API_TOKEN=(jQuery secret API token) && CDN_PURGE_ACCOUNT_HASH=(jQuery account hash)`
1. Run the container, exposing port 80: `docker run -p 127.0.0.1:80:80/tcp purge-releases`
55
+
1. To exit the container, press `ctrl+c`
56
+
30
57
## Build the production site
31
58
32
-
To deploy, first generate the CDN access key. Next, you'll need to configure the container host to build from the Dockerfile in this repository, and use the CDN access key as a build argument. Finally, you'll configure the CDN to send both the Host header and the access key during origin pulls.
59
+
To deploy, first generate the CDN access key and locate the CDN API token and account hashes. Next, you'll need to configure the container host to build from the Dockerfile in this repository, and use the CDN access key, CDN API token, and CDN account hash as build arguments. Finally, you'll configure the CDN to send both the Host header and the access key during origin pulls.
33
60
34
61
1. Generate the access key: ``CDN_ACCESS_KEY=`openssl rand -hex 16` ``
35
-
1. Configure the container host to build from this repo, and set this build variable: `CDN_ACCESS_KEY=(Insert the value of $CDN_ACCESS_KEY here)`
62
+
1. Configure the container host to build from this repo, and set these build variable:
63
+
*`CDN_ACCESS_KEY=(Insert the value of $CDN_ACCESS_KEY here)`
64
+
*`CDN_PURGE_API_TOKEN=(Insert the value of the API token here)`
65
+
*`CDN_PURGE_ACCOUNT_HASH=(Insert the value of the account hash)`
36
66
1. Create the magic header and the host header at the CDN: `cdn-access: (Insert the value of $CDN_ACCESS_KEY here)|Host: (insert URL to app container)`
0 commit comments