Permalink
Browse files

Deploy script, instructions and starter post

  • Loading branch information...
1 parent 19284e7 commit ae58f48888bc1bcb519614101b84a5ab95faf879 @rwdaigle committed Feb 20, 2012
Showing with 148 additions and 20 deletions.
  1. +2 −5 .env
  2. +31 −0 README.md
  3. +8 −14 config.ru
  4. +101 −0 content/pages/welcome.mdown
  5. +5 −0 deploy.sh
  6. +1 −1 themes/clean
View
7 .env
@@ -1,10 +1,7 @@
-RACK_ENV=development
-DEFAULT_TTL=0
-
-NESTA_TITLE=My Name
+NESTA_TITLE="My Name"
NESTA_FEED_URL=http://feeds.feedburner.com/MyBlogToken
-NESTA_AUTHOR__NAME=Your Name
+NESTA_AUTHOR__NAME="Your Name"
NESTA_AUTHOR__EMAIL=your.email@gmail.com
NESTA_AUTHOR__URI=http://mysite.com
NESTA_AUTHOR__TWITTER=twitter-handle
View
31 README.md
@@ -0,0 +1,31 @@
+# Nesta CMS App Template
+
+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)
+
+## Run locally
+
+Fork this repo and clone locally. Then run:
+
+```term
+$ bundle install
+Fetching git://github.com/krohrbaugh/rack-pygmoku.git
+remote: Counting objects: 90, done.
+...
+Using bundler (1.0.15)
+Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
+
+$ foreman start
+14:25:47 web.1 | started with pid 59647
+```
+
+Open your browser to [http://localhost:5000](http://localhost:5000) to see the site running.
+
+## Deploying
+
+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.
+
+The site will _not_ incur any charges on Heroku and doesn not use `sudo`.
+
+```term
+$ wget https://raw.github.com/rwdaigle/nesta-app-template/master/deploy.sh | sh
+```
View
22 config.ru
@@ -1,13 +1,13 @@
require 'rubygems'
require 'bundler/setup'
-Bundler.require(:default, ENV['RACK_ENV'])
+Bundler.require(:default, ENV['RACK_ENV'] || 'development')
require 'rack/contrib'
require 'newrelic_rpm'
-use Rack::ShowExceptions if ENV['RACK_ENV'] == 'development'
+use Rack::ShowExceptions unless ENV['RACK_ENV'] == 'production'
-ttl = ENV['DEFAULT_TTL'].to_i || 300
+ttl = ENV['DEFAULT_TTL'].to_i || 3600
use Rack::Cache,
:verbose => true,
:default_ttl => ttl,
@@ -24,17 +24,11 @@ use Rack::ETag
use Rack::CommonLogger
use Rack::Rewrite do
-
- # Old ryan's scraps URLs
- # http://ryandaigle.com/articles/2009/8/6/what-s-new-in-edge-rails-cleaner-restful-controllers-w-respond_with
- r301 %r{/articles/(\d{4})/(\d+)/(\d+)/(.+)}, 'http://archives.ryandaigle.com/articles/$1/$2/$3/$4'
-
- # http://ryandaigle.com/archives/2007/10
- r301 %r{/archives/(\d{4})/(\d+)}, 'http://archives.ryandaigle.com/archives/$1/$2'
-
- r301 %r{/articles.xml(\?.*)?}, 'http://feeds.feedburner.com/RyansScraps', :if => Proc.new { |rack_env|
- ENV['RACK_ENV'] == 'production' && rack_env['HTTP_USER_AGENT'] !~ /FeedBurner/
- }
+ if feed_url = ENV['NESTA_FEED_URL']
+ r301 %r{/articles.xml(\?.*)?}, feed_url, :if => Proc.new { |rack_env|
+ ENV['RACK_ENV'] == 'production' && rack_env['HTTP_USER_AGENT'] !~ /FeedBurner/
+ }
+ end
end
require 'nesta/env'
View
101 content/pages/welcome.mdown
@@ -0,0 +1,101 @@
+Title: Getting Started with the Nesta CMS App Template
+Date: February 20, 2012
+
+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.
+
+## Customization
+
+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:
+
+<h5 class="file">.env</h5>
+<pre lang="text"><code>
+NESTA_TITLE="Ryan Daigle"
+NESTA_FEED_URL=http://feeds.feedburner.com/RyansScraps
+
+NESTA_AUTHOR__NAME=Ryan Daigle
+NESTA_AUTHOR__EMAIL=ryan.daigle@gmail.com
+NESTA_AUTHOR__URI=http://ryandaigle.com
+NESTA_AUTHOR__TWITTER=rwdaigle
+NESTA_AUTHOR__GITHUB=rwdaigle
+NESTA_AUTHOR__LINKEDIN=rwdaigle
+
+NESTA_THEME=clean
+NESTA_POWERED_BY=true
+
+NESTA_CACHE=false
+NESTA_CONTENT=content
+
+NESTA_DISQUS_SHORT_NAME=ryandaiglecom
+NESTA_PRODUCTION__GOOGLE_ANALYTICS_CODE=UA-77805-8
+</code></pre>
+
+Updating the site on Heroku with new configuration variables can be accomplished with this command:
+
+<pre lang="bash"><code>
+$ cat .env | tr '\n' ' ' | xargs heroku config:add
+</code></pre>
+
+## Deploying
+
+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.
+
+<pre lang="bash"><code>
+$ git add .
+$ git commit -m "Updates"
+$ git push heroku master
+</code></pre>
+
+## Writing articles
+
+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.
+
+## Update theme
+
+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:
+
+<pre lang="bash"><code>
+$ git submodule update
+$ cd themes/clean
+$ git checkout master
+$ git pull origin master
+$ cd ../..
+$ git commit -m "Update to latest clean theme"
+</code></pre>
+
+## Syntax highlighting
+
+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)
+
+### Ruby
+
+<h5 class="file">ruby</h5>
+<pre lang='ruby'><code>
+def greeting
+ 'Hello World!'
+end
+</code></pre>
+
+### Javascript
+<h5 class="file">lib/heroku.js</h5>
+<pre lang='javascript'><code>
+var request = require('request'),
+ fs = require('fs'),
+ spawn = require('child_process').spawn,
+ Hash = require('hashish');;
+
+var version = JSON.parse(fs.readFileSync('package.json','utf8')).version;
+</code></pre>
+
+### Terminal output
+
+<pre lang='bash'><code>
+$ curl "http://gist.github.com/raw/13212qw" > test.txt
+</code></pre>
+
+## Custom domains
+
+Please see Heroku's [custom domain instructions](http://devcenter.heroku.com/articles/custom-domains) to setup your own domain pointing to the site.
+
+## New Relic
+
+_Work in progress_
View
5 deploy.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+heroku create -s cedar --addons memcache,newrelic
+git push heroku master
+cat .env | tr '\n' ' ' | xargs heroku config:add
+heroku open
2 themes/clean
@@ -1 +1 @@
-Subproject commit bb79925030ae8378663a834552e6a1cec562a6a0
+Subproject commit 6184f44a5815cd08558d5b27e89beb0df243ad78

0 comments on commit ae58f48

Please sign in to comment.