https://github.com/nicolai86/ansible-rails-deployment
I’ve setup 20 or so Rails deployments with Capistrano. The current project that I’m working on uses upstart to manage the Rails sever/worker processes. As I’m having to push capistrano to handle more and more system level operations, I think putting it all in Ansible with my other server system configs would be a better separation of concerns. I’m the primary developer and don’t need to worry about giving non-system capable devs sudo access to servers.
Has anyone else run into this? Any pros/cons that run into after moving deployments to executed by Ansible?
Lots of people are using Ansible to replace Fabric or Capistrano and only get down to one tool - and those aren’t neccessarily Python or Ruby apps respect
(Ansible can also run things as non-root, so if you need to, that’s all cool)
I’ll let some folks using Rails chime in with details, though in general I think people get into the most trouble when they are trying to compile ruby via Ansible – it’s better to use a package manager to install something whenever you can and save all that build time – but you’d have that with Cap too.
The main thing is Ansible is order-based and makes it easy to say “if x is done here, do that”, which is something that is really hard to do in CM apps.
I've setup 20 or so Rails deployments with Capistrano. The current
project that I'm working on uses upstart to manage the Rails
sever/worker processes. As I'm having to push capistrano to handle
more and more system level operations, I think putting it all in
Ansible with my other server system configs would be a better
separation of concerns. I'm the primary developer and don't need to
worry about giving non-system capable devs sudo access to servers.
Has anyone else run into this? Any pros/cons that run into after
moving deployments to executed by Ansible?
I'm a huge fan of managing rails deploys via Ansible. I found myself,
like you, struggling to stretch Cap to fit my needs, whereas ansible
makes all of this pretty simple. I'm working on open sourcing more of my
deployment infrastructure, but here is one example, deploying Discourse
outside their supported Docker install:
It's a fairly complex app with Sidekiq workers, and stuff, but Ansible
makes it pretty much painless to manage deploying. In general, I've
found it easiest to either ship my own Ruby RPMs and ignore things like
RVM/rbenv. This role is used to deploy to a Fedora 20 box with Ruby
2.0.0 on it, which is Good Enough that I don't have to worry about
it. There is a fork of that repo or something that ports the Sidekiq
workers to systemd jobs, and other system-level integration bits, too.