我已经在我的网站中设置了Capistrano部署,我正在尝试部署到临时服务器。该服务器是一个CentoOS 6服务器,其中包含nginx和乘客。
一切都运行正常,但是当我执行' cap staging deploy'时会出现此错误:
rake aborted!
DEBUG [3489dd68] PG::ConnectionBad: FATAL: Ident authentication failed for user "postgres"
在我的/var/lib/pgsql/data/pg_hba.conf中,我有以下设置:
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all ident
local all postgres md5
local all popup md5
local all root md5
# IPv4 local connections:
host all all 127.0.0.1/32 ident
# IPv6 local connections:
host all all ::1/128 ident
然后在我的config / database.yml文件中我得到了这个:
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
staging:
adapter: postgresql
database: popuphub_staging
username: postgres
password: r00t2xtry
host: localhost
production:
adapter: postgresql
database: popup_production
username: forge
password: 7PoXsewpEiR8xcTityaecZczUWxAag
host: localhost
我查看了deploy.rb文件,一切正常。
lock '3.1.0'
server "0.0.0.0"
set :application, "PopupHub"
set :scm, "git"
set :repo_url, "git@another-repo-url-here.git"
# set :scm_passphrase, ""
# set :user, "deploy"
# files we want symlinking to specific entries in shared.
set :linked_files, %w{config/database.yml}
# dirs we want symlinking to shared
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
SSHKit.config.command_map[:rake] = "bundle exec rake"
SSHKit.config.command_map[:rails] = "bundle exec rails"
#default_environment["RAILS_ENV"] = 'current'
set :branch, ENV["REVISION"] || ENV["BRANCH_NAME"] || "master"
set :keep_releases, 20
namespace :deploy do
desc 'Restart passenger without service interruption (keep requests in a queue while restarting)'
task :restart do
on roles(:app) do
execute :touch, release_path.join('tmp/restart.txt')
unless execute :curl, '-s -k --location localhost | grep "Pop" > /dev/null'
exit 1
end
end
end
after :finishing, "deploy:cleanup"
after :finishing, "deploy:sitemap:refresh"
end
after "deploy", "deploy:migrate"
after 'deploy:publishing', 'deploy:restart'
我猜测根服务器中的postgresql存在更深层次的问题,但我正在努力解决这个问题。
我想我需要一点方向。