Moonshine is Rails deployment and configuration management done right.
By leveraging capistrano and puppet, moonshine allows you have a working application server in 15 minutes, and be able to sanely manage it's configuration from the comfort of your version control of choice.
To get started, check out the “Setting up a server” section below.
Once you're a bit more comfortable with Moonshine, you'll find the official documentation on the wiki to be helpful!
About this fork
This fork makes Moonshine use Nginx as default server for your Rails app. Additionally, it tweaks some MySQL and Passenger settings to get more sensible defaults on a Rails 3 app. Please follow the instructions in the Installation section below for help on setting up your server. Please note that this fork is aimed at Ubuntu 10.10 Server Edition.
My fork is based on the work of titanous, he made the Nginx stuff possible.
Do not hesitate to improve my work. Any sensible pull request is much appreciated.
A server running Ubuntu 10.10 Server Edition
A Rails 3 app running on Ruby 1.8.7 Enterprise Edition
A user on this server that can execute commands via sudo
Setting up a server
Download and install the Ubuntu 10.10 Server Edition image on your server.
Install the SSH server
server:~$ sudo apt-get install ssh
Create a rails user. This is what Moonshine will use for it's operations. Make sure you use the adduser command and NOT the useradd command.
server:~$ sudo adduser rails
Set a password for the rails user
server:~$ sudo passwd rails
Give the rails user sudo permisions
server:~$ sudo visudo # add "rails ALL=(ALL) NOPASSWD:ALL" below the "root ALL=(ALL) ALL" line
Add the rails user to the sudo group
server:~$ sudo usermod -a -G sudo rails
Copy (via SCP) and install your local public key on the server
local:~$ scp ~/.ssh/id_rsa.pub rails@server:my_key.pub local:~$ ssh rails@server
And add your public key to the authorized_keys file on the server
server:~$ mkdir /home/rails/.ssh server:~$ cat my_key.pub > /home/rails/.ssh/authorized_keys
Make sure your server's rails user has access to your git repository (e.g. Github) via its public key.
Now add this Moonshine fork to your Rails 3 app as a plugin
local:~$ rails plugin install git://github.com/marceldegraaf/moonshine.git
And generate the configuration files and manifest
local:~$ rails generate moonshine
Edit the moonshine.yml file, especially the application, deploy_to and repository keys.
Next, capify your Rails app
local:~$ capify .
Edit the deploy.rb file to reflect your server's IP address or hostname.
Push your changes to your app's repo (the location where Moonshine will be pulling from)
Now you're ready to prepare your server for your app. This command takes a while, here are some kittens
local:~$ cap deploy:setup
When the server is set up, deploy your app
local:~$ cap deploy
After deploying for the first time, you should manually start the Nginx server
server:~$ sudo /etc/init.d/nginx start
For more info or help, see the official Moonshine tutorial.
It's easy enough:
$ gem install shadow_puppet isolate-scenarios $ rake spec
isolate-scenarios is used to test against multiple versions of Rails. To run all scenarios at once:
$ isolate-scenarios rake spec
For help or general discussion, visit the Moonshine newsgroup.