Skip to content

Instantly share code, notes, and snippets.

@patmaddox
Last active August 29, 2015 14:11
Show Gist options
  • Save patmaddox/771a363ce87683f4fa79 to your computer and use it in GitHub Desktop.
Save patmaddox/771a363ce87683f4fa79 to your computer and use it in GitHub Desktop.
cloud_foundry config
namespace :cf do
desc "Only run on the first application instance"
task :on_first_instance do
instance_index = JSON.parse(ENV["VCAP_APPLICATION"])["instance_index"] rescue nil
exit(0) unless instance_index == 0
end
end
---
applications:
- name: mob_lobby-staging
memory: 192M
instances: 2
path: .
command: bundle exec rake cf:on_first_instance db:migrate && rails s -p $PORT
services:
- mob_lobby-postgres-staging
env:
RAILS_ENV: staging
RACK_ENV: development
- name: mob_lobby-production
memory: 256MB
instances: 4
path: .
command: bundle exec rake cf:on_first_instance db:migrate && rails s -p $PORT
services:
- mob_lobby-postgres-production
env:
RAILS_ENV: production
RACK_ENV: production
web: bundle exec puma -e $RAILS_ENV -p 1234 -S ~/puma -C config/puma.rb
2014-12-13T18:26:24.95-0800 [App/1] ERR [2014-12-14 02:26:24] ERROR NoMethodError: undefined method `split' for nil:NilClass
2014-12-13T18:26:24.95-0800 [App/1] ERR /home/vcap/app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:69:in `block in service'
2014-12-13T18:26:24.95-0800 [App/1] ERR /home/vcap/app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/utils.rb:451:in `block in each'
2014-12-13T18:26:24.95-0800 [App/1] ERR /home/vcap/app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/utils.rb:450:in `each'
2014-12-13T18:26:24.95-0800 [App/1] ERR /home/vcap/app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/utils.rb:450:in `each'
2014-12-13T18:26:24.95-0800 [App/1] ERR /home/vcap/app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:63:in `service'
2014-12-13T18:26:24.95-0800 [App/1] ERR /home/vcap/app/vendor/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
2014-12-13T18:26:24.95-0800 [App/1] ERR /home/vcap/app/vendor/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
2014-12-13T18:26:24.95-0800 [App/1] ERR /home/vcap/app/vendor/ruby-2.1.2/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment