Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DB:pull 127 error #113

Open
norcle opened this issue Feb 9, 2017 · 10 comments
Open

DB:pull 127 error #113

norcle opened this issue Feb 9, 2017 · 10 comments

Comments

@norcle
Copy link

norcle commented Feb 9, 2017

Postgres datebase.

When
gem 'capistrano-db-tasks', '0.6', require: false

cap production db:pull error

rails exit status: 127
rails stdout: Nothing written
rails stderr: Nothing written

when
gem 'capistrano-db-tasks', '0.4', require: false

it`s work fine.

@Fercell
Copy link

Fercell commented Feb 15, 2017

I am having the same issue, this is what logs say:

DEBUG [fc953976] Finished in 0.547 seconds with exit status 0 (successful). INFO Loading local database config INFO Loading local database config INFO Loading remote database config DEBUG [3b1a9656] Running if test ! -d /home/ubuntu/current; then echo "Directory does not exist '/home/ubuntu/current'" 1>&2; false; fi as $SERVER$ DEBUG [3b1a9656] Command: if test ! -d /home/ubuntu/current; then echo "Directory does not exist '/home/ubuntu/current'" 1>&2; false; fi DEBUG [3b1a9656] Finished in 0.243 seconds with exit status 0 (successful). DEBUG [61adb49d] Running bundle exec rails runner "puts '__CAPISTRANODB_CONFIG_BEGIN_FLAG__' + ActiveRecord::Base.connection.instance_variable_get(:@config).to_yaml + '__CAPISTRANODB_CONFIG_END_FLAG__'" 2>/dev/null as $SERVER$ DEBUG [61adb49d] Command: cd /home/ubuntu/current && ( export RAILS_ENV="production" ; bundle exec rails runner "puts '__CAPISTRANODB_CONFIG_BEGIN_FLAG__' + ActiveRecord::Base.connection.instance_variable_get(:@config).to_yaml + '__CAPISTRANODB_CONFIG_END_FLAG__'" 2>/dev/null )

@luizamboni
Copy link

luizamboni commented Feb 24, 2017

i m too.
Error running command (status=pid 5691 exit 1): /home/luiz/projects/exercicios_resolvidos5/bin/rails runner "puts '__CAPISTRANODB_CONFIG_BEGIN_FLAG__' + ActiveRecord::Base.connection.instance_variable_get(:@config).to_yaml + '__CAPISTRANODB_CONFIG_END_FLAG__'"

ruby: 2.6
rails: 5.1
capistrano-db-tasks: 0.6

database: postgress in another machine

@Znow
Copy link

Znow commented May 19, 2017

@sgruhier - I get the same error, is there any updates on when this is gonna be fixed?

@impdesigns
Copy link

I'm also experiencing the same behavior. db:pull fails unless I force version 0.4.

For me at least, this didn't start happening until I updated to Capistrano 3.8.1. Having said that, I'm not exactly a ruby on rails guru and that might have not a damn thing to do with anything...

sauliusgrigaitis added a commit to sauliusgrigaitis/capistrano-db-tasks that referenced this issue Aug 17, 2017
@ezuk
Copy link

ezuk commented Aug 22, 2017

The fix above from @sauliusgrigaitis worked for me. Thank you!

@codered
Copy link

codered commented Sep 14, 2017

Can we merge this into master and create a new release?

I verified that @sauliusgrigaitis fix works.

@codered
Copy link

codered commented Sep 14, 2017

By the way, if you want to use the fix before they merge it into a release, you can do the following:

  1. In command prompt type "which rails"
  2. Change to the directory using the "cd" command.
  3. There is a gem folder. Traverse the folder until you find database.rb. Copy paste the file from the fix into there. This will make it work, however, the solution is temporary.

@smtlaissezfaire
Copy link

I don't think the patch above works well, since it doesn't work in cases in which the db config can't easily been taken from database.yml (for instance, when database info is encrypted in secrets, etc).

For me, I ran into this one when using rvm. Rvm wasn't loading with the 'rails' command, so it wasn't found. Strange how it wasn't reporting anything out, though.

This fixed it for me:

set :rvm_map_bins, %w{gem rake ruby bundle rails}

@smtlaissezfaire
Copy link

See capistrano/rvm#56

@rystraum
Copy link

rystraum commented Aug 1, 2018

There are 2 issues here.

  1. For those who are using capistrano-rvm, make sure that you've set: set :rvm_map_bins, %w{gem rake ruby bundle rails}

This enables capistrano-db-tasks to run rails runner using the bins provided by RVM.

  1. For those who have things in the DB being loaded by Rails before running (eg. application settings saved in the DB, which doesn't exist yet, because you're trying to set-up the DB but you can't setup the DB because cap db:push doesn't work because rails runner doesn't run because of an application setting in the db, which doesn't exist yet...), this commit will fix it naively as it forgoes going through rails runner but instead assumes a config/database.yml being read.

This case will fail for those who have a different setup (e.g. creds in secrets.yml) (as #113 (comment) points out)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants