Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.markdown

OpenEnergyMonitor Guide Website

Build Status

A clean responsive user guide website for OpenEnergyMonitor.

Using all the shiny new toys: powered by Jekyll and the Oscalite theme. Hosted by GitHub and served over SSL/TSL by CloudFlare.

Edit site using Prose editor

Preview Jekyll website locally

Command Action
rake generate preview Generate & Preview site on http://localhost:4001
rake generate Generates static html in /public
rake deploy Deploys site to gh-pages branch
rake deploy rsync Deploys site via rsync over SSH

Edit sidebar nav menu

guide/source/_includes/asides/navigation_side.html

Setup

Install Ruby

Jekyll requires Ruby 2.x and bundler installed

To install Ruby:

  1. First, update the packages index and install the packages required for the ruby-build tool to build Ruby from source:
sudo apt update
sudo apt install git curl libssl-dev libreadline-dev zlib1g-dev autoconf bison build-essential libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev rbenv
  1. Add $HOME/.rbenv/bin to the system PATH.
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc
  1. Next, run the following curl command to install both rbenv and ruby-build:

curl -sL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-installer | bash -

  1. Install the latest stable version of Ruby and set it as a default version with:
rbenv install 2.7.0
rbenv global 2.7.0

To list all available Ruby versions you can use: rbenv install -l

  1. Verify that Ruby was properly installed by printing out the version number:

ruby -v

  1. Install rubygems

sudo apt-get install rubygems

Install bundler and required gems

$ gem install bundler
$ git clone --recursive https://github.com/openenergymonitor/guide.git
$ cd guide
$ bundle

Preview site locally

$ bundle exec rake generate preview

https://localhost:4001

Full Ruby installation instructions


Deploy to GitHub Pages

This website is hosted using GitHub Project pages. Github will serve the site from the gh-pages branch.

If this is the first time we publishing this site we neeed to create the gh-pages branch:

git checkout --orphan gh-pages

Once Octopress and rake Jekyll as been setup as described to generate the html and deploy site to gh-pages run

$ rake generate

$ rake deploy

In a few moments site will be live:

http://openenergymonitor.github.io/guide

We then use CloudFlare as the DNS which serves the pages via secure HTTPS. On our domain (see custom domain below)

https://guide.openenergymonitor.org

Auto deploy on commit trigger

In the deploy example above the site is generated locally then pushed to github pages. It's possible to automate this build to make everything happen (by magic!) in the cloud:

Travis CI with rake-jekyll can be used to automate a deployment of the website (build + push commit to gh-pages) afer a git push or pull reqest merge to master

To Setup

  • Create account & turn on Travis CI for the repo in the travis dashboard
  • Generate Github personal token or use
  • curl -u 'your_github_name' -d '{ "scopes": [ "public_repo"], "note": "Travis access"}' https://api.github.com/authorizations
  • Install Travis command line gem install travis
  • Encypt token and add to travis.yaml by running the following in website dir: $ travis encrypt GH_TOKEN=XXXXXX --add env.global

Example travis.yaml to generate the site using rake generate then if generation is succesful deploy to gh pages branch with rake deploy:

language: ruby
sudo: false
cache: bundler
script: bundle exec rake generate
after_success: bundle exec rake deploy
env:
  global:
    secure:  <encrypted GH token>

Use custom URL's

Add CNAME file with custom domain and point CNAME DNS to openenergymonitor.github.io

Credits

Thanks to @balloob from home-assistant.io for providing Octopress example. Home-assistant is an awesome open-sopurce Python3 home automation platform. See blog post for how to integrate with OpenEnergyMonitor emonPi

You can’t perform that action at this time.