我正在尝试将项目部署到aws。键入eb create appname
后,我在日志中收到以下错误消息。
intializing git
rake aborted!
PG::ConnectionBad: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
我的宝石文件
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.0', '>= 5.0.0.1'
# sqlite3 fails on heroku
# group :development do
# gem 'sqlite3' #gem to use in development environment
# end
# gem 'sqlite3'
# group :production do
gem 'pg', '~> 0.20.0' #gem to use in production environment
# end
gem 'will_paginate', '~> 3.1.0'
gem 'simple_form'
gem 'bootstrap-sass'
gem 'devise'
gem 'nested_scaffold'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platform: :mri
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'activeadmin'
database.yml
development:
adapter: postgresql
host: localhost
username: jusi
database: odpdev
production:
adapter: postgresql
encoding: utf8
database: <%= ENV['RDS_DB_NAME'] %>
username: <%= ENV['RDS_USERNAME'] %>
password: "<%= ENV['RDS_PASSWORD'] %>"
host: <%= ENV['RDS_HOSTNAME'] %>
port: <%= ENV['RDS_PORT'] %>
任何人都可以进行故障排除。当我对ash SSH并输入psql
时,会收到相同的错误消息。 which postgres
/ usr / bin / where:(/home/ec2-user/.gem/ruby/2.6.3/bin:/opt/rubies/ruby-2.6.3/lib/ruby/gems/2.6中没有postgres .0 / bin:/opt/rubies/ruby-2.6.3/bin:/ usr / local / bin:/ bin:/ usr / bin:/ usr / local / sbin:/ usr / sbin:/ sbin:/ opt /aws/bin:/home/ec2-user/.local/bin:/home/ec2-user/bin)