From f0ac1034b44d348ca0789d2a4b058474cf20044e Mon Sep 17 00:00:00 2001 From: Bartek Plotka Date: Wed, 24 Apr 2019 23:15:10 +0100 Subject: [PATCH] website: Moved to netlify. Signed-off-by: Bartek Plotka --- Makefile | 19 ++++++++++--------- README.md | 1 + go.mod | 2 +- go.sum | 5 +++-- netlify.toml | 17 +++++++++++++++++ scripts/websitepreprocess.sh | 5 +---- website/{hugo.tmpl.yaml => hugo.yaml} | 4 ++-- website/layouts/_default/baseof.html | 5 +++++ 8 files changed, 40 insertions(+), 18 deletions(-) create mode 100644 netlify.toml rename website/{hugo.tmpl.yaml => hugo.yaml} (91%) diff --git a/Makefile b/Makefile index 5086c93a231..dfd8cab1c62 100644 --- a/Makefile +++ b/Makefile @@ -24,8 +24,8 @@ PROMU ?= $(GOBIN)/promu-$(PROMU_VERSION) PROMU_VERSION ?= 264dc36af9ea3103255063497636bd5713e3e9c1 PROTOC ?= $(GOBIN)/protoc-$(PROTOC_VERSION) PROTOC_VERSION ?= 3.4.0 -# v0.54.0 -HUGO_VERSION ?= b1a82c61aba067952fdae2f73b826fe7d0f3fc2f +# v0.55.3 +HUGO_VERSION ?= 993b84333cd75faa224d02618f312a0e96b53372 HUGO ?= $(GOBIN)/hugo-$(HUGO_VERSION) # v3.1.1 GOBINDATA_VERSION ?= a9c83481b38ebb1c4eb8f0168fd4b10ca1d3c523 @@ -34,6 +34,7 @@ GIT ?= $(shell which git) BZR ?= $(shell which bzr) WEB_DIR ?= website +WEBSITE_BASE_URL ?= thanos.io PUBLIC_DIR ?= $(WEB_DIR)/public ME ?= $(shell whoami) @@ -236,18 +237,16 @@ web-pre-process: web: web-pre-process $(HUGO) @echo ">> building documentation website" # TODO(bwplotka): Make it --gc - @cd $(WEB_DIR) && HUGO_ENV=production $(HUGO) --config hugo-generated.yaml --minify -v + @cd $(WEB_DIR) && HUGO_ENV=production $(HUGO) --config hugo.yaml --minify -v -b $(WEBSITE_BASE_URL) .PHONY: web-serve web-serve: web-pre-process $(HUGO) @echo ">> serving documentation website" - @cd $(WEB_DIR) && $(HUGO) --config hugo-generated.yaml -v server + @cd $(WEB_DIR) && $(HUGO) --config hugo.yaml -v server -.PHONY: web-deploy +# Deprecated. +.PHONY: web-gh-pages-deploy web-deploy: -ifndef GOOGLE_ANALYTICS_TOKEN - $(error GOOGLE_ANALYTICS_TOKEN is not set) -endif # Requires git creds configured beforehand. $(call require_clean_work_tree,"deploy website") @rm -rf $(PUBLIC_DIR) @@ -278,7 +277,9 @@ $(PROMU): $(call fetch_go_bin_version,github.com/prometheus/promu,$(PROMU_VERSION)) $(HUGO): - $(call fetch_go_bin_version,github.com/gohugoio/hugo,$(HUGO_VERSION)) + @go get github.com/gohugoio/hugo@$(HUGO_VERSION) + @mv $(GOBIN)/hugo $(HUGO) + @go mod tidy $(GOBINDATA): $(call fetch_go_bin_version,github.com/go-bindata/go-bindata/go-bindata,$(GOBINDATA_VERSION)) diff --git a/README.md b/README.md index 4ef66559f19..316aa25e817 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ [![GoDoc](https://godoc.org/github.com/improbable-eng/thanos?status.svg)](https://godoc.org/github.com/improbable-eng/thanos) [![Slack](https://img.shields.io/badge/join%20slack-%23thanos-brightgreen.svg)](https://join.slack.com/t/improbable-eng/shared_invite/enQtMzQ1ODcyMzQ5MjM4LWY5ZWZmNGM2ODc5MmViNmQ3ZTA3ZTY3NzQwOTBlMTkzZmIxZTIxODk0OWU3YjZhNWVlNDU3MDlkZGViZjhkMjc) [![Docker Pulls](https://img.shields.io/docker/pulls/improbable/thanos.svg?maxAge=604800)](https://hub.docker.com/r/improbable/thanos/) +[![Netlify Status](https://api.netlify.com/api/v1/badges/664a5091-934c-4b0e-a7b6-bc12f822a590/deploy-status)](https://app.netlify.com/sites/kind-mayer-9cc74b/deploys) ## Overview diff --git a/go.mod b/go.mod index 5dd814f2008..044c0d0441c 100644 --- a/go.mod +++ b/go.mod @@ -41,7 +41,7 @@ require ( golang.org/x/net v0.0.0-20190213061140-3a22650c66bd golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890 golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 - golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 // indirect + golang.org/x/sys v0.0.0-20190322080309-f49334f85ddc // indirect golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2 google.golang.org/api v0.1.0 google.golang.org/appengine v1.4.0 // indirect diff --git a/go.sum b/go.sum index 0f85bf4b87b..ca3bbf06649 100644 --- a/go.sum +++ b/go.sum @@ -249,6 +249,7 @@ github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c h1:Ho+uVpke github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72 h1:qLC7fQah7D6K1B0ujays3HV9gkFtllcxhzImRR7ArPQ= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -285,8 +286,8 @@ golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181218192612-074acd46bca6/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190124100055-b90733256f2e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190322080309-f49334f85ddc h1:4gbWbmmPFp4ySWICouJl6emP0MyS31yy9SrTlAGFT+g= +golang.org/x/sys v0.0.0-20190322080309-f49334f85ddc/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2 h1:z99zHgr7hKfrUcX/KsoJk5FJfjTceCKIp96+biqP4To= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/netlify.toml b/netlify.toml new file mode 100644 index 00000000000..81e5c1b3333 --- /dev/null +++ b/netlify.toml @@ -0,0 +1,17 @@ +[Settings] + +# All netfliy options should be defined here. UI options should stay empty. + +[build] +base = "" +publish = "website/public" + +# Our Makefile build hugo, but it's faster if netlify grab the correct version on their own +# via simple curl. +environment = { HUGO_VERSION="0.55.3" } + +[context.production] +command = "make web HUGO=$(which hugo)" + +[context.deploy-preview] +command = "make web HUGO=$(which hugo) WEBSITE_BASE_URL=${DEPLOY_PRIME_URL}" \ No newline at end of file diff --git a/scripts/websitepreprocess.sh b/scripts/websitepreprocess.sh index a3e6ee214c9..13ca5cb27ad 100755 --- a/scripts/websitepreprocess.sh +++ b/scripts/websitepreprocess.sh @@ -70,7 +70,4 @@ perl -pi -e 's/]\(\//]\(https:\/\/github.com\/improbable-eng\/thanos\/tree\/'${C # 4. All the relative links needs to have ../ This is because Hugo is missing: https://github.com/gohugoio/hugo/pull/3934 perl -pi -e 's/]\(\.\//]\(..\//' ${ALL_DOC_CONTENT_FILES} perl -pi -e 's/]\((?!http)/]\(..\//' ${ALL_DOC_CONTENT_FILES} -perl -pi -e 's/src=\"(?!http)/src=\"..\//' ${ALL_DOC_CONTENT_FILES} - -# Pass Google analytics token: -sed -e 's/${GOOGLE_ANALYTICS_TOKEN}/'${GOOGLE_ANALYTICS_TOKEN}'/' ${WEBSITE_DIR}/hugo.tmpl.yaml > ${WEBSITE_DIR}/hugo-generated.yaml +perl -pi -e 's/src=\"(?!http)/src=\"..\//' ${ALL_DOC_CONTENT_FILES} \ No newline at end of file diff --git a/website/hugo.tmpl.yaml b/website/hugo.yaml similarity index 91% rename from website/hugo.tmpl.yaml rename to website/hugo.yaml index 9840e4d1ef2..4b530f9a598 100644 --- a/website/hugo.tmpl.yaml +++ b/website/hugo.yaml @@ -1,5 +1,5 @@ title: "Thanos - Highly available Prometheus setup with long term storage capabilities" -baseURL: "https://thanos.io" +# This is controlled by makefile: baseURL: "https://thanos.io" languageCode: "en-us" enableGitInfo: true @@ -9,7 +9,7 @@ pygmentsUseClasses: true # We use preprocessing script so it will not work as expected anyway. disableLiveReload: true -googleAnalytics: "${GOOGLE_ANALYTICS_TOKEN}" +googleAnalytics: "UA-137374921-1" # So /thanos/docs/b link from /thanos/docs/some/a will be rewritten as ../b canonifyURLs: true diff --git a/website/layouts/_default/baseof.html b/website/layouts/_default/baseof.html index bb0aa96b52e..c98a45b7485 100644 --- a/website/layouts/_default/baseof.html +++ b/website/layouts/_default/baseof.html @@ -71,6 +71,11 @@
Community
About

Thanos is an OSS licensed project as Apache License 2.0

+
+ + + +