Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
Docker-DCO-1.1-Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au> (github: SvenDowideit)
Signed-off-by: Sven Dowideit <SvenDowideit@docker.com>
| ... | ... |
@@ -53,7 +53,7 @@ docs-shell: docs-build |
| 53 | 53 |
$(DOCKER_RUN_DOCS) -p $(if $(DOCSPORT),$(DOCSPORT):)8000 "$(DOCKER_DOCS_IMAGE)" bash |
| 54 | 54 |
|
| 55 | 55 |
docs-release: docs-build |
| 56 |
- $(DOCKER_RUN_DOCS) -e OPTIONS -e BUILD_ROOT "$(DOCKER_DOCS_IMAGE)" ./release.sh |
|
| 56 |
+ $(DOCKER_RUN_DOCS) -e OPTIONS -e BUILD_ROOT -e DISTRIBUTION_ID "$(DOCKER_DOCS_IMAGE)" ./release.sh |
|
| 57 | 57 |
|
| 58 | 58 |
docs-test: docs-build |
| 59 | 59 |
$(DOCKER_RUN_DOCS) "$(DOCKER_DOCS_IMAGE)" ./test.sh |
| ... | ... |
@@ -83,6 +83,7 @@ build: bundles |
| 83 | 83 |
docker build -t "$(DOCKER_IMAGE)" . |
| 84 | 84 |
|
| 85 | 85 |
docs-build: |
| 86 |
+ git diff --name-status upstream/release..upstream/docs docs/ > docs/changed-files |
|
| 86 | 87 |
cp ./VERSION docs/VERSION |
| 87 | 88 |
echo "$(GIT_BRANCH)" > docs/GIT_BRANCH |
| 88 | 89 |
echo "$(AWS_S3_BUCKET)" > docs/AWS_S3_BUCKET |
| ... | ... |
@@ -145,11 +145,13 @@ to view your results and make sure what you published is what you wanted. |
| 145 | 145 |
|
| 146 | 146 |
When you're happy with it, publish the docs to our live site: |
| 147 | 147 |
|
| 148 |
- make AWS_S3_BUCKET=docs.docker.com BUILD_ROOT=yes docs-release |
|
| 148 |
+ make AWS_S3_BUCKET=docs.docker.com BUILD_ROOT=yes DISTRIBUTION_ID=C2K6......FL2F docs-release |
|
| 149 | 149 |
|
| 150 | 150 |
Test the uncached version of the live docs at http://docs.docker.com.s3-website-us-east-1.amazonaws.com/ |
| 151 | 151 |
|
| 152 | 152 |
Note that the new docs will not appear live on the site until the cache (a complex, |
| 153 |
-distributed CDN system) is flushed. This requires someone with S3 keys. Contact Docker |
|
| 154 |
-(Sven Dowideit or John Costa) for assistance. |
|
| 153 |
+distributed CDN system) is flushed. The `make docs-release` command will do this |
|
| 154 |
+_if_ the `DISTRIBUTION_ID` is set to the Cloudfront distribution ID (ask the meta |
|
| 155 |
+team) - this will take at least 15 minutes to run and you can check its progress |
|
| 156 |
+with the CDN Cloudfront Chrome addin. |
|
| 155 | 157 |
|
| ... | ... |
@@ -97,6 +97,50 @@ upload_current_documentation() {
|
| 97 | 97 |
$run |
| 98 | 98 |
} |
| 99 | 99 |
|
| 100 |
+invalidate_cache() {
|
|
| 101 |
+ if [ "" == "$DISTRIBUTION_ID" ]; then |
|
| 102 |
+ echo "Skipping Cloudfront cache invalidation" |
|
| 103 |
+ return |
|
| 104 |
+ fi |
|
| 105 |
+ |
|
| 106 |
+ dst=$1 |
|
| 107 |
+ |
|
| 108 |
+ #aws cloudfront create-invalidation --profile docs.docker.com --distribution-id $DISTRIBUTION_ID --invalidation-batch '{"Paths":{"Quantity":1, "Items":["'+$file+'"]},"CallerReference":"19dec2014sventest1"}'
|
|
| 109 |
+ aws configure set preview.cloudfront true |
|
| 110 |
+ |
|
| 111 |
+ files=($(cat changed-files | grep 'sources/.*$' | sed -E 's#.*docs/sources##' | sed -E 's#index\.md#index.html#' | sed -E 's#\.md#/index.html#')) |
|
| 112 |
+ files[${#files[@]}]="/index.html"
|
|
| 113 |
+ files[${#files[@]}]="/versions.html_fragment"
|
|
| 114 |
+ |
|
| 115 |
+ len=${#files[@]}
|
|
| 116 |
+ |
|
| 117 |
+ echo "aws cloudfront create-invalidation --profile docs.docker.com --distribution-id $DISTRIBUTION_ID --invalidation-batch '" > batchfile |
|
| 118 |
+ echo "{\"Paths\":{\"Quantity\":$len," >> batchfile
|
|
| 119 |
+ echo "\"Items\": [" >> batchfile |
|
| 120 |
+ |
|
| 121 |
+ #for file in $(cat changed-files | grep 'sources/.*$' | sed -E 's#.*docs/sources##' | sed -E 's#index\.md#index.html#' | sed -E 's#\.md#/index.html#') |
|
| 122 |
+ for file in "${files[@]}"
|
|
| 123 |
+ do |
|
| 124 |
+ if [ "$file" == "${files[${#files[@]}-1]}" ]; then
|
|
| 125 |
+ comma="" |
|
| 126 |
+ else |
|
| 127 |
+ comma="," |
|
| 128 |
+ fi |
|
| 129 |
+ echo "\"$dst$file\"$comma" >> batchfile |
|
| 130 |
+ done |
|
| 131 |
+ |
|
| 132 |
+ echo "]}, \"CallerReference\":" >> batchfile |
|
| 133 |
+ echo "\"$(date)\"}'" >> batchfile |
|
| 134 |
+ |
|
| 135 |
+ |
|
| 136 |
+ echo "-----" |
|
| 137 |
+ cat batchfile |
|
| 138 |
+ echo "-----" |
|
| 139 |
+ sh batchfile |
|
| 140 |
+ echo "-----" |
|
| 141 |
+} |
|
| 142 |
+ |
|
| 143 |
+ |
|
| 100 | 144 |
if [ "$OPTIONS" != "--dryrun" ]; then |
| 101 | 145 |
setup_s3 |
| 102 | 146 |
fi |
| ... | ... |
@@ -106,6 +150,7 @@ if [ "$BUILD_ROOT" == "yes" ]; then |
| 106 | 106 |
echo "Building root documentation" |
| 107 | 107 |
build_current_documentation |
| 108 | 108 |
upload_current_documentation |
| 109 |
+ invalidate_cache |
|
| 109 | 110 |
fi |
| 110 | 111 |
|
| 111 | 112 |
#build again with /v1.0/ prefix |
| ... | ... |
@@ -113,3 +158,4 @@ sed -i "s/^site_url:.*/site_url: \/$MAJOR_MINOR\//" mkdocs.yml |
| 113 | 113 |
echo "Building the /$MAJOR_MINOR/ documentation" |
| 114 | 114 |
build_current_documentation |
| 115 | 115 |
upload_current_documentation "/$MAJOR_MINOR/" |
| 116 |
+invalidate_cache "/$MAJOR_MINOR" |
| ... | ... |
@@ -267,14 +267,17 @@ git checkout -b docs release || git checkout docs |
| 267 | 267 |
git fetch |
| 268 | 268 |
git reset --hard origin/release |
| 269 | 269 |
git push -f origin docs |
| 270 |
-make AWS_S3_BUCKET=docs.docker.com BUILD_ROOT=yes docs-release |
|
| 270 |
+make AWS_S3_BUCKET=docs.docker.com BUILD_ROOT=yes DISTRIBUTION_ID=C2K6......FL2F docs-release |
|
| 271 | 271 |
``` |
| 272 | 272 |
|
| 273 | 273 |
The docs will appear on http://docs.docker.com/ (though there may be cached |
| 274 | 274 |
versions, so its worth checking http://docs.docker.com.s3-website-us-east-1.amazonaws.com/). |
| 275 | 275 |
For more information about documentation releases, see `docs/README.md`. |
| 276 | 276 |
|
| 277 |
-Ask Sven, or JohnC to invalidate the cloudfront cache using the CND Planet chrome applet. |
|
| 277 |
+Note that the new docs will not appear live on the site until the cache (a complex, |
|
| 278 |
+distributed CDN system) is flushed. The `make docs-release` command will do this |
|
| 279 |
+_if_ the `DISTRIBUTION_ID` is set correctly - this will take at least 15 minutes to run |
|
| 280 |
+and you can check its progress with the CDN Cloudfront Chrome addin. |
|
| 278 | 281 |
|
| 279 | 282 |
### 12. Create a new pull request to merge release back into master |
| 280 | 283 |
|