Skip to content

Commit

Permalink
website: Moved to netlify.
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 24, 2019
1 parent 7aad30d commit 1994891
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 12 deletions.
11 changes: 5 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
11 changes: 11 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Settings]

[build]
base = ""
publish = "public"

[context.production]
command = "make web"

[context.deploy-preview]
command = "make web 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

0 comments on commit 1994891

Please sign in to comment.