Monday, April 27, 2009

Moonshine

Moonshine is Rails deployment and configuration management done right.

Deploying Your Rails Application with Moonshine in 15 minutes

Requirements

  • A server running Ubuntu 8.10 (Want to see your favorite platform supported? Fork Moonshine on GitHub!)
  • A user on this server that can:
    • Execute commands via sudo
    • Access your application’s Git repository

Instructions

  • ruby script/plugin install git://github.com/railsmachine/moonshine.git
  • Ensure all required gems are declared using config.gem calls in config/environment.rb.
  • ruby script/generate moonshine
  • Edit the configuration file at config/moonshine.yml with your apps’s details. (If you’re using a user other than rails, specify this here)
  • Edit the Moonshine::Manifest::Rails manifest generated for your application at app/manifests/application_manifest.rb to declare other packages, services, or files your application depends on (memcached, sphinx, etc).
  • capify your application
    • Your config/deploy.rb can be super barebones, as Moonshine loads the contents of config/moonshine.yml in as Cap variables and sets some sane defaults. Here’s what I use:
       server "myubuntuserver.com", :app, :web, :db, :primary => true
  • git add . && git commit -am "added moonshine" && git push
  • cap deploy:setup
    • This will bootstrap your Ubuntu server with Ruby Enterprise Edition.
  • cap deploy
    • This will install all needed dependencies for your application and deploy it for the first time. The initial deploy will take awhile, as things such as MySQL, etc, are being installed. It’s worth the wait though, because what you end up with is an extremely maintainable server that you’ll never need to SSH into again!
http://railsnotes.com/161-rails-server-setup
http://github.com/railsmachine/moonshine/tree/master

No comments: