【发布时间】:2015-03-15 18:05:02
【问题描述】:
我正在使用 Capistrano 3.0 将 Rails 应用程序部署到 VPS。当我运行cap production deploy 时,我最终会出现以下错误。我正在使用 Postgresql。
INFO [356ebea5] Running ~/.rvm/bin/rvm default do bundle exec rake db:migrate as deployer@ipaddress
DEBUG [356ebea5] Command: cd /home/deployer/scoutqatar/releases/20150315174921 && ( RAILS_ENV=production ~/.rvm/bin/rvm default do bundle exec rake db:migrate )
DEBUG [356ebea5] rake aborted!
DEBUG [356ebea5] NameError: uninitialized constant PG
我似乎在迁移过程中出错了。
我在 VPS 中有config/database.yml 文件,内容如下:
development:
adapter: postgresql
encoding: utf8
database: dohaguide_development
pool: 5
username: user
password: pass
test: &TEST
adapter: postgresql
encoding: utf8
database: dohaguide_test
pool: 5
username: user
password: pass
production:
adapter: postgresql
encoding: utf8
database: dohaguide_production
pool: 5
username: user
password: pass
我已经在 VPS 中创建了上述数据库。
我的deploy.rb 文件包含以下内容
# Default value for :linked_files is []
set :linked_files, %w{config/database.yml}
# Default value for linked_dirs is []
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
# Your restart mechanism here, for example:
execute :touch, release_path.join('tmp/restart.txt')
end
end
after :publishing, :restart
after :restart, :clear_cache do
on roles(:web), in: :groups, limit: 3, wait: 10 do
# Here we can do anything such as:
# within release_path do
# execute :rake, 'cache:clear'
# end
end
end
after :finishing, 'deploy:cleanup'
end
我一直试图找出错误的原因,但找不到任何错误。 有人可以指导我正确的方向
【问题讨论】:
标签: postgresql ruby-on-rails-4 vps digital-ocean capistrano3