# Deploying radiant 0.9.1 with capistrano

**URL:** <https://www.ruby-forum.com/t/deploying-radiant-0-9-1-with-capistrano/226139>\
**Category:** Radiant CMS\
**Created:** [December 14, 2010, 8:11pm UTC](https://www.ruby-forum.com/t/deploying-radiant-0-9-1-with-capistrano/226139 "2010-12-14T20:11:18Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![craayzie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e47774/32.png) [@craayzie](https://www.ruby-forum.com/u/craayzie)\
**Post date:** [December 14, 2010, 8:11pm UTC](https://www.ruby-forum.com/t/deploying-radiant-0-9-1-with-capistrano/226139/1 "2010-12-14T20:11:18Z")

</div>

I’ve done some searching on a guide for how to use capistrano + git +  
bundler to deploy radiant 0.9.1 but haven’t had much success in  
finding something comprehensive. Is deploying radiant the same as  
deploying a Rails app?

I do my development on a MacBook and have a staging and production  
server that I want to deploy to. Can anyone share some guidance around  
how to set up a deployment workflow?

Should I use bundler or go without it?  
Should I use the capistrano extension? @

> **[GitHub - ehaselwanter/radiant-capistrano-extension: capistrano tasks for...](https://github.com/ehaselwanter/radiant-capistrano-extension)**
>
> capistrano tasks for radiant deployments. Contribute to ehaselwanter/radiant-capistrano-extension development by creating an account on GitHub.

Thanks as always for the help.

Fima

---

<div class="post-metadata">

**Author:** ![craayzie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e47774/32.png) [@craayzie](https://www.ruby-forum.com/u/craayzie)\
**Post date:** [December 14, 2010, 8:19pm UTC](https://www.ruby-forum.com/t/deploying-radiant-0-9-1-with-capistrano/226139/2 "2010-12-14T20:19:28Z")

</div>

The capistrano extension provides a nice set of cap recipes to use when  
deploying radiant. Here’s what my personal capfile (actually deploy.rb)  
looks like:

set :application, “demo”  
set :deploy\_to, “/var/www/#{application}”  
set :user, “USERNAME”  
set :scm\_user, “SCM\_USERNAME”  
server “SERVER\_ADDRESS”, :app, :web, :db, :primary =\> true  
set :scm\_password, Proc.new { Capistrano::CLI.password\_prompt("SVN  
password for #{scm\_user}, please: ") }  
set :repository, Proc.new { “–username #{scm\_user} --password  
#{scm\_password} --no-auth-cache svn+ssh://#{scm\_user}@SVN\_REPO\_ADDRESS”  
}

ssh\_options[:user] = “USERNAME”

# will change based on your ssh key file

ssh\_options[:keys] = [“#{ENV[‘HOME’]}/.ssh/cap-ec2”] #cap-ec2-key.pem  
default\_run\_options[:pty] = true

namespace :deploy do  
task :start, :roles =\> :app do  
run “touch #{current\_release}/tmp/restart.txt”  
end

task :stop, :roles =\> :app do

# nada

end

desc “Restart Application”  
task :restart, :roles =\> :app do  
run “touch #{current\_release}/tmp/restart.txt”  
end  
end

Bradley H. | iGoDigital® Personalized Product Recommendation  
Software | Cell 317.331.9718 l Office 888.496.2446x716  
[www.igodigital.com](http://www.igodigital.com)

---

<div class="post-metadata">

**Author:** ![craayzie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e47774/32.png) [@craayzie](https://www.ruby-forum.com/u/craayzie)\
**Post date:** [December 14, 2010, 8:44pm UTC](https://www.ruby-forum.com/t/deploying-radiant-0-9-1-with-capistrano/226139/3 "2010-12-14T20:44:02Z")

</div>

On Dec 14, 2010, at 2:10 PM, craayzie wrote:

> I’ve done some searching on a guide for how to use capistrano + git +  
> bundler to deploy radiant 0.9.1 but haven’t had much success in  
> finding something comprehensive. Is deploying radiant the same as  
> deploying a Rails app?

Our cap recipes don’t differ that much from a standard Rails app. Most  
of the additions are rake tasks, and we do overwrite deploy:migrate, so  
that existing Rails-based cap tasks and hooks will still fire in the  
right sequence.

If you’re deploying to different environments or servers, I’d recommend  
using the capistrano-ext gem. It lets you do this:

```
$ cap staging deploy
$ cap production deploy

```

You can tailor your recipes and cap variables based on the environment.  
Here’s the relevant parts of our Radiant recipe:

Capistrano::Configuration.instance.load do  
namespace :radiant do  
desc “Updates extension assets”  
task :update\_assets do  
run “cd #{current\_path} && rake  
radiant:extensions:update\_all RAILS\_ENV=#{stage}”  
end  
after ‘deploy:symlink’, ‘radiant:update\_assets’

```
    desc "Migrates Radiant extensions"
    task :migrate_extensions do
        run "cd #{release_path} && rake db:migrate:extensions 

```

RAILS\_ENV=#{stage}"  
end  
after ‘deploy:migrate’, ‘radiant:migrate\_extensions’  
end

```
namespace :deploy do
    task :migrate, :roles => :db, :only => { :primary => true } do
        rake = fetch(:rake, "rake")
        rails_env = fetch(:rails_env, "production")
        migrate_env = fetch(:migrate_env, "")
        run "cd #{release_path}; #{rake} RAILS_ENV=#{rails_env} 

```

#{migrate\_env} db:migrate"  
end  
end  
end

---

<div class="post-metadata">

**Author:** ![craayzie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e47774/32.png) [@craayzie](https://www.ruby-forum.com/u/craayzie)\
**Post date:** [December 14, 2010, 9:02pm UTC](https://www.ruby-forum.com/t/deploying-radiant-0-9-1-with-capistrano/226139/4 "2010-12-14T21:02:51Z")

</div>

You guys are awesome will give this a shot. Where does bundler fit into  
all of this?

---

<div class="post-metadata">

**Author:** ![craayzie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e47774/32.png) [@craayzie](https://www.ruby-forum.com/u/craayzie)\
**Post date:** [December 14, 2010, 9:17pm UTC](https://www.ruby-forum.com/t/deploying-radiant-0-9-1-with-capistrano/226139/5 "2010-12-14T21:17:55Z")

</div>

hm … if you’re not using bundler then maybe i shouldnt either? maybe  
it’s  
overkill for a noob like me who’s just starting out w/ ruby / radiant.  
how  
do you handle the case where you want to play around w/ a gem in your  
dev.  
environment but not deploy it to production?

---

<div class="post-metadata">

**Author:** ![craayzie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e47774/32.png) [@craayzie](https://www.ruby-forum.com/u/craayzie)\
**Post date:** [December 14, 2010, 9:04pm UTC](https://www.ruby-forum.com/t/deploying-radiant-0-9-1-with-capistrano/226139/6 "2010-12-14T21:04:44Z")

</div>

I’m not entirely sure, but I would imagine you would just create a task  
for installing the bundle in your cap file. LIke deploy:bundle:install  
or something along those lines.

Bradley H. | iGoDigital® Personalized Product Recommendation  
Software | Cell 317.331.9718 l Office 888.496.2446x716  
[www.igodigital.com](http://www.igodigital.com)

---

<div class="post-metadata">

**Author:** ![craayzie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e47774/32.png) [@craayzie](https://www.ruby-forum.com/u/craayzie)\
**Post date:** [December 16, 2010, 1:42am UTC](https://www.ruby-forum.com/t/deploying-radiant-0-9-1-with-capistrano/226139/7 "2010-12-16T01:42:07Z")

</div>

I have investigated a solution with bundler capistrano radiant and rvm  
for the company I am currently working with several weeks ago.

The deploy.rb file starts with this line: #require “bundler/  
capistrano”

It has a simple task to install the bundle on the remote server, which  
looks like this:

task :bundle do  
run “cd #{release\_path} && bundle install --without test”  
end

And gets called before the symlink with this line: before  
“deploy:symlink”, :bundle

I have to start another radiant project which uses the same  
infrastructure next week, so I might come across some errors which  
luckily have not occurred so far. 🙂

I hope this helps  
Christoph

---

<div class="post-metadata">

**Author:** ![craayzie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e47774/32.png) [@craayzie](https://www.ruby-forum.com/u/craayzie)\
**Post date:** [December 16, 2010, 9:59am UTC](https://www.ruby-forum.com/t/deploying-radiant-0-9-1-with-capistrano/226139/8 "2010-12-16T09:59:21Z")

</div>

Thanks for all the helpful posts. So I’ve got capistrano deploying my  
github-hosted application to my staging server. Works great! I’m not  
using  
bundler yet as I’m not sure of the benefits there. One of the problems  
I’m  
running into is deploying migrations (capistrano complains that it’s not  
able to find /config/database.yml in the current release directory).

I’ve found a couple of blog posts describing solutions to the issue e.g.

> **[Capistrano and database.yml — Simone Carletti](https://simonecarletti.com/blog/2009/06/capistrano-and-database-yml/)**
>
> How to create the database.yml file with Capistrano to prevent sensitive data to be stored in the application repository.

I’m curious why none of your deploy.rb scripts contained any reference  
to  
the database config file. How are you guys deploying migrations?

---

<div class="post-metadata">

**Author:** ![craayzie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e47774/32.png) [@craayzie](https://www.ruby-forum.com/u/craayzie)\
**Post date:** [December 16, 2010, 3:40pm UTC](https://www.ruby-forum.com/t/deploying-radiant-0-9-1-with-capistrano/226139/9 "2010-12-16T15:40:23Z")

</div>

On Dec 16, 2010, at 3:58 AM, Fima L. wrote:

> I’m curious why none of your deploy.rb scripts contained any reference to the  
> database config file. How are you guys deploying migrations?

That’s a general concern for all Rails apps, not specific to Radiant.  
AFAIK common practice is still to keep database.yml out of source  
control and maintain a separate copy on each staging or production  
server. We symlink ours from the shared path to the current checkout on  
each deploy:

```
namespace :deploy do
    desc "Symlink necessary files into current dir"
    task :symlink_configs do
        run "ln -sf #{shared_path}/database.yml 

```

#{release\_path}/config/database.yml"  
# copy any other sensitive configs or initializers you might  
need – S3 keys, etc.  
end  
after ‘deploy:update\_code’, ‘deploy:symlink\_configs’  
end

How you get database.yml into your shared path is another matter. The  
blog you linked to has a recipe for that as well.

---

<div class="post-metadata">

**Author:** ![craayzie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e47774/32.png) [@craayzie](https://www.ruby-forum.com/u/craayzie)\
**Post date:** [March 6, 2014, 10:59am UTC](https://www.ruby-forum.com/t/deploying-radiant-0-9-1-with-capistrano/226139/10 "2014-03-06T10:59:10Z")

</div>

This is very useful information shared here. I am really thankful for  
this. [http://www.99th.co.in](http://www.99th.co.in)
