forked from seanmoon/pivot-pong
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Server start command to run on Cloud Foundry
- Loading branch information
Phan Le
committed
May 20, 2014
1 parent
74504f5
commit 01db35d
Showing
1 changed file
with
14 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
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 |