Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Initial commit of rack-cache on Heroku Cedar

  • Loading branch information...
commit 574db2cc3b2b3fc261deeb678d2df565548cf9fb 0 parents
@rwdaigle authored
2  .env
@@ -0,0 +1,2 @@
+LANG=en_US.UTF-8
+RACK_ENV=development
1  .rvmrc
@@ -0,0 +1 @@
+rvm use ruby-1.9.2@demo.rackcache --create
27 DEMO
@@ -0,0 +1,27 @@
+# Setup
+
+git clone git@github.com:rwdaigle/tweetstream.git
+bundle install
+
+# Create & configure
+
+heroku create ryan-tweetstream --stack cedar
+heroku config:add TWITTER_USERNAME=herokutesting TWITTER_PASSWORD=heroku TWITTER_KEYWORD=ruby
+heroku addons:add pusher:test redistogo:small
+git push heroku master
+
+# Run/scale
+
+heroku scale web=1 stream=1 clock=1
+
+# Introspect
+
+watch heroku ps
+heroku releases
+heroku logs --tail -s app
+
+# Manage
+
+heroku config:add TWITTER_KEYWORD=node
+heroku run bundle exec rake tweetstream:queue:clear
+heroku run bash
10 Gemfile
@@ -0,0 +1,10 @@
+source "http://rubygems.org"
+
+gem 'thin'
+gem 'sinatra'
+gem 'rack-cache'
+gem 'memcached'
+
+group :development, :test do
+ gem 'foreman'
+end
32 Gemfile.lock
@@ -0,0 +1,32 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ daemons (1.1.3)
+ eventmachine (0.12.10)
+ foreman (0.18.0)
+ term-ansicolor (~> 1.0.5)
+ thor (>= 0.13.6)
+ memcached (1.2.7)
+ rack (1.2.2)
+ rack-cache (1.0.2)
+ rack (>= 0.4)
+ sinatra (1.2.6)
+ rack (~> 1.1)
+ tilt (< 2.0, >= 1.2.2)
+ term-ansicolor (1.0.5)
+ thin (1.2.11)
+ daemons (>= 1.0.9)
+ eventmachine (>= 0.12.6)
+ rack (>= 1.0.0)
+ thor (0.14.6)
+ tilt (1.3)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ foreman
+ memcached
+ rack-cache
+ sinatra
+ thin
1  Procfile
@@ -0,0 +1 @@
+web: bundle exec thin start -p $PORT -e $RACK_ENV
19 app.rb
@@ -0,0 +1,19 @@
+require 'sinatra/base'
+require 'memcached'
+require 'rack/cache'
+
+class RackCacheDemoApp < Sinatra::Base
+
+ $cache = Memcached.new
+
+ use Rack::Cache,
+ :verbose => true,
+ :metastore => $cache,
+ :entitystore => $cache
+
+ get "/" do
+ cache_control :public, :max_age => 15
+ "Cached at #{Time.now.to_s}"
+ end
+end
+
23 config.ru
@@ -0,0 +1,23 @@
+require "rubygems"
+require "bundler"
+require 'sinatra/base'
+require 'memcached'
+require 'rack/cache'
+Bundler.setup
+
+class RackCacheDemoApp < Sinatra::Base
+
+ $cache = Memcached.new
+
+ use Rack::Cache,
+ :verbose => true,
+ :metastore => $cache,
+ :entitystore => $cache
+
+ get "/" do
+ cache_control :public, :max_age => 15
+ "Cached at #{Time.now.to_s}"
+ end
+end
+
+run RackCacheDemoApp
Please sign in to comment.
Something went wrong with that request. Please try again.