Deployment problem after update to rails 3.2.1

Hi!

I updated my application from Rails 3.1.x to 3.2.1. I followed the
update instructions in the Rails Guide which hardly requires any
modifications apart from development mode. On my local machine -
running development mode - the application is running fine using Ruby
1.9.3 with the mysql2 gem.

After deployment with Capistrano to the production server (running
Rvm, Ruby 1.9.2) I get:

executing “cd ~/rails/releases/20120202145157 && bundle exec rake
RAILS_ENV=production RAILS_GROUPS=assets assets:precompile”

[server] executing command

*** [err :: server] rake aborted!
*** [err :: server Can’t connect to local MySQL server through socket
‘/tmp/mysql.sock’ (2)
*** [err :: server]
*** [err :: server] Tasks: TOP => environment
*** [err :: server] (See full trace by running task with --trace)

Before the update to Rails 3.2.1 all deployments went allright.

Any clues?

On Thu, Feb 2, 2012 at 11:58 AM, javinto [email protected] wrote:

[server] executing command
*** [err :: server] rake aborted!
*** [err :: server Can’t connect to local MySQL server through socket
‘/tmp/mysql.sock’ (2)
*** [err :: server]
*** [err :: server] Tasks: TOP => environment
*** [err :: server] (See full trace by running task with --trace)

Can you check your database.yml?

/tmp/mysql.sock looks like a OSX location… Wondering if you copied
your dev properties to production?

Greg A.
http://twitter.com/akinsgre

Thanks for your reply!

That was my first thought as well so I checked the database.yml on the
server. But what I forgot was that I was strugling with the repository
in my new editor TextMate. So I had to check in all new files with my
old editor thereby including the database.yml file as well… which
should not have happened as it is shared.

So now I got them out of the repository, did a export to check they
are really gone. Checked the shared/config path on the server to see
if they are still there and now on deployment I get this:

executing “cd ~/rails/releases/20120202180855 && bundle exec rake
RAILS_ENV=production RAILS_GROUPS=assets assets:precompile”
servers: [""]
[] executing command
*** [err :: ] rake aborted!
*** [err :: No such file or directory - /var/www/vhosts/server/rails/
releases/20120202180855/config/database.yml

It looks like the symlink which is automatically applied by Capistrano
does not get fired… I’m out of ideas.

Yeah, but it’s there! Refreshed my remote server and it’s still there.

This is my deploy.rb part:

namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run “#{try_sudo} touch
#{File.join(current_path,‘tmp’,‘restart.txt’)}”
end

after “deploy:update_code”, :link_production_db, ‘dragonfly:symlink’
end

desc “Link database.yml from shared path”
task :link_production_db do
run “ln -nfs #{deploy_to}/#{shared_dir}/config/database.yml
#{release_path}/config/database.yml”
run “ln -nfs #{deploy_to}/#{shared_dir}/config/email.yml
#{release_path}/config/email.yml”
end

And database.yml and email.yml are in /shared/config folder as they
have always been.

But look at the Capistrano output:
triggering after callbacks for `deploy:update_code’

  • executing `deploy:assets:precompile’
  • executing “cd ~/rails/releases/20120202183436 && bundle exec rake
    RAILS_ENV=production RAILS_GROUPS=assets assets:precompile”

It does not mention the symlink commands. It directly executes the
Bundle command. I cannot remember it normally does.

On Thu, Feb 2, 2012 at 1:20 PM, javinto [email protected] wrote:

*** [err :: ] rake aborted!
*** [err :: No such file or directory - /var/www/vhosts/server/rails/
releases/20120202180855/config/database.yml

This may not be the symlink, but that the database.yml isn’t deployed,
and needs to be copied manually from an older version on the server,
or from your own machine.

Your situation may differ, but I use capistrano to deploy from the
SCM, so if it’s not there, it’s not going to make it to your server.


Greg A.
http://twitter.com/akinsgre

On Thu, Feb 2, 2012 at 1:45 PM, javinto [email protected] wrote:

Yeah, but it’s there! Refreshed my remote server and it’s still there.

Ah… capistrano is great when it is working, isn’t it :slight_smile:

Hopefully someone else can help more; you might try the capistrano list.

Bundle command. I cannot remember it normally does.

or from your own machine.
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.


Greg A.
http://twitter.com/akinsgre

Hey, hopefully you figured this out already but I was stuck on this
issue as well, and the solution’s pretty simple. You have to make sure
that the “database.yml” file is in the git or scm tool repository that
you’re using.

I think capistrano is trying to pull the database.yml file from the

repository and not any physical location on the deployment server.
Sometimes when you’re working with people you .gitignore the
database.yml file but just make sure you “git add -f” the database.yml
file then commit and push it. Then try cap deploy/cap deploy:update and
hopefully it works!

Good luck and I hope this helps.

Ha ha, yeah it is.

Just checked with another project and it should run the
after_update_code callbacks first! But it isn’t. Same Capistrano
version…

I will seek some Capistrano help. Thanks so far!

On Sun, Feb 12, 2012 at 10:28 PM, Vidal Ekechukwu
[email protected]wrote:

Hey, hopefully you figured this out already but I was stuck on this
issue as well, and the solution’s pretty simple. You have to make sure
that the “database.yml” file is in the git or scm tool repository that
you’re using.

I think capistrano is trying to pull the database.yml file from the
repository and not any physical location on the deployment server.
Sometimes when you’re working with people you .gitignore the
database.yml file but just make sure you “git add -f” the database.yml
file then commit and push it.

In general, this does not seem to be the optimal solution. I would not
advise to store the production passwords in the version control system

As Capistrano does it by default, link to files in /shared/config, seems
a lot better for the production passwords.

HTH,

Peter


*** Available for a new project ***

Peter V.
http://twitter.com/peter_v
http://rails.vandenabeele.com
http://coderwall.com/peter_v