Abandoned, moved over to chef
Ruby Shell
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
lib
test
.gitignore
LICENSE
Rakefile
Readme.rdoc
TODO
VERSION
VERSION.yml
init.rb
moonshadow.gemspec

Readme.rdoc

Moonshadow

Moonshadow is Rails deployment and configuration management done right.

Deploying Your Rails Application with Moonshadow in 15 minutes

Requirements

  • A server running Ubuntu > 8.04 (Want to see your favorite platform supported? Fork Moonshadow on GitHub!)

  • A user on this server that can:

    • Execute commands via sudo

    • Access your application's Git repository

Instructions

  • sudo gem install moonshadow

  • Ensure all required gems are declared using config.gem calls in config/environment.rb.

  • In the root of your Rails app, run moonshadow .

  • Edit the configuration file at config/moonshadow.yml with your apps's details. (If you're using a user other than rails, specify this here)

  • Edit the Moonshadow::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).

  • Your config/deploy.rb can be super barebones, as Moonshadow loads the contents of config/moonshadow.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 moonshadow" && git push

  • cap deploy:setup

    • This will bootstrap your Ubuntu server with Ruby Enterprise Edition, and install the moonshadow gem on the server.

  • 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!

Moonshadow and Capistrano

Moonshadow tightly integrates with Capistrano, utilizing its callback system to apply your manifests to the server on each deploy. In addition, variables are set in Capistrano for all keys on the config/moonshadow.yml hash, allowing your Capistrano configuration to be extremly barebones.

By default, Capistrano applies the manifest at app/manifests/application_manifest.rb. To run a different manifest, for example one to install and maintain packages on a server of a different role:

set :moonshadow_manifest, 'memcached_manifest'

If you'd like to prevent Capistrano from applying your Moonshadow manifests for any reason:

set :moonshadow_apply, false

Local Config

Often, certain files (config/database.yml, etc) are excluded from an application's SCM, but required to be present for deploy. We've abstracted this pattern with some Capistrano automation that goes great with Moonshadow.

For example, if you keep config/database.yml out of your SCM, add the following line to your config/deploy.rb:

set :local_config, %w(config/database.yml)

This file will then be automatically uploaded and symlinked to current/config/database.yml on each deploy.

Getting Help

You can find more examples in the documentation and on the Wiki.

For help or general discussion, visit the Moonshadow newsgroup.