Helps you to deploy your Rails app as an RPM in seconds. This Gem helps you generate an RPM.spec file, helps you build the RPM, and to automate the deployment via RPM
MIT License
Good News! If you are not serving your Rails App on Linux, then you don't need this Gem! :-)
deploy_rails_as_rpm
is a Ruby Gem which helps you generate an RPM spec file for your Rails application, which you can use to build an RPM of your Rails app, which you can then deploy quickly to your production servers via your Linux server's native RPM installation mechanism, e.g. yum, apt-get, or rpm.
In our set-up we use CentOS 6.3, NginX 1.2.3, Unicorn 4.4.0, Rails 3.2.x and Ruby 1.9.3, and besides creating an RPM for your Rails App, we also include an easy way to roll your own RPM for the Ruby version you need in production.
Advantages of deploying a Rails app via RPM include:
bundle install
all your Gems and possibly compile native extensions all over againIf you are not convinced yet, you can read more about the motivation here (TBD).
The only down-side I can think of is that you will need one additional (small) build server, which runs the identical OS as your production servers. On the build server you'll build your RPM(s), which includes running bundle install
and compiling native extension, and also rolling your own Ruby 1.9.x RPM. This is the only server which has development tools on it, and it can be in-house behind your corporate firewall. You will only need to spin-up this build server in preparation of a release / deployment.
You should also have a (small) staging server which is an identical twin to your production servers, and which only needs to be spun-up for testing your final RPM deployment.
... to be continued shortly ...
Creating your customized RPM spec is ridiculously easy:
rake rpm:spec:create
you then have several options on how you want to deploy your RPM on your servers
After you set-up your build server as described under the (tbd)[prerequisites], you can create a new RPM for your Rails App, by running:
rpmbuild -bb <RPM.spec>
This will generate the RPM for your Linux distribution under ./rpmbuild/RPMS/
If you should get any complains about libraries missing, you will need to add these to the ./config/rpm/dependencies.yaml
file,
re-generate the RPM-spec file and re-run the rpmbuild command, as described in the (tbd)[build procedures].
If in the future Bundler or RubyGems can provide a mechanism to query the system library dependencies for each Gem or bundle, we can eliminate this itterative process.
You have several choices on how to distribute your Rails App RPM file to your production servers, e.g. you could rsync or scp them, or fun your own yum repository.
Once the RPM is made available to your production server(s), simply run the native package update mechanism (apt-get, yum) to install it, or do a rpm -Uhv rpm-file-name
.
Add this line to your application's Gemfile:
gem 'deploy_rails_as_rpm'
And then execute:
$ bundle
Or install it yourself as:
$ gem install deploy_rails_as_rpm
TODO: Write usage instructions here
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)