Search code examples
ruby-on-railsvagrantcapistrano

Capistrano: linked file database.yml does not exist on localhost


I am deploying to a local VM. Here is the error:

ERROR linked file /var/www/rails-devise-capistrano/shared/config/database.yml does not exist on localhost

However, the file does exist:

vagrant@vagrant:/var/www/rails-devise-capistrano/shared/config$ ls
database.yml  secrets.yml

Any idea how to fix this error?

UPDATE:

INFO [81d54d10] Running /usr/bin/env mkdir -p /var/www/rails-devise-capistrano/shared/config /var/www/rails-devise-capistrano/shared/config as vagrant@localhost
DEBUG [81d54d10] Command: ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.2.2 /usr/bin/env mkdir -p /var/www/rails-devise-capistrano/shared/config /var/www/rails-devise-capistrano/shared/config )
INFO [81d54d10] Finished in 0.042 seconds with exit status 0 (successful).
DEBUG [44d62e62] Running /usr/bin/env [ -f /var/www/rails-devise-capistrano/shared/config/database.yml ] as vagrant@localhost
DEBUG [44d62e62] Command: [ -f /var/www/rails-devise-capistrano/shared/config/database.yml ]
DEBUG [44d62e62] Finished in 0.042 seconds with exit status 1 (failed).

Solution

  • Capistrano uses command [ -f PATH ] to test that database.yml exists. It is getting back a non-zero exit status from that test, which is why it gives you an error.

    According to the bash man page:

    -f file True if file exists and is a regular file.

    Is it possible that your database.yml is a directory? Or is otherwise not "a regular file"? Or maybe the vagrant user does not have permission to access it?