Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Deploy script, instructions and starter post

  • Loading branch information...
commit ae58f48888bc1bcb519614101b84a5ab95faf879 1 parent 19284e7
Ryan Daigle authored February 20, 2012
7  .env
... ...
@@ -1,10 +1,7 @@
1  
-RACK_ENV=development
2  
-DEFAULT_TTL=0
3  
-
4  
-NESTA_TITLE=My Name
  1
+NESTA_TITLE="My Name"
5 2
 NESTA_FEED_URL=http://feeds.feedburner.com/MyBlogToken
6 3
 
7  
-NESTA_AUTHOR__NAME=Your Name
  4
+NESTA_AUTHOR__NAME="Your Name"
8 5
 NESTA_AUTHOR__EMAIL=your.email@gmail.com
9 6
 NESTA_AUTHOR__URI=http://mysite.com
10 7
 NESTA_AUTHOR__TWITTER=twitter-handle
31  README.md
Source Rendered
... ...
@@ -0,0 +1,31 @@
  1
+# Nesta CMS App Template
  2
+
  3
+See this blog post for full background, installation and usage details: [http://ryandaigle.com/a/pygments-syntax-highlighting-nesta-cms-heroku](http://ryandaigle.com/a/pygments-syntax-highlighting-nesta-cms-heroku)
  4
+
  5
+## Run locally
  6
+
  7
+Fork this repo and clone locally. Then run:
  8
+
  9
+```term
  10
+$ bundle install
  11
+Fetching git://github.com/krohrbaugh/rack-pygmoku.git
  12
+remote: Counting objects: 90, done.
  13
+...
  14
+Using bundler (1.0.15) 
  15
+Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
  16
+
  17
+$ foreman start
  18
+14:25:47 web.1     | started with pid 59647
  19
+```
  20
+
  21
+Open your browser to [http://localhost:5000](http://localhost:5000) to see the site running.
  22
+
  23
+## Deploying
  24
+
  25
+Assuming you have a Heroku account and have successfully installed the [Heroku Toolbelt](http://toolbelt.heroku.com) [this script](https://raw.github.com/rwdaigle/nesta-app-template/master/deploy.sh) can be run to quickly deploy the site to Heroku, install any dependencies and setup the appropriate configuration.
  26
+
  27
+The site will _not_ incur any charges on Heroku and doesn not use `sudo`.
  28
+
  29
+```term
  30
+$ wget https://raw.github.com/rwdaigle/nesta-app-template/master/deploy.sh | sh
  31
+```
22  config.ru
... ...
@@ -1,13 +1,13 @@
1 1
 require 'rubygems'
2 2
 require 'bundler/setup'
3 3
 
4  
-Bundler.require(:default, ENV['RACK_ENV'])
  4
+Bundler.require(:default, ENV['RACK_ENV'] || 'development')
5 5
 require 'rack/contrib'
6 6
 require 'newrelic_rpm'
7 7
 
8  
-use Rack::ShowExceptions if ENV['RACK_ENV'] == 'development'
  8
+use Rack::ShowExceptions unless ENV['RACK_ENV'] == 'production'
9 9
 
10  
-ttl = ENV['DEFAULT_TTL'].to_i || 300
  10
+ttl = ENV['DEFAULT_TTL'].to_i || 3600
11 11
 use Rack::Cache,
12 12
   :verbose     => true,
13 13
   :default_ttl => ttl,
@@ -24,17 +24,11 @@ use Rack::ETag
24 24
 use Rack::CommonLogger
25 25
 
26 26
 use Rack::Rewrite do
27  
-
28  
-  # Old ryan's scraps URLs
29  
-  # http://ryandaigle.com/articles/2009/8/6/what-s-new-in-edge-rails-cleaner-restful-controllers-w-respond_with
30  
-  r301 %r{/articles/(\d{4})/(\d+)/(\d+)/(.+)}, 'http://archives.ryandaigle.com/articles/$1/$2/$3/$4'
31  
-
32  
-  # http://ryandaigle.com/archives/2007/10
33  
-  r301 %r{/archives/(\d{4})/(\d+)}, 'http://archives.ryandaigle.com/archives/$1/$2'
34  
-
35  
-  r301 %r{/articles.xml(\?.*)?}, 'http://feeds.feedburner.com/RyansScraps', :if => Proc.new { |rack_env|
36  
-    ENV['RACK_ENV'] == 'production' && rack_env['HTTP_USER_AGENT'] !~ /FeedBurner/
37  
-  }
  27
+  if feed_url = ENV['NESTA_FEED_URL']
  28
+    r301 %r{/articles.xml(\?.*)?}, feed_url, :if => Proc.new { |rack_env|
  29
+      ENV['RACK_ENV'] == 'production' && rack_env['HTTP_USER_AGENT'] !~ /FeedBurner/
  30
+    }
  31
+  end
38 32
 end
39 33
 
40 34
 require 'nesta/env'
101  content/pages/welcome.mdown
Source Rendered
... ...
@@ -0,0 +1,101 @@
  1
+Title: Getting Started with the Nesta CMS App Template
  2
+Date: February 20, 2012
  3
+
  4
+Welcome to [Nesta CMS](http://nestacms.com) and the [starter template](https://github.com/rwdaigle/nesta-app-template)/[clean theme](https://github.com/rwdaigle/nesta-app-template) by [Ryan Daigle](http://ryandaigle.com). Now that you've got the site running let's look at how to use it.
  5
+
  6
+## Customization
  7
+
  8
+Open the `.env` file and edit the configuration values for your site and third-party services. For reference [my site's](http://ryandaigle.com) `.env` file looks like this:
  9
+
  10
+<h5 class="file">.env</h5>
  11
+<pre lang="text"><code>
  12
+NESTA_TITLE="Ryan Daigle"
  13
+NESTA_FEED_URL=http://feeds.feedburner.com/RyansScraps
  14
+
  15
+NESTA_AUTHOR__NAME=Ryan Daigle
  16
+NESTA_AUTHOR__EMAIL=ryan.daigle@gmail.com
  17
+NESTA_AUTHOR__URI=http://ryandaigle.com
  18
+NESTA_AUTHOR__TWITTER=rwdaigle
  19
+NESTA_AUTHOR__GITHUB=rwdaigle
  20
+NESTA_AUTHOR__LINKEDIN=rwdaigle
  21
+
  22
+NESTA_THEME=clean
  23
+NESTA_POWERED_BY=true
  24
+
  25
+NESTA_CACHE=false
  26
+NESTA_CONTENT=content
  27
+
  28
+NESTA_DISQUS_SHORT_NAME=ryandaiglecom
  29
+NESTA_PRODUCTION__GOOGLE_ANALYTICS_CODE=UA-77805-8
  30
+</code></pre>
  31
+
  32
+Updating the site on Heroku with new configuration variables can be accomplished with this command:
  33
+
  34
+<pre lang="bash"><code>
  35
+$ cat .env | tr '\n' ' ' | xargs heroku config:add 
  36
+</code></pre>
  37
+
  38
+## Deploying
  39
+
  40
+After the initial app template script runs you can deploy to your site on Heroku just as you would any Heroku site with a `git push heroku master` after committing any changes to the git repository. This includes any new articles or content updates you make.
  41
+
  42
+<pre lang="bash"><code>
  43
+$ git add .
  44
+$ git commit -m "Updates"
  45
+$ git push heroku master
  46
+</code></pre>
  47
+
  48
+## Writing articles
  49
+
  50
+Please see Nesta CMS's [instructions for writing articles](http://nestacms.com/docs/creating-content/pages) to add pages and new posts to your site.
  51
+
  52
+## Update theme
  53
+
  54
+The app template comes with Ryan's [clean nesta theme](https://github.com/rwdaigle/nesta-theme-clean) bundled. To update the theme and get the latest features and styles execute the following starting in your site's local root directory:
  55
+
  56
+<pre lang="bash"><code>
  57
+$ git submodule update
  58
+$ cd themes/clean
  59
+$ git checkout master
  60
+$ git pull origin master
  61
+$ cd ../..
  62
+$ git commit -m "Update to latest clean theme"
  63
+</code></pre>
  64
+
  65
+## Syntax highlighting
  66
+
  67
+The clean theme supports syntax highlighting with Pygments. Here are some examples (view the [source of the file](https://raw.github.com/rwdaigle/nesta-app-template/master/content/pages/welcome.mdown) to see Markdown syntax)
  68
+
  69
+### Ruby
  70
+
  71
+<h5 class="file">ruby</h5>
  72
+<pre lang='ruby'><code>
  73
+def greeting
  74
+  'Hello World!'
  75
+end
  76
+</code></pre>
  77
+
  78
+### Javascript
  79
+<h5 class="file">lib/heroku.js</h5>
  80
+<pre lang='javascript'><code>
  81
+var request = require('request'),
  82
+  fs = require('fs'),
  83
+  spawn = require('child_process').spawn,
  84
+  Hash = require('hashish');;
  85
+
  86
+var version = JSON.parse(fs.readFileSync('package.json','utf8')).version;
  87
+</code></pre>
  88
+
  89
+### Terminal output
  90
+
  91
+<pre lang='bash'><code>
  92
+$ curl "http://gist.github.com/raw/13212qw" > test.txt
  93
+</code></pre>
  94
+
  95
+## Custom domains
  96
+
  97
+Please see Heroku's [custom domain instructions](http://devcenter.heroku.com/articles/custom-domains) to setup your own domain pointing to the site.
  98
+
  99
+## New Relic
  100
+
  101
+_Work in progress_
5  deploy.sh
... ...
@@ -0,0 +1,5 @@
  1
+#!/bin/sh
  2
+heroku create -s cedar --addons memcache,newrelic
  3
+git push heroku master
  4
+cat .env | tr '\n' ' ' | xargs heroku config:add 
  5
+heroku open
2  themes/clean
... ...
@@ -1 +1 @@
1  
-Subproject commit bb79925030ae8378663a834552e6a1cec562a6a0
  1
+Subproject commit 6184f44a5815cd08558d5b27e89beb0df243ad78

0 notes on commit ae58f48

Please sign in to comment.
Something went wrong with that request. Please try again.