Coder Social home page Coder Social logo

danbates2 / blog Goto Github PK

View Code? Open in Web Editor NEW

This project forked from openenergymonitor/blog

0.0 3.0 0.0 140.36 MB

OpenEnergyMonitor Blog

Home Page: https://blog.openenergymonitor.org

CSS 6.25% HTML 90.90% JavaScript 2.15% Ruby 0.68% Python 0.02%

blog's Introduction

OpenEnergyMonitor Blog

Build Status

A fast clean responsive blog

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

Preview Jekyll website locally

Command Action
rake 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

Setup

Install Ruby

Jekyll requires Ruby 2.x and bundler installed. Ubuntu 14.04 only includes 1.9.3 in it's packages. Solution use RVM (Ruby version manager), install with:

$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
$ \curl -sSL https://get.rvm.io | bash -s stable

Perform any further tasks recomended by rvm installer then restart shell session to re-load bash profile.

$ rvm install 2.3

Install required Ruby Gems

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

Preview site locally

$ rake generate
$ 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/blog

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

https://blog.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 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: rake generate
after_success:
- '[ "${TRAVIS_BRANCH}" = "master" ] && [ "${TRAVIS_PULL_REQUEST}" = "false" ] && rake deploy || true'
env:
  global:
  - GH_REF: github.com/username/repo.git
  - secure: <encrypted GH token>

Use custom URLs

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

blog's People

Contributors

danbates2 avatar glynhudson avatar myrddinmuse avatar slyremarks avatar trystanlea avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.