# SwitchTower: Two development environments

**URL:** <https://www.ruby-forum.com/t/switchtower-two-development-environments/75351>\
**Category:** Rails\
**Created:** [March 1, 2006, 7:10pm UTC](https://www.ruby-forum.com/t/switchtower-two-development-environments/75351 "2006-03-01T19:10:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lopmx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/258eb7/32.png) [@lopmx](https://www.ruby-forum.com/u/lopmx)\
**Post date:** [March 1, 2006, 7:10pm UTC](https://www.ruby-forum.com/t/switchtower-two-development-environments/75351/1 "2006-03-01T19:10:28Z")

</div>

Hi

```
I have a problem here. I am developing an application which has a local

```

development environment (on my harddisk), a second one for my customer  
(for testing new features) and a production environment which runs  
actual application online.

```
How can I setup SwitchTower to have a possibility to deploy just for a

```

particular server?

Thanks,  
Peter

---

<div class="post-metadata">

**Author:** ![lopmx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/258eb7/32.png) [@lopmx](https://www.ruby-forum.com/u/lopmx)\
**Post date:** [March 1, 2006, 7:43pm UTC](https://www.ruby-forum.com/t/switchtower-two-development-environments/75351/2 "2006-03-01T19:43:47Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

On Mar 1, 2006, at 10:07 AM, Piotr U. wrote:

> I have a problem here. I am developing an application which has a  
> local development environment (on my harddisk), a second one for my  
> customer (for testing new features) and a production environment  
> which runs actual application online.
> 
> How can I setup SwitchTower to have a possibility to deploy just  
> for a particular server?

You may use separate deployment recipes for each. However, the rake  
tasks assume a default config/deploy recipe so you must use the  
switchtower command directly or alter deploy.rb.

$ mkdir config/deploy; cd config/deploy  
$ ln -s …/deploy.rb production.rb  
$ cp production.rb staging.rb  
$ vi staging.rb  
$ switchtower -r config/deploy/staging -a deploy

Or you may edit your deploy.rb to be  
require “#{File.dirname( **FILE** )}/deploy/#{ENV[‘RECIPE’] ||  
‘production’}”  
and invoke rake as  
rake remote:deploy [RECIPE=production]  
rake remote:deploy RECIPE=staging

Best,  
jeremy  
-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.2 (Darwin)

iD8DBQFEBetLAQHALep9HFYRAuetAJ48uOkb/i2Tl13x85FbhHemeHAReQCgoJbZ  
ZbkWezUDJYOZCsPs+NciVjQ=  
=ekiI  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![lopmx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/258eb7/32.png) [@lopmx](https://www.ruby-forum.com/u/lopmx)\
**Post date:** [March 1, 2006, 8:56pm UTC](https://www.ruby-forum.com/t/switchtower-two-development-environments/75351/3 "2006-03-01T20:56:58Z")

</div>

On Mar 1, 2006, at 11:07 AM, Piotr U. wrote:

> Hi
> 
> I have a problem here. I am developing an application which has a  
> local development environment (on my harddisk), a second one for my  
> customer (for testing new features) and a production environment  
> which runs actual application online.
> 
> How can I setup SwitchTower to have a possibility to deploy just  
> for a particular server?

In addition to Jeremy’s suggestion, you might want to look at:

[http://jamis.jamisbuck.org/articles/2006/01/03/using-switchtower-](http://jamis.jamisbuck.org/articles/2006/01/03/using-switchtower-)  
with-multiple-deployment-stages

Hope that helps,

- Jamis

---

<div class="post-metadata">

**Author:** ![lopmx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/258eb7/32.png) [@lopmx](https://www.ruby-forum.com/u/lopmx)\
**Post date:** [March 1, 2006, 8:20pm UTC](https://www.ruby-forum.com/t/switchtower-two-development-environments/75351/4 "2006-03-01T20:20:54Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

On Mar 1, 2006, at 10:43 AM, Jeremy K. wrote:

> Or you may edit your deploy.rb to be  
> require “#{File.dirname( **FILE** )}/deploy/#{ENV[‘RECIPE’] ||  
> ‘production’}”

Sorry, this should be  
load\_paths \<\< “#{File.dirname( **FILE** )}/deploy”  
load(ENV[‘RECIPE’] || ‘production’)  
since the contents of deploy.rb are evaluated in the context of a  
switchtower configuration object.

> and invoke rake as  
> rake remote:deploy [RECIPE=production]  
> rake remote:deploy RECIPE=staging

Best,  
jeremy  
-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.2 (Darwin)

iD8DBQFEBfPKAQHALep9HFYRAqSaAJ4lv4I8PDgOHhwV0B4ZpIxyNl1CbQCgmXP0  
FFV68BDtltnuG5U/z64uVVo=  
=5rpZ  
-----END PGP SIGNATURE-----
