Skip to content

Commit

Permalink
website: Moved to netlify. (#1078)
Browse files Browse the repository at this point in the history
Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
  • Loading branch information
bwplotka committed Apr 25, 2019
1 parent 7aad30d commit f58d417
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 26 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ data/

website/public/
website/docs-pre-processed/
website/hugo-generated.yaml
19 changes: 10 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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))
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand Down
17 changes: 17 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -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}"
5 changes: 1 addition & 4 deletions scripts/websitepreprocess.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
4 changes: 2 additions & 2 deletions website/hugo.tmpl.yaml → website/hugo.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions website/layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ <h6 class="font-weight-bold">Community</h6>
<h6 class="font-weight-bold">About</h6>
<p>Thanos is an OSS licensed project as Apache License 2.0</p>
</div>
<div class="col col-md-6 col-lg">
<a href="https://www.netlify.com">
<img src="https://www.netlify.com/img/global/badges/netlify-light.svg"/>
</a>
</div>
</div>
</div>
</footer>
Expand Down
7 changes: 0 additions & 7 deletions website/layouts/shortcodes/embedcode.html

This file was deleted.

0 comments on commit f58d417

Please sign in to comment.