3

I tried to deploy ror application on production server then got this error:

Access denied for user 'root'@'localhost' (using password: YES) (Mysql::Error)

but when i ran command:

rake db:migrate RAILS_ENV=production

it passed. I also connect to mysql from command line:

mysql -u root -p 

it got through, and i can see all the tables are created.

i m working on a branch , in my deploy.rb i already set the branch:

set :branch 'myBranch'

and in apache2 configuration file, i set rails_env too:

<VirtualHost *:80>
  ServerName daemon.com
  DocumentRoot /home/hy/work/log/current/public/
  RailsEnv production
</VirtualHost>

Please help, thanks!

OMG Ponies
  • 300,587
  • 73
  • 490
  • 482
ohana
  • 71
  • 1
  • 4

2 Answers2

0

I know this is old, but what you need to do is to set default_env in your deploy.rb file and set environment variables.

Something like this:

set :default_env, { 
  'var1' => 'value1',
  'var2' => 'value2'
}

This will work for Capistrano 3. Hope this will help anyone stumbling upon this question.

Jeremie
  • 1,852
  • 1
  • 13
  • 24
0

You might've already been through this, but I'd suggest you double check that your config/environments/production.yml contains valid credentials and is pushed into the repository.

You mentioned you have tried to do the migration manually on the server. Did you run the migration from the very same directory, where your current deployed app lies ?

(/home/hy/work/log/current)

Jan Koriťák
  • 796
  • 8
  • 9