From d5aac284d91ddd35942ecff373237013c5147092 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Mon, 31 Oct 2016 15:49:52 -0400 Subject: [PATCH] Switch to Docker-based website build process (#2448) This has been working really well on Nomad and hashicorp.com, so I am ready to port it out to Consul as a beta. This moves the local development to a Docker container, which is the same container that we use to publish the website in production. The result is much faster and more consistent deploys. --- website/Gemfile | 2 +- website/Gemfile.lock | 70 +++++++----------------------- website/Makefile | 20 +++++---- website/README.md | 43 +++++++++--------- website/Vagrantfile | 26 ----------- website/config.rb | 9 ++++ website/packer.json | 18 +++----- website/scripts/deploy.sh | 16 ++++--- website/source/layouts/_header.erb | 2 +- 9 files changed, 75 insertions(+), 131 deletions(-) delete mode 100644 website/Vagrantfile diff --git a/website/Gemfile b/website/Gemfile index 7d30aae647..be31797453 100644 --- a/website/Gemfile +++ b/website/Gemfile @@ -1,3 +1,3 @@ source "https://rubygems.org" -gem "middleman-hashicorp", git: "https://github.com/hashicorp/middleman-hashicorp.git" +gem "middleman-hashicorp", "0.3.4" diff --git a/website/Gemfile.lock b/website/Gemfile.lock index be13244148..f584f9cb6d 100644 --- a/website/Gemfile.lock +++ b/website/Gemfile.lock @@ -1,23 +1,3 @@ -GIT - remote: https://github.com/hashicorp/middleman-hashicorp.git - revision: 80ddc227b26cbbb3742d14396f26172174222080 - specs: - middleman-hashicorp (0.2.0) - bootstrap-sass (~> 3.3) - builder (~> 3.2) - less (~> 2.6) - middleman (~> 3.4) - middleman-livereload (~> 3.4) - middleman-minify-html (~> 3.4) - middleman-syntax (~> 2.0) - rack-contrib (~> 1.2) - rack-protection (~> 1.5) - rack-rewrite (~> 1.5) - rack-ssl-enforcer (~> 0.2) - redcarpet (~> 3.2) - therubyracer (~> 0.12) - thin (~> 1.6) - GEM remote: https://rubygems.org/ specs: @@ -27,7 +7,7 @@ GEM minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - autoprefixer-rails (6.4.1.1) + autoprefixer-rails (6.5.1.1) execjs bootstrap-sass (3.3.7) autoprefixer-rails (>= 5.2.1) @@ -44,7 +24,6 @@ GEM coffee-script-source execjs coffee-script-source (1.10.0) - commonjs (0.2.7) compass (1.0.3) chunky_png (~> 1.2) compass-core (~> 1.0.2) @@ -57,7 +36,6 @@ GEM sass (>= 3.3.0, < 3.5) compass-import-once (1.0.5) sass (>= 3.2, < 3.5) - daemons (1.2.4) em-websocket (0.5.1) eventmachine (>= 0.12.9) http_parser.rb (~> 0.6.0) @@ -65,20 +43,15 @@ GEM eventmachine (1.2.0.1) execjs (2.7.0) ffi (1.9.14) - git-version-bump (0.15.1) haml (4.0.7) tilt hike (1.2.3) hooks (0.4.1) uber (~> 0.0.14) - htmlcompressor (0.2.0) http_parser.rb (0.6.0) i18n (0.7.0) json (1.8.3) kramdown (1.12.0) - less (2.6.0) - commonjs (~> 0.2.7) - libv8 (3.16.14.15) listen (3.0.8) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) @@ -105,55 +78,49 @@ GEM rack (>= 1.4.5, < 2.0) thor (>= 0.15.2, < 2.0) tilt (~> 1.4.1, < 2.0) + middleman-hashicorp (0.3.4) + bootstrap-sass (~> 3.3) + builder (~> 3.2) + middleman (~> 3.4) + middleman-livereload (~> 3.4) + middleman-syntax (~> 3.0) + redcarpet (~> 3.3) middleman-livereload (3.4.6) em-websocket (~> 0.5.1) middleman-core (>= 3.3) rack-livereload (~> 0.3.15) - middleman-minify-html (3.4.1) - htmlcompressor (~> 0.2.0) - middleman-core (>= 3.2) middleman-sprockets (3.5.0) middleman-core (>= 3.3) sprockets (~> 2.12.1) sprockets-helpers (~> 1.1.0) sprockets-sass (~> 1.3.0) - middleman-syntax (2.1.0) + middleman-syntax (3.0.0) middleman-core (>= 3.2) - rouge (~> 1.0) + rouge (~> 2.0) mime-types (3.1) mime-types-data (~> 3.2015) mime-types-data (3.2016.0521) mini_portile2 (2.1.0) minitest (5.9.1) multi_json (1.12.1) - nokogiri (1.6.8) + nokogiri (1.6.8.1) mini_portile2 (~> 2.1.0) - pkg-config (~> 1.1.7) padrino-helpers (0.12.8.1) i18n (~> 0.6, >= 0.6.7) padrino-support (= 0.12.8.1) tilt (~> 1.4.1) padrino-support (0.12.8.1) activesupport (>= 3.1) - pkg-config (1.1.7) rack (1.6.4) - rack-contrib (1.4.0) - git-version-bump (~> 0.15) - rack (~> 1.4) rack-livereload (0.3.16) rack - rack-protection (1.5.3) - rack - rack-rewrite (1.5.1) - rack-ssl-enforcer (0.2.9) rack-test (0.6.3) rack (>= 1.0) - rb-fsevent (0.9.7) + rb-fsevent (0.9.8) rb-inotify (0.9.7) ffi (>= 0.5.0) redcarpet (3.3.4) - ref (2.0.0) - rouge (1.11.1) + rouge (2.0.6) sass (3.4.22) sprockets (2.12.4) hike (~> 1.2) @@ -165,13 +132,6 @@ GEM sprockets-sass (1.3.1) sprockets (~> 2.0) tilt (~> 1.1) - therubyracer (0.12.2) - libv8 (~> 3.16.14.0) - ref - thin (1.7.0) - daemons (~> 1.0, >= 1.0.9) - eventmachine (~> 1.0, >= 1.0.4) - rack (>= 1, < 3) thor (0.19.1) thread_safe (0.3.5) tilt (1.4.1) @@ -188,7 +148,7 @@ PLATFORMS ruby DEPENDENCIES - middleman-hashicorp! + middleman-hashicorp (= 0.3.4) BUNDLED WITH - 1.13.1 + 1.13.6 diff --git a/website/Makefile b/website/Makefile index e1c782e070..a97e8b4c71 100644 --- a/website/Makefile +++ b/website/Makefile @@ -1,10 +1,14 @@ -all: build +VERSION?="0.3.4" -init: - bundle +website: + @echo "==> Starting website in Docker..." + @docker run \ + --interactive \ + --rm \ + --tty \ + --publish "4567:4567" \ + --publish "35729:35729" \ + --volume "$(shell pwd):/website" \ + hashicorp/middleman-hashicorp:${VERSION} -dev: init - bundle exec middleman server - -build: init - bundle exec middleman build +.PHONY: website diff --git a/website/README.md b/website/README.md index b33c268d02..795c2de7ac 100644 --- a/website/README.md +++ b/website/README.md @@ -1,32 +1,31 @@ -Consul Website -============== +# Consul Website -This subdirectory contains the entire source for the [Consul Website](https://www.consul.io). This is a [Middleman](http://middlemanapp.com) project, which builds a static site from these source files. +This subdirectory contains the entire source for the +[Consul Website](https://www.consul.io/). This is a +[Middleman](http://middlemanapp.com) project, which builds a static site from +these source files. -Contributions Welcome! ----------------------- +## Contributions Welcome! -If you find a typo or you feel like you can improve the HTML, CSS, or JavaScript, we welcome contributions. Feel free to open issues or pull requests like any normal GitHub project, and we'll merge it in. +If you find a typo or you feel like you can improve the HTML, CSS, or +JavaScript, we welcome contributions. Feel free to open issues or pull +requests like any normal GitHub project, and we'll merge it in. -Running the Site Locally ------------------------- +## Running the Site Locally -Running the site locally is simple. Clone this repo and run `make dev`. - -Then open up `localhost:4567`. Note that some URLs you may need to append ".html" to make them work (in the navigation and such). - -Building Site -------------- - -Building the static version of the site and running it is simple. Clone this repo and run the following commands: +To run the site locally, clone this repository and run: +```shell +$ make website ``` + +You must have Docker installed for this to work. + +Alternatively, you can manually run the website like this: + +```shell $ bundle -$ bundle exec middleman build -$ foreman start +$ bundle exec middleman server ``` -Then open up `localhost:5000`. - -Alternately, the site can now be deployed to Heroku or Cloud Foundry. - +Then open up `http://localhost:4567`. diff --git a/website/Vagrantfile b/website/Vagrantfile deleted file mode 100644 index 482d3cdf33..0000000000 --- a/website/Vagrantfile +++ /dev/null @@ -1,26 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - -# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! -VAGRANTFILE_API_VERSION = "2" - -$script = <