# Idea for an automatic rails deployment system

**URL:** <https://www.ruby-forum.com/t/idea-for-an-automatic-rails-deployment-system/83296>\
**Category:** Deployment\
**Created:** [January 24, 2007, 11:02pm UTC](https://www.ruby-forum.com/t/idea-for-an-automatic-rails-deployment-system/83296 "2007-01-24T23:02:52Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![scottbrisko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scottbrisko](https://www.ruby-forum.com/u/scottbrisko)\
**Post date:** [January 24, 2007, 11:02pm UTC](https://www.ruby-forum.com/t/idea-for-an-automatic-rails-deployment-system/83296/1 "2007-01-24T23:02:52Z")

</div>

When ever you deploy a new rails app with an Apache/Mongrel\_Cluster  
setup, you have to setup a bunch of configuration files, symlink those  
to the right places so apache and mongrel cluster pick them up, restart  
those, figure out why it didn’t work the first time, and on and on.

What you can’t do is just drop some files into a directory and expect  
your site to start working… Maybe Litespeed lets you do this, who  
knows… 🙂

* * *

Here’s an idea for an automatic rails deployment system, lets  
hypothetically call it dog\_walker (get it? mongrel?! har har…):

It would consist daemon process that monitors a rails “apps” directory.

If a new sub-directory comes into existance and has the appropriate  
config file, say app\_name/config/dog\_walker.yml, it picks it up,  
assigns it one or more ports to run mongrels, and starts them up. It  
also modifies and reloads Apache (or lighttpd/nginx, whatever the  
front-end proxy is) with a new virtual host, and bam, your site is up!

Each site’s dog\_walker.yml could look something like:

* * *

environment: production  
nbr\_mongrels: 3  
server\_name: [www.mysweetrailsapp.com](http://www.mysweetrailsapp.com)

dog\_walker itself would probably also need one main config file,  
something like:

* * *

apps\_dir: /home/username/rails\_apps  
proxy\_server: apache  
apache\_conf\_dir: /etc/httpd/conf.d  
port\_range\_start: 3500  
port\_range\_end: 4000

dog\_walker could manage for you which ports get assigned to which apps  
and all that junk, and create the appropriate .conf files for apache,  
and then restart/reload it so it starts serving your app.

just an idea at the moment…

–  
Scott B.  
Electro Interactive, Inc.  
Office: 813-333-5508  
Web - [http://www.ElectroInteractive.com](http://www.ElectroInteractive.com)  
Blog - [http://synthesis.sbecker.net](http://synthesis.sbecker.net)

---

<div class="post-metadata">

**Author:** ![scottbrisko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scottbrisko](https://www.ruby-forum.com/u/scottbrisko)\
**Post date:** [January 25, 2007, 12:32am UTC](https://www.ruby-forum.com/t/idea-for-an-automatic-rails-deployment-system/83296/2 "2007-01-25T00:32:06Z")

</div>

> When ever you deploy a new rails app with an Apache/Mongrel\_Cluster  
> setup, you have to setup a bunch of configuration files, symlink those  
> to the right places so apache and mongrel cluster pick them up, restart  
> those, figure out why it didn’t work the first time, and on and on.
> 
> What you can’t do is just drop some files into a directory and expect  
> your site to start working… Maybe Litespeed lets you do this, who  
> knows… 🙂

Sort of… using their virtual templates you can come pretty close.  
Upload your app and tell lightspeed to associate it (file system path,  
domain name) with the rails virtual template. graceful restart.

---

<div class="post-metadata">

**Author:** ![scottbrisko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scottbrisko](https://www.ruby-forum.com/u/scottbrisko)\
**Post date:** [January 24, 2007, 11:58pm UTC](https://www.ruby-forum.com/t/idea-for-an-automatic-rails-deployment-system/83296/3 "2007-01-24T23:58:00Z")

</div>

Scott B. wrote:

> * * *
> 
> just an idea at the moment…  
> I have some thoughts on this. I think there should be an API to talk to  
> the hosting environment. So say you have a account that you want to  
> deploy a rails app to that has no setup done for it other than  
> username/password/homedirectory. I think it should be possible to  
> create a system so that all you need to do is configure the address of  
> where you connect to your hosting provider, and the username/password.  
> The API takes care of asking the hosting environment to setup things  
> like DNS, virtual hosts, ports, IP addresses, email accounts, etc. On  
> the hosting environment side they can have various different setups but  
> the person deploying the app doesn’t need to know the specifics of those  
> for most simple setups, and may not care so long as it works.

I’ve experimented in the last week with building pound config files from  
templates with simple search/replace, and doing this for other types of  
config files should be similarly easy though I would prefer a more  
dynamic setup. With apache it should be possible to update a live  
system with libapache rather than writing out a config file, and  
reloading. I know there is a patch to bind to make it dynamically load  
new zones, and it should be possible to patch any open source server to  
give it similar functionality if someone hasn’t already.

With an API like this it would be possible to not just easily deploy  
apps to many different providers with ease, but have the user interface  
for things like adding domains, subdomains, and email addresses be part  
of the app you deploy rather than some disconnected system. This way  
you can have a consistent user interface no matter who you choose for  
your hosting provider.

–  
Daniel J.  
Systems Administrator

PLANET ARGON, LLC  
Ruby on Rails Development, Consulting & Hosting

> **[Planet Argon](https://www.planetargon.com)**
>
> Planet Argon is a Ruby on Rails development agency specializing in maintenance and support for existing Rails apps. Based in Portland, OR, Planet Argon has been a member of the Rails community since 2004.

[daniel.planetargon.us](http://daniel.planetargon.us)  
+1 503 445 2457  
+1 877 55 ARGON [toll free]  
+1 815 642 4968 [fax]

---

<div class="post-metadata">

**Author:** ![scottbrisko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scottbrisko](https://www.ruby-forum.com/u/scottbrisko)\
**Post date:** [January 25, 2007, 12:55am UTC](https://www.ruby-forum.com/t/idea-for-an-automatic-rails-deployment-system/83296/4 "2007-01-25T00:55:08Z")

</div>

On Jan 24, 5:01 pm, “Scott B.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> When ever you deploy a new rails app with an Apache/Mongrel\_Cluster  
> setup, you have to setup a bunch of configuration files, symlink those  
> to the right places so apache and mongrel cluster pick them up, restart  
> those, figure out why it didn’t work the first time, and on and on.

The railsmachine gem[1] provides a good base for configuring a new  
rails site for deployment. I employ everyone to take a look at the  
gem. Maybe you could bake something up that would work better for your  
site using the gem as a base.

[1] [https://support.railsmachine.com/index.php?pg=kb.page&id=43](https://support.railsmachine.com/index.php?pg=kb.page&id=43)

---

<div class="post-metadata">

**Author:** ![scottbrisko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scottbrisko](https://www.ruby-forum.com/u/scottbrisko)\
**Post date:** [January 25, 2007, 1:05am UTC](https://www.ruby-forum.com/t/idea-for-an-automatic-rails-deployment-system/83296/5 "2007-01-25T01:05:10Z")

</div>

On Jan 24, 6:53 pm, “bryanl” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> [1][https://support.railsmachine.com/index.php?pg=kb.page&id=43](https://support.railsmachine.com/index.php?pg=kb.page&id=43)  
> I actually do use a derivative of that railsmachine stuff. It’s based  
> on the slingshot rails apache2.2/mongrel cluster deployment script,  
> which you can get here:

[http://www.slingshothosting.com/files/apache2\_2\_mongrel\_deploy.rb](http://www.slingshothosting.com/files/apache2_2_mongrel_deploy.rb)

That’ll go and create the apache conf files, the mongrel cluster files,  
etc, when you run “cap remote:deploy”. Which is kinda cool, but I still  
like the idea of a daemon process watching a rails apps folder and  
handling all that for you so you don’t even need to think about it. You  
wouldn’t have to care what ports mongrel are running on, etc.

- Scott

---

<div class="post-metadata">

**Author:** ![scottbrisko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scottbrisko](https://www.ruby-forum.com/u/scottbrisko)\
**Post date:** [January 25, 2007, 10:36pm UTC](https://www.ruby-forum.com/t/idea-for-an-automatic-rails-deployment-system/83296/6 "2007-01-25T22:36:20Z")

</div>

Well I can’t quite offer you that, but I’ve got a tenant depoyment down  
to

cap -s user=tenant1 make\_tenant

That creates a separate user context and user database, handles all the  
security nonsense  
and makes the application available, as if by magic, on  
'[http://tenant1.yourdomain/](http://tenant1.yourdomain/)

It also automatically handles SSL. If you have the apache module loaded  
it forces HTTPS and if you don’t it uses HTTP. The form of SSL used  
means that you only need a certificate for ‘yourdomain’ not a wildcard  
one.

No releases at the moment, but you are welcome to look at the GPL’ed  
Capistrano code at

[http://rubyforge.org/projects/multi-tenant](http://rubyforge.org/projects/multi-tenant)

Any feedback or encouragement appreciated. Questions on the associated  
forum if you like, or here if you prefer.

NeilW

---

<div class="post-metadata">

**Author:** ![scottbrisko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scottbrisko](https://www.ruby-forum.com/u/scottbrisko)\
**Post date:** [January 25, 2007, 1:34pm UTC](https://www.ruby-forum.com/t/idea-for-an-automatic-rails-deployment-system/83296/7 "2007-01-25T13:34:43Z")

</div>

On 1/24/07, Daniel J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I have some thoughts on this. I think there should be an API to talk to  
> the hosting environment.

Our control panel that Ezra is writing (temporarily stalled so he can  
complete his book!) is fully accessible via ActiveResource. All tasks  
will eventually have a programmatic interface, including user  
managment, email setup, DNS configuration, environment setup, and even  
deployment of specific application packages (Subversion URL +  
revision, gems and versions, etc) into those environments.

We believe this will be a big hit, once it’s available(!), with  
application developers who resell our hosting service.

---

<div class="post-metadata">

**Author:** ![scottbrisko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scottbrisko](https://www.ruby-forum.com/u/scottbrisko)\
**Post date:** [January 26, 2007, 7:06pm UTC](https://www.ruby-forum.com/t/idea-for-an-automatic-rails-deployment-system/83296/8 "2007-01-26T19:06:21Z")

</div>

Since he said there were no releases, I checked the subversion  
repository and noticed they were there.

Regards,

Sean

---

<div class="post-metadata">

**Author:** ![scottbrisko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scottbrisko](https://www.ruby-forum.com/u/scottbrisko)\
**Post date:** [January 26, 2007, 6:39pm UTC](https://www.ruby-forum.com/t/idea-for-an-automatic-rails-deployment-system/83296/9 "2007-01-26T18:39:17Z")

</div>

Hey Neil, I don’t see any files at  
[http://rubyforge.org/projects/multi-tenant](http://rubyforge.org/projects/multi-tenant) ?

- Scott
