Skip to content

Commit

Permalink
Server start command to run on Cloud Foundry
Browse files Browse the repository at this point in the history
  • Loading branch information
Phan Le committed May 20, 2014
1 parent 74504f5 commit 01db35d
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 01db35d

Please sign in to comment.