Welcome Guest | Login

Capistrano Errors - Not A Working Copy

I am new to capistrano and the deployment of rails applications. I am working on a Mac running Leopard and my Capistrano version is 2.0.0.

I was able to set up a svn repo without a problem and my  rails app is in the repo. The capify command worked fine as did cap deploy:setup. When I run cap deploy:cold I get the following error message.

* executing `deploy:cold'
* executing `deploy:update'
** transaction: start
* executing `deploy:update_code'
svn: 'svn+ssh/{user}@domain.net/home/{user}/svn/{appname}' is not a working copy
svn: Can't open file 'svn+ssh/{user}@domain.net/home/user/svn/{appname}/.svn/entries': No such file or directory
*** [deploy:update_code] rolling back

If it matters, I am deploying to {appname}.domain.net and not domain.net. This is just a simple symlink for the {appname} folder under public_html though (I think).

Is this a cap error or svn error? This is my first time working with both!

Any thoughts? Any help would be greatly appreciated!

Thanks,

Thomas

2008-03-19 09:07 PM

Hi Thomas, can you paste in your entire deploy.rb file (with sensitive info removed) -- its not finding your app correctly and I want to make sure things are OK in that file.

2008-03-20 02:07 AM

William,

Below is my deploy.rb file. I have deleted out the commented lines to save screen space here.

set :application, "{app}"
set :repository,  "svn+ssh//{user}@domain.net/home/{user}/svn/{app}/trunk/"
set :domain, "domain.net"                # The URL for your app
set :user, "{user}"                  # Your HostingRails username
set :use_sudo, false                 # HostingRails users don't have sudo access
set :deploy_to, "/home/#{user}/apps/#{application}"          # Where on the server your app will be deployed
set :deploy_via, :checkout                # For this tutorial, svn checkout will be the deployment method
set :chmod755, "app config db lib public vendor script script/* public/disp*"   # Some files that will need proper permissions





role :app, domain
role :web, domain
role :db,  domain, :primary => true

2008-03-20 06:49 AM

Hello,

I found a misconfiguration in the "set :repository" entry.

set :repository,  "svn+ssh://#{user}@#{domain}/home/#{user}/svn/#{application}/trunk"  

You have missed a ':' there. Can you make sure that this is not a typo..

2008-03-20 08:04 AM

Regards,
Rahul
Rahul,

Thanks for catching that. I was indeed missing a colon there. I added the change into the repo and did another cap deploy:cold. I now receive the following output after running cap deploy:cold.

It seems like there are permission errors. Do I need to setup ssh_keys for cap to work?

  * executing `deploy:cold'
 * executing `deploy:update'
** transaction: start
 * executing `deploy:update_code'
{user}@domain.net's password:
 * executing "svn checkout -q  -r17 svn+ssh://{user}@domain.net/home/{user}/svn/{app}/trunk/ /home/{user}/apps/{app}/releases/20080320144718 && (echo 17 > /home/{user}/apps/{app}/releases/20080320144718/REVISION)"
   servers: ["domain.net"]
Password:
   [domain.net] executing command
** [err] Permission denied, please try again.
** [err] Permission denied, please try again.
** [err] Permission denied (publickey,gssapi-with-mic,password).
** [err] svn: Connection closed unexpectedly
   command finished
 * executing `deploy:finalize_update'
 * executing "chmod -R g+w /home/{user}/apps/{app}/releases/20080320144718"
   servers: ["domain.net"]
   [domain.net] executing command
*** [err :: domain.net] chmod:
*** [err :: domain.net] cannot access `/home/{user}/apps/{app}/releases/20080320144718'
*** [err :: domain.net] : No such file or directory
*** [err :: domain.net]
   command finished
 * executing "rm -rf /home/{user}/apps/{app}/releases/20080320144718/log /home/{user}/apps/{app}/releases/20080320144718/public/system /home/{user}/apps/{app}/releases/20080320144718/tmp/pids &&\n      mkdir -p /home/{user}/apps/{app}/releases/20080320144718/public &&\n      mkdir -p /home/{user}/apps/{app}/releases/20080320144718/tmp &&\n      ln -s /home/{user}/apps/{app}/shared/log /home/{user}/apps/{app}/releases/20080320144718/log &&\n      ln -s /home/{user}/apps/{app}/shared/system /home/{user}/apps/{app}/releases/20080320144718/public/system &&\n      ln -s /home/{user}/apps/{app}/shared/pids /home/{user}/apps/{app}/releases/20080320144718/tmp/pids"
   servers: ["domain.net"]
   [domain.net] executing command
   command finished
 * executing "find /home/{user}/apps/{app}/releases/20080320144718/public/images /home/{user}/apps/{app}/releases/20080320144718/public/stylesheets /home/{user}/apps/{app}/releases/20080320144718/public/javascripts -exec touch -t 200803201447.22 {} ';'; true"
   servers: ["domain.net"]
   [domain.net] executing command
*** [err :: domain.net] find: /home/{user}/apps/{app}/releases/20080320144718/public/images: No such file or directory
*** [err :: domain.net] find: /home/{user}/apps/{app}/releases/20080320144718/public/stylesheets: No such file or directory
*** [err :: domain.net] find: /home/{user}/apps/{app}/releases/20080320144718/public/javascripts: No such file or directory
   command finished
 * executing `deploy:symlink'
 * executing "rm -f /home/{user}/apps/{app}/current && ln -s /home/{user}/apps/{app}/releases/20080320144718 /home/{user}/apps/{app}/current"
   servers: ["domain.net"]
   [domain.net] executing command
   command finished
** transaction: commit
 * executing `deploy:migrate'
 * executing "ls -x /home/{user}/apps/{app}/releases"
   servers: ["domain.net"]
   [domain.net] executing command
   command finished
 * executing "cd /home/{user}/apps/{app}/releases/20080320144718; rake RAILS_ENV=production  db:migrate"
   servers: ["domain.net"]
   [domain.net] executing command
*** [err :: domain.net] rake aborted!
*** [err :: domain.net]
*** [err :: domain.net] No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
*** [err :: domain.net]
*** [err :: domain.net] /usr/local/lib/ruby/gems/1.8/{app}s/rake-0.8.1/lib/rake.rb:2143:in `raw_load_rakefile'
*** [err :: domain.net]
*** [err :: domain.net] (See full trace by running task with --trace)
*** [err :: domain.net]
   command finished
 * executing `deploy:start'
 * executing "rm -rf /home/{user}/public_html/{app};ln -s /home/{user}/apps/{app}/current/public /home/{user}/public_html/{app}"
   servers: ["domain.net"]
   [domain.net] executing command
   command finished

2008-03-20 09:51 AM

Hello,

Can you have a look into the following link..I guess this will help you fix the mentioned issue..


http://groups.google.com/group/capistrano/browse_thread/thread/13b029f75b61c09d

2008-03-20 11:54 AM

Regards,
Rahul
Wonderful! I got it up and running. Thanks for the help.

A different question, but probably an easy one. Does capistrano automatically change the environment from development to production or do I have to do that somewhere?

Thanks for the help!

Thomas

2008-03-20 12:06 PM

Hello,

Normally we start mongrel in production mode.. (the deploy.rb entries)

But it also depends on the config/environment.rb file. The mode can be Production or Development depending on the following entry.

# ENV['RAILS_ENV'] ||= 'production'

The above entry indicates a development mode.

ENV['RAILS_ENV'] ||= 'production'

This indicates a production mode.

So you will need to check this also.I hope this helps.

2008-03-20 01:19 PM

Regards,
Rahul
I am using FCGI, not mongrel. So right before I deploy the app via cap, I need to change the environment.rb file to indicate production and then commit the code and deploy? Then after the deploy has happened I need to change the file back so I can be in development mode again on my local machine?

2008-03-20 02:28 PM

Hi Thomas,

Yes, you may need to change the environment.rb to production in your local machine before deploying to the server.

In Capfile you can mention " set :rails_env, 'production' " to set Rails environment. But this does not seems to work for deploying the apps to production mode. The :rails_env environment is only taken under consideration by Capistrano for setting the environment to use  when running migrations.


2008-03-20 07:14 PM


Hello Guest! In order to post you must be an active client with us, please log in or sign up.