Skip to content

Commit

Permalink
Merge pull request seanmoon#2 from jpalermo/master
Browse files Browse the repository at this point in the history
Server start command to run on Cloud Foundry
  • Loading branch information
driedyam committed May 21, 2014
2 parents 74504f5 + 01db35d commit dea778b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/tasks/server.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace :server do
desc "Runs rails migrations on one instance and starts all instances"
task :start => :environment do
require "timeout"
require "json"

instance_number = JSON.parse(ENV["VCAP_APPLICATION"])["instance_index"]
if instance_number == 0
Rake::Task["db:migrate"].invoke
end

exec("bundle exec rails server -p $PORT")
end
end

0 comments on commit dea778b

Please sign in to comment.