Capistrano looking for releases / files that don't exist - ruby-on-rails

Having a bit of a rough time deploying a rails 3.1 app - things seem to be working but I'm getting weird errors:
*** [err :: 97.107.134.41] find: `/home/deploy/myapp/releases/20120208030228/public/images'
*** [err :: 97.107.134.41] : No such file or directory
*** [err :: 97.107.134.41] find: `/home/deploy/myapp/releases/20120208030228/public/stylesheets': No such file or directory
*** [err :: 97.107.134.41]
*** [err :: 97.107.134.41] find: `/home/deploy/myapp/releases/20120208030228/public/javascripts': No such file or directory
command finished in 73ms
firs off, there is no "20120208030228" release. Secondly, why is it looking for public/javascripts etc when it's a Rails 3 App?
EDIT - found the answer here: Capistrano for Rails 3.1
Added "set :normalize_asset_timestamps, false" to the deploy.rb file and the errors are gone!

Copying the answer from the comments in order to remove this question from the "Unanswered" filter:
I found the answer here: Capistrano for Rails 3.1 I added set :normalize_asset_timestamps, false to the deploy.rb file and that fixed it!
~ link per fatfrog to a helpful question by Steve Harman

Related

Installing JSON Gem with Bundler without GCC

I am in the process of deploying a rails application to a server. There are a few environmental limitations, namely:
No internet access on server
No root access on server
No build tools (GCC, etc)
I almost have the capistrano deployment working, however I get a failure when bundler tries to install the json gem:
** [out :: 192.168.7.115] Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
** [out :: 192.168.7.115]
** [out :: 192.168.7.115] /app/ruby/bin/ruby extconf.rb
** [out :: 192.168.7.115] creating Makefile
** [out :: 192.168.7.115]
** [out :: 192.168.7.115] make
** [out :: 192.168.7.115] compiling generator.c
** [out :: 192.168.7.115] make: gcc: Command not found
** [out :: 192.168.7.115] make: *** [generator.o] Error 127
Since there is no internet, I have all of my gems stored in vendor/cache. I wanted to solve this problem by compiling the json gem on a similar machine that does have gcc, but I wasn't able to find a "compiled-looking" gem on the system. Normally, I see a [gemname]-x86_64-linux.gem gemfile that indicates the compilation has already been taken care of. Can't seem to find this for the JSON gem, but if I did, I'm guessing I could just drop it in my vendor/cache folder and call it a day.
Any suggestions? Am I approaching this problem correctly?
I can't recommend this method as it's likely a bad thing on many levels, but it did solve my problem. I ended up copying the shared/bundle folder from the staging server to the production server. Bundler sees that the gems are already installed and doesn't try to reinstall them.

use capistrano after delete heroku

I had a rails app that's was running on heroku, I recently got my VPS and trying to move it to my own server.
So, I deleted my heroku, and added an origin.
I did all the setups for deploy.rb(all looks fine)
but when I run cap deploy:setup, I got:
* 2012-11-24 20:35:21 executing `deploy:setup'
* executing "mkdir -p /var/www/sites/phil88530.com /var/www/sites/phil88530.com/releases /var/www/sites/phil88530.com/shared /var/www/sites/phil88530.com/shared/system /var/www/sites/phil88530.com/shared/log /var/www/sites/phil88530.com/shared/pids"
servers: ["phil88530.com"]
[phil88530.com] executing command
*** [err :: phil88530.com]
*** [err :: phil88530.com] ! Invalid path.
*** [err :: phil88530.com]
*** [err :: phil88530.com] ! Syntax is: git#heroku.com:<app>.git where <app> is your app's name.
command finished in 956ms
I don't want heroku exist anymore, why does it ask for heroku?
And I don't understand the invalid path as well, would be nice if I capistrano can get me more informatinos.
http://phil88530.com/ resolves to heroku... so when capistrano connects to servers: ["phil88530.com"], it's connecting to heroku.
You can either set the server to the IP address of your new VPS, or move the DNS over to the new VPS to correct the problem.

How to drop to a shell during a Capistrano deployment

Occasionally, an error will occur during a Capistrano deployment that doesn't provide enough output to troubleshoot. For example:
* executing "cd /apps/my_app/releases/20121019181838 && bundle exec rake RAILS_ENV=dev RAILS_GROUPS=assets assets:precompile"
servers: ["myserver.com"]
[myserver.com] executing command
*** [err :: myserver.com] rake aborted!
*** [err :: myserver.com] Connection refused - connect(2)
*** [err :: myserver.com]
*** [err :: myserver.com] Tasks: TOP => environment
*** [err :: myserver.com] (See full trace by running task with --trace)
command finished in 2388ms
*** [deploy:update_code] rolling back
* executing "rm -rf /apps/my_app/releases/20121019181838; true"
Something went wrong during the rake task, and it looks like it probably has something to do with the DB. But in order to troubleshoot this, I would need to recreate the conditions of the deploy; alas, the conditions have been rm -rf'ed.
Is there some way to make Capistrano drop to a (Cap or bash) shell here using a before or after hook? Is there an easy way to insert a --trace onto that rake task without overriding Capistrano classes? Other ideas?
I handle situations as such in the following ways:
When I can be fast enough I simply hit CTR+Z (it 'pauses' the cap process) and then I investigate things onsite (over ssh, or the cap console).
I set the debug (cap --debug) flag when running the task - which makes cap prompt me before each remote command execution, so I can investigate the situation before/after every step.
Both ways usually are sufficient for me to handle the most situations quite quickly. Hope they will also help you.

deploying ruby on rails app using capistrano - cap deploy:setup failing

I've wasted a few days on this problem and I'm sure it's a simple solution, please help!
When I run $ cap deploy:setup from my user account on my laptop I get the errors I've pasted below. It seems that there's a problem with RVM, but I know that it's installed, and I've pre-installed all the gems my app will need as well. Has anyone else encountered similar errors? Any help would be hugely appreciated!
* executing `deploy:setup'
* executing "mkdir -p /usr/local/www/sites/arbiter.nullpointer.ca/public/ /usr/local/www/sites/arbiter.nullpointer.ca/public/releases /usr/local/www/sites/arbiter.nullpointer.ca/public/shared /usr/local/www/sites/arbiter.nullpointer.ca/public/shared/system /usr/local/www/sites/arbiter.nullpointer.ca/public/shared/log /usr/local/www/sites/arbiter.nullpointer.ca/public/shared/pids && chmod g+w /usr/local/www/sites/arbiter.nullpointer.ca/public/ /usr/local/www/sites/arbiter.nullpointer.ca/public/releases /usr/local/www/sites/arbiter.nullpointer.ca/public/shared /usr/local/www/sites/arbiter.nullpointer.ca/public/shared/system /usr/local/www/sites/arbiter.nullpointer.ca/public/shared/log /usr/local/www/sites/arbiter.nullpointer.ca/public/shared/pids"
servers: ["arbiter.nullpointer.ca"]
[arbiter.nullpointer.ca] executing command
** [out :: arbiter.nullpointer.ca]
** [out :: arbiter.nullpointer.ca] $rvm_path (system_wide) does not exist.
*** [err :: arbiter.nullpointer.ca] /usr/local/rvm/scripts/rvm: line 154: __rvm_teardown: command not found
*** [err :: arbiter.nullpointer.ca] /usr/local/rvm/bin/rvm-shell: line 74: rvm: command not found
*** [err :: arbiter.nullpointer.ca] Error: RVM was unable to use 'default'
command finished
failed: "rvm_path=system_wide /usr/local/rvm/bin/rvm-shell 'default' -c \"mkdir -p /usr/local/www/sites/arbiter.nullpointer.ca/public/ /usr/local/www/sites/arbiter.nullpointer.ca/public/releases /usr/local/www/sites/arbiter.nullpointer.ca/public/shared /usr/local/www/sites/arbiter.nullpointer.ca/public/shared/system /usr/local/www/sites/arbiter.nullpointer.ca/public/shared/log /usr/local/www/sites/arbiter.nullpointer.ca/public/shared/pids && chmod g+w /usr/local/www/sites/arbiter.nullpointer.ca/public/ /usr/local/www/sites/arbiter.nullpointer.ca/public/releases /usr/local/www/sites/arbiter.nullpointer.ca/public/shared /usr/local/www/sites/arbiter.nullpointer.ca/public/shared/system /usr/local/www/sites/arbiter.nullpointer.ca/public/shared/log /usr/local/www/sites/arbiter.nullpointer.ca/public/shared/pids\"" on arbiter.nullpointer.ca
I just ran into this problem though my installation was complaining with:
out :: server]
** [out :: server] $rvm_path (/home/nebula/.rvm/) does not exist.
*** [err :: server] /usr/local/rvm/scripts/rvm: line 185: __rvm_teardown: command not found
*** [err :: server] /usr/local/rvm/bin/rvm: line 52: /home/nebula/.rvm//scripts/rvm: No such file or directory
*** [err :: server] Error sourcing RVM!
*** [err :: server] Error: RVM was unable to use 'ruby-1.9.3-p392'
I am using rvm with a system wide install, (standard install to /usr/local/rvm). Adding the following to my Capfile solved the issue:
set :rvm_type, :system
set :rvm_path, "/usr/local/rvm"
The Error shows: RVM was unable to use 'default' gemset. Means RVM can't find a gemset named 'default' to use. Check the following line in your deploy.rb
set :rvm_ruby_string, 'gemset-name-here' => put a valid gemset here

No such file or directory in capistrano deploy

Here is the error when doing cap deploy:
*** [err :: 11.15.19.46] find: `/var/www/emclab/releases/20111208184942/public/images'
*** [err :: 11.15.19.46] : No such file or directory
*** [err :: 11.15.19.46] find: `/var/www/emclab/releases/20111208184942/public/stylesheets': No such file or directory
*** [err :: 11.15.19.46] find: `/var/www/emclab/releases/20111208184942/public/javascripts'
*** [err :: 11.15.19.46] : No such file or directory
Any thoughts what causes the error? thanks.
I assume you updated to rails 3.1
I run in same problem recently. Solution:
Add this line to deploy.rb
set :normalize_asset_timestamps, false
In fact this question is duplication of: Capistrano and deployment of a website from Github
only post it because found it on google quite high and this one has not got answer
I struggled with this problem also.
Assuming you are using Rails 3.1, the answer is on this webpage: http://guides.rubyonrails.org/asset_pipeline.html
The short answer is your assets (imgs, js, css) haven't been compiled for deployment to production. You can either compile them manually with this command.
bundle exec rake assets:precompile
Or you can uncomment this line from your Capfile:
load 'deploy/assets'
Or you can set your production environment to compile the assets in production, but I found that solution just created more problems and would recommend the two suggestions above.

Resources