db.networx
working with Rails 2.0, Ruby on Rails, Flex, Flash and …Basic Tips and Tricks for Capistrano 2
April 22, 2008 at 11:55Capistrano can be tricky sometimes and it is very time consuming to find the solution. Here are some things I have always at hand, when something doesn’t work with Capistrano:
-
Code (ruby)
-
require ‘mongrel_cluster/recipes’
I found this by chance. Mongrel Cluster has some default recipes, tasks you can use to stop, restart your remote Mongrel Processes, just add the line above to your code.
-
-
Code (ruby)
-
set :checkout, "export"
To avoid that capistrano only checks out your rails project and also puts the .svn files in your production environment you can add this line to the deploy.rb - an export disconnects the project files from the repository (removes .svn folders).
-
- I’m using ssh and so every checkout from my repository is with svn+ssh. But I had problems doing this with Capistrano, so I read about a nice way to get svn+ssh to work with Capistrano. All you have to do is generate a public key file for your user you created to checkout the files from the repository. Create the public keyfile for this user without a password on the server where your repository lies, then copy the key file to your own pc/mac and add the path to this key to your config file in the .subversion folder. The .subversion Folder is inside your home directory. Additional help here.
Code (txt)
-
ssh = $SVN_SSH ssh -l dboek -i /Users/dboek/dboek_railsdev
“dboek” is my username for the remote folder, “/Users/dboek/dboek_railsdev” is the path to my key file on windows you will have to write something like “c:/secret/my_server.key”.
Everytime a program is using ssh and tries to connect to your server it will be given the key file and on this way there will be no problems with a username and password combination in Capistrano. -
- For Mac Users: I had the problem that Capistrano won’t run correctly, it had problems working with ssh: After an hour of searching I found a solution, just switch your command line shell:
Code (shell)
-
ssh-agent bash
-
ssh-add
This will switch your command line to bash and add ssh functionality, afterwards everthing worked perfectly well.
-
- If you have problems running Capistrano with Windows, also take a look at Jamis Blog, he explains it more in detail there
Code (ruby)
-
default_run_options[:pty] = true
-
No comments yet »
Your comment
HTML-Tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>