From 832cb9d52c18cf808c75594268e87bf42f58bf0d Mon Sep 17 00:00:00 2001 From: Mary Anthony Date: Sun, 7 Jun 2015 17:58:53 -0700 Subject: [PATCH] Updating for Hugo Updating for tooling tests Updating with the new sed scripts to protect links updating with new image Updating with comments Signed-off-by: Mary Anthony --- Makefile | 15 -------- docs/Dockerfile | 53 +++++++++++----------------- docs/Makefile | 55 ++++++++++++++++++++++++++++++ docs/architecture.md | 6 ++++ docs/building.md | 6 ++++ docs/configuration.md | 16 ++++++--- docs/deploying.md | 16 ++++++--- docs/distribution.md | 17 --------- docs/glossary.md | 10 +++--- docs/migration.md | 6 ++++ docs/notifications.md | 16 ++++++--- docs/osx-setup-guide.md | 6 ++++ docs/{index.md => overview.md} | 15 +++++--- docs/spec/api.md | 16 ++++++--- docs/spec/api.md.tmpl | 15 +++++--- docs/spec/auth/token.md | 15 +++++--- docs/spec/json.md | 15 +++++--- docs/storage-drivers/azure.md | 15 +++++--- docs/storage-drivers/filesystem.md | 15 +++++--- docs/storage-drivers/inmemory.md | 15 +++++--- docs/storage-drivers/rados.md | 15 +++++--- docs/storage-drivers/s3.md | 15 +++++--- docs/storagedrivers.md | 16 ++++++--- 23 files changed, 249 insertions(+), 140 deletions(-) create mode 100644 docs/Makefile delete mode 100644 docs/distribution.md rename docs/{index.md => overview.md} (91%) diff --git a/Makefile b/Makefile index 32cd23aac..a1daeaf67 100644 --- a/Makefile +++ b/Makefile @@ -64,18 +64,3 @@ clean: @rm -rf "${PREFIX}/bin/registry" "${PREFIX}/bin/registry-api-descriptor-template" -# Use the existing docs build cmds from docker/docker -# Later, we will move this into an import -DOCS_MOUNT := $(if $(DOCSDIR),-v $(CURDIR)/$(DOCSDIR):/$(DOCSDIR)) -DOCSPORT := 8000 -DOCKER_DOCS_IMAGE := docker-docs-$(VERSION) -DOCKER_RUN_DOCS := docker run --rm -it $(DOCS_MOUNT) -e AWS_S3_BUCKET -e NOCACHE - -docs: docs-build - $(DOCKER_RUN_DOCS) -p $(DOCSPORT):8000 "$(DOCKER_DOCS_IMAGE)" mkdocs serve - -docs-shell: docs-build - $(DOCKER_RUN_DOCS) -p $(DOCSPORT):8000 "$(DOCKER_DOCS_IMAGE)" bash - -docs-build: - docker build -t "$(DOCKER_DOCS_IMAGE)" -f docs/Dockerfile . diff --git a/docs/Dockerfile b/docs/Dockerfile index d4e60012c..9f3cfa5e4 100644 --- a/docs/Dockerfile +++ b/docs/Dockerfile @@ -1,37 +1,24 @@ -FROM docs/base:latest -MAINTAINER Mary (@moxiegirl) +FROM docs/base:hugo +MAINTAINER Mary Anthony (@moxiegirl) -# to get the git info for this repo +# To get the git info for this repo COPY . /src -# Reset the /docs dir so we can replace the theme meta with the new repo's git info -RUN git reset --hard +COPY . /docs/content/distribution/ -RUN grep "VERSION =" /src/version/version.go | sed 's/.*"\(.*\)".*/\1/' > /docs/VERSION - - -# -# RUN git describe --match 'v[0-9]*' --dirty='.m' --always > /docs/VERSION -# The above line causes a floating point error in our tools -# -COPY docs/* /docs/sources/registry/ -COPY docs/images/* /docs/sources/registry/images/ -COPY docs/spec/* /docs/sources/registry/spec/ -COPY docs/spec/auth/* /docs/sources/registry/spec/auth/ -COPY docs/storage-drivers/* /docs/sources/registry/storage-drivers/ -COPY docs/mkdocs.yml /docs/mkdocs-distribution.yml - -RUN sed -i.old '1s;^;no_version_dropdown: true;' \ - /docs/sources/registry/*.md \ - /docs/sources/registry/spec/*.md \ - /docs/sources/registry/spec/auth/*.md \ - /docs/sources/registry/storage-drivers/*.md - -RUN sed -i.old -e '/^/g'\ - /docs/sources/registry/*.md \ - /docs/sources/registry/spec/*.md \ - /docs/sources/registry/spec/auth/*.md \ - /docs/sources/registry/storage-drivers/*.md - -# Then build everything together, ready for mkdocs -RUN /docs/build.sh +# Sed to process GitHub Markdown +# 1-2 Remove comment code from metadata block +# 3 Remove .md extension from link text +# 4 Change ](/ to ](/project/ in links +# 5 Change ](word) to ](/project/word) +# 6 Change ](../../ to ](/project/ +# 7 Change ](../ to ](/project/word) +# +# +RUN find /docs/content/distribution -type f -name "*.md" -exec sed -i.old \ + -e '/^/g' \ + -e '/^/g' \ + -e 's/\([(]\)\(.*\)\(\.md\)/\1\2/g' \ + -e 's/\(\]\)\([(]\)\(\/\)/\1\2\/distribution\//g' \ + -e 's/\(\][(]\)\([A-z]*[)]\)/\]\(\/distribution\/\2/g' \ + -e 's/\(\][(]\)\(\.\.\/\)/\1\/distribution\//g' {} \; \ No newline at end of file diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 000000000..021e8f6e5 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,55 @@ +.PHONY: all binary build cross default docs docs-build docs-shell shell test test-unit test-integration test-integration-cli test-docker-py validate + +# env vars passed through directly to Docker's build scripts +# to allow things like `make DOCKER_CLIENTONLY=1 binary` easily +# `docs/sources/contributing/devenvironment.md ` and `project/PACKAGERS.md` have some limited documentation of some of these +DOCKER_ENVS := \ + -e BUILDFLAGS \ + -e DOCKER_CLIENTONLY \ + -e DOCKER_EXECDRIVER \ + -e DOCKER_GRAPHDRIVER \ + -e TESTDIRS \ + -e TESTFLAGS \ + -e TIMEOUT +# note: we _cannot_ add "-e DOCKER_BUILDTAGS" here because even if it's unset in the shell, that would shadow the "ENV DOCKER_BUILDTAGS" set in our Dockerfile, which is very important for our official builds + +# to allow `make DOCSDIR=docs docs-shell` (to create a bind mount in docs) +DOCS_MOUNT := $(if $(DOCSDIR),-v $(CURDIR)/$(DOCSDIR):/$(DOCSDIR)) + +# to allow `make DOCSPORT=9000 docs` +DOCSPORT := 8000 + +# Get the IP ADDRESS +DOCKER_IP=$(shell python -c "import urlparse ; print urlparse.urlparse('$(DOCKER_HOST)').hostname or ''") +HUGO_BASE_URL=$(shell test -z "$(DOCKER_IP)" && echo localhost || echo "$(DOCKER_IP)") +HUGO_BIND_IP=0.0.0.0 + +GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null) +DOCKER_IMAGE := docker$(if $(GIT_BRANCH),:$(GIT_BRANCH)) +DOCKER_DOCS_IMAGE := docs-base$(if $(GIT_BRANCH),:$(GIT_BRANCH)) + + +DOCKER_RUN_DOCS := docker run --rm -it $(DOCS_MOUNT) -e AWS_S3_BUCKET -e NOCACHE + +# for some docs workarounds (see below in "docs-build" target) +GITCOMMIT := $(shell git rev-parse --short HEAD 2>/dev/null) + +default: docs + +docs: docs-build + $(DOCKER_RUN_DOCS) -p $(if $(DOCSPORT),$(DOCSPORT):)8000 -e DOCKERHOST "$(DOCKER_DOCS_IMAGE)" hugo server --port=$(DOCSPORT) --baseUrl=$(HUGO_BASE_URL) --bind=$(HUGO_BIND_IP) + +docs-draft: docs-build + $(DOCKER_RUN_DOCS) -p $(if $(DOCSPORT),$(DOCSPORT):)8000 -e DOCKERHOST "$(DOCKER_DOCS_IMAGE)" hugo server --buildDrafts="true" --port=$(DOCSPORT) --baseUrl=$(HUGO_BASE_URL) --bind=$(HUGO_BIND_IP) + + +docs-shell: docs-build + $(DOCKER_RUN_DOCS) -p $(if $(DOCSPORT),$(DOCSPORT):)8000 "$(DOCKER_DOCS_IMAGE)" bash + + +docs-build: +# ( git remote | grep -v upstream ) || git diff --name-status upstream/release..upstream/docs ./ > ./changed-files +# echo "$(GIT_BRANCH)" > GIT_BRANCH +# echo "$(AWS_S3_BUCKET)" > AWS_S3_BUCKET +# echo "$(GITCOMMIT)" > GITCOMMIT + docker build -t "$(DOCKER_DOCS_IMAGE)" . diff --git a/docs/architecture.md b/docs/architecture.md index 09dce42fb..558a1199e 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -1,3 +1,9 @@ + + # Architecture ## Design diff --git a/docs/building.md b/docs/building.md index 9d4960bdd..cd7b082aa 100644 --- a/docs/building.md +++ b/docs/building.md @@ -1,3 +1,9 @@ + + # Build the development environment The first prequisite of properly building distribution targets is to have a Go diff --git a/docs/configuration.md b/docs/configuration.md index 6c423d606..ec342ac18 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -1,8 +1,14 @@ - + + # Registry Configuration Reference diff --git a/docs/deploying.md b/docs/deploying.md index 9f9950b89..226f33070 100644 --- a/docs/deploying.md +++ b/docs/deploying.md @@ -1,8 +1,14 @@ - + + # Deploying a registry server diff --git a/docs/distribution.md b/docs/distribution.md deleted file mode 100644 index bad7362f5..000000000 --- a/docs/distribution.md +++ /dev/null @@ -1,17 +0,0 @@ -# Project - -## Contents -- [Docker Registry 2.0](index.md) -- [Architecture](architecture.md) -- [Build the development environment](building.md) -- [Configure a registry](configuration.md) -- [Deploying a registry server](deploying.md) -- [Microsoft Azure storage driver](storage-drivers/azure.md) -- [Filesystem storage driver](storage-drivers/filesystem.md) -- [In-memory storage driver](storage-drivers/inmemory.md) -- [S3 storage driver](storage-drivers/s3.md) -- [Notifications](notifications.md) -- [Docker Registry HTTP API V2](spec/api.md) -- [Docker Registry v2 authentication via central service](spec/auth/token.md) -- [Docker Distribution JSON Canonicalization](spec/json.md) -- [Docker-Registry Storage Driver](storagedrivers.md) diff --git a/docs/glossary.md b/docs/glossary.md index 6f07a1904..fbe502cc4 100644 --- a/docs/glossary.md +++ b/docs/glossary.md @@ -1,8 +1,8 @@ - + # Glossary diff --git a/docs/migration.md b/docs/migration.md index be3f02bbe..5dbd766f1 100644 --- a/docs/migration.md +++ b/docs/migration.md @@ -1,3 +1,9 @@ + + # Migrating a 1.0 registry to 2.0 TODO: This needs to be revised in light of Olivier's work diff --git a/docs/notifications.md b/docs/notifications.md index fb5897fc9..233b35c73 100644 --- a/docs/notifications.md +++ b/docs/notifications.md @@ -1,8 +1,14 @@ - + + # Notifications diff --git a/docs/osx-setup-guide.md b/docs/osx-setup-guide.md index cd9a24298..c924d4571 100644 --- a/docs/osx-setup-guide.md +++ b/docs/osx-setup-guide.md @@ -1,3 +1,9 @@ + + # OS X Setup Guide This guide will walk you through running the new Go based [Docker registry](https://github.com/docker/distribution) on your local OS X machine. diff --git a/docs/index.md b/docs/overview.md similarity index 91% rename from docs/index.md rename to docs/overview.md index 2a7f08f25..df9ec95b5 100644 --- a/docs/index.md +++ b/docs/overview.md @@ -1,8 +1,13 @@ - + + # Docker Registry diff --git a/docs/spec/api.md b/docs/spec/api.md index 6e050ef28..56eef796b 100644 --- a/docs/spec/api.md +++ b/docs/spec/api.md @@ -1,8 +1,14 @@ - + + # Docker Registry HTTP API V2 diff --git a/docs/spec/api.md.tmpl b/docs/spec/api.md.tmpl index b808a2ad2..20bd2e858 100644 --- a/docs/spec/api.md.tmpl +++ b/docs/spec/api.md.tmpl @@ -1,8 +1,13 @@ - + # Docker Registry HTTP API V2 diff --git a/docs/spec/auth/token.md b/docs/spec/auth/token.md index 5a394cbe4..907eb413a 100644 --- a/docs/spec/auth/token.md +++ b/docs/spec/auth/token.md @@ -1,8 +1,13 @@ - + + # Docker Registry v2 authentication via central service diff --git a/docs/spec/json.md b/docs/spec/json.md index 34440c717..2f49bae1c 100644 --- a/docs/spec/json.md +++ b/docs/spec/json.md @@ -1,8 +1,13 @@ - + + # Docker Distribution JSON Canonicalization diff --git a/docs/storage-drivers/azure.md b/docs/storage-drivers/azure.md index 01cba5c37..9d1db12eb 100644 --- a/docs/storage-drivers/azure.md +++ b/docs/storage-drivers/azure.md @@ -1,8 +1,13 @@ - + + # Microsoft Azure storage driver diff --git a/docs/storage-drivers/filesystem.md b/docs/storage-drivers/filesystem.md index 23d4afbaa..50030d30e 100644 --- a/docs/storage-drivers/filesystem.md +++ b/docs/storage-drivers/filesystem.md @@ -1,8 +1,13 @@ - + + # Filesystem storage driver diff --git a/docs/storage-drivers/inmemory.md b/docs/storage-drivers/inmemory.md index 948cd5bcb..7256b941b 100644 --- a/docs/storage-drivers/inmemory.md +++ b/docs/storage-drivers/inmemory.md @@ -1,8 +1,13 @@ - + + # In-memory storage driver diff --git a/docs/storage-drivers/rados.md b/docs/storage-drivers/rados.md index 41f51c339..83cdea264 100644 --- a/docs/storage-drivers/rados.md +++ b/docs/storage-drivers/rados.md @@ -1,8 +1,13 @@ - + + # Ceph RADOS storage driver diff --git a/docs/storage-drivers/s3.md b/docs/storage-drivers/s3.md index e6c113485..4393bd767 100644 --- a/docs/storage-drivers/s3.md +++ b/docs/storage-drivers/s3.md @@ -1,8 +1,13 @@ - + + # S3 storage driver diff --git a/docs/storagedrivers.md b/docs/storagedrivers.md index f0bba664c..b7445f422 100644 --- a/docs/storagedrivers.md +++ b/docs/storagedrivers.md @@ -1,8 +1,14 @@ - + + # Docker Registry Storage Driver