Created
January 24, 2013 20:58
-
-
Save lhitchon/4627669 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
gem 'rails', '3.2.9' | |
# Bundle edge Rails instead: | |
# gem 'rails', :git => 'git://github.com/rails/rails.git' | |
gem 'sqlite3' | |
# Gems used only for assets and not required | |
# in production environments by default. | |
group :assets do | |
gem 'sass-rails', '~> 3.2.3' | |
gem 'coffee-rails', '~> 3.2.1' | |
# See https://github.com/sstephenson/execjs#readme for more supported runtimes | |
# gem 'therubyracer', :platforms => :ruby | |
gem 'uglifier', '>= 1.0.3' | |
end | |
gem 'jquery-rails' | |
# To use ActiveModel has_secure_password | |
# gem 'bcrypt-ruby', '~> 3.0.0' | |
# To use Jbuilder templates for JSON | |
# gem 'jbuilder' | |
# Use unicorn as the app server | |
# gem 'unicorn' | |
# Deploy with Capistrano | |
# gem 'capistrano' | |
# To use debugger | |
# gem 'debugger' | |
gem 'rake' | |
gem 'redis' | |
gem 'cf-runtime' | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
applications: | |
.: | |
name: rails-worker | |
framework: | |
name: standalone | |
info: | |
mem: 64M | |
description: Standalone Application | |
exec: | |
runtime: ruby193 | |
command: PATH="/opt/cloudfoundry/runtimes/ruby-1.9.3-p125/bin:$PATH" bundle exec rake worker:run | |
infra: aws | |
url: | |
mem: 128M | |
instances: 1 | |
services: | |
standalone: | |
type: redis |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env rake | |
# Add your own tasks in files placed in lib/tasks ending in .rake, | |
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. | |
require File.expand_path('../config/application', __FILE__) | |
RailsWorker::Application.load_tasks | |
namespace :worker do | |
task :run => :environment do | |
loop do | |
puts "#{Time.now} #{RUBY_VERSION}" | |
puts "keys in redis:" | |
puts $redis.keys.sort.join(', ') | |
sleep 5 | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/initializers/redis.rb | |
require 'redis' | |
require 'cfruntime/redis' | |
def redisConnection | |
redis_names = CFRuntime::CloudApp.service_names_of_type('redis') | |
redis_options = {} | |
unless redis_names.empty? | |
redis_options = CFRuntime::RedisClient.options_for_svc(redis_names.first) | |
end | |
puts "Redis connection options:" | |
puts redis_options | |
Redis.new(redis_options) | |
end | |
$redis = redisConnection | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment