Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Foreman - Essential Rails Gems

Foreman - Essential Rails Gems

Continuation of @jwo's essential Rails gems series, Foreman is a command line tool for Processes and Environment Variables.

Presented at Houston Ruby Brigage


Jesse Wolgamott

January 15, 2013

More Decks by Jesse Wolgamott

Other Decks in Programming


  1. FOREMAN Rails Essential Gems: by @jwo for @houstonrb Wednesday, February

    6, 13
  2. Not this Foreman http://nicksayswhat.files.wordpress.com/2010/05/george-foreman.jpg Wednesday, February 6, 13

  3. More like this http://www.wpclipart.com/clothes/hats/Hard_Hat.png.html Wednesday, February 6, 13

  4. Command Line Tool Command Line Tool for Procfile Apps Environment

    Variable manager Wait, what is a Procfile? Wednesday, February 6, 13
  5. Procfile. a way to: start multiple processes at once tell

    Heroku what processes to start make things easy on new developers web: bundle exec puma -p $PORT worker: bundle exec sidekiq Wednesday, February 6, 13
  6. Onboarding Devs OK, so you want to start SOLR, and

    Memcached, and then rake jobs:work. Then run rails s New Way: foreman start Wednesday, February 6, 13
  7. Complicated Procfile web: bundle exec unicorn_rails -p $PORT solr: bundle

    exec rake sunspot:solr:run worker: bundle exec rake environment resque:work QUEUE=* memcached: service start memcached redis: sevice start redis foreman start Wednesday, February 6, 13
  8. How to Install #Gemfile group :development do gem 'foreman' end

    Wednesday, February 6, 13
  9. But Wait. There’s more! Environment Variables Rule Keeps sensitive information

    out of code Gives developer their own S3 bucket and stuff Works extraordinarily well with Heroku Helps follow http://www.12factor.net/ Wednesday, February 6, 13

    S3_ACCESS_KEY_ID= S3_SECRET_ACCESS_KEY= RACK_ENV= commit your .env.sample file .gitignore your .env file Wednesday, February 6, 13
  11. in Ruby / Rails Fog.configure do |config| config.directory_name = ENV['S3_BUCKET_NAME']

    end # or Super Fancy Pants: Fog.configure do |config| config.directory_name = ENV.fetch('S3_BUCKET_NAME') { raise ArgumentError.new “Missing S3 BUCKET NAME” } end Wednesday, February 6, 13
  12. Rails Console `rails c` won't automagically set your ENV `foreman

    run rails c` WILL OR... Use the `heroku-dev-env` gem to load .env automatically Wednesday, February 6, 13