・ Rails 220.127.116.11 ・ Mysql Ver 14.14 Distrib 5.6.47 ・ Osx10.15 ・ Deploy to heroku
This is a response when something goes wrong when creating an app with
Rails and uploading it to
In the development environment,
heroku have DB as
PostgreSQL, so it is necessary to support it.
An error occurred in the middle of the process.
I will write in order.
First, write the following in
Gemfile. It uses
PostgreSQL in a production environment. I wrote at the bottom.
group :production do gem 'pg' end
I changed the Gemfile, so don't forget to do bundle install.
First of all, it was the first error here. If you do
bundle install as it is, an error occurs because there is no
PostgreSQL in your development environment.
Correspondence is to execute the command to skip the place of
group: produciton end in the terminal.
$ bundle install --without production
Put the description to connect to the database to
database.yml in the config folder.
I added it to the bottom.
production: <<: *default adapter: postgresql encoding: unicode pool: 5
That's all for me. The article that was helpful is here! [For beginners] How to reliably deploy rails apps using heroku [Definitive edition] ・ Htps: // Quiita. This m / Kazuki Tsumoto / Te ms / A 0 Da 7281 A 3948701c39
I will omit it here this time. Proceed to the completion of deployment.
heroku run rails db: migrate but an error occurs!
I finally come across this error while looking at various things. .. ..
The following description is in the middle of the terminal.
Caused by: 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"?
The simple thing is that
heroku doesn't include
PostgreSQL by default, so you'll need to add it!
What! !! !! !!
I'm not used to it yet so I didn't notice this simple thing. .. .. ..
Command to add
PostgreSQL in the terminal
$ heroku addons:create heroku-postgresql
$ heroku run rails db:migrate
Then the migration is complete!
I thought something else was wrong and spent hours doing something completely different, but it was simple! The app works and is complete!
[For beginners] How to reliably deploy rails apps using heroku [Definitive edition] ・ Htps: // Quiita. This m / Kazuki Tsumoto / Te ms / A 0 Da 7281 A 3948701c39
[Rails] About the error that occurs when trying to execute "heroku run rake db: migrate" ・ Https://qiita.com/suzuki-x/items/b878723080aea1a673ed