heroku run rails db:migrate?After deploying a Rails app to Heroku, you run heroku run rails db:migrate. What does this command do?
Think about where the app is running and where the database lives on Heroku.
The command heroku run rails db:migrate runs migrations on the Heroku app's production database, updating its schema.
Procfile entry correctly starts a Rails web server on Heroku?You want to tell Heroku how to start your Rails app web server. Which Procfile line is correct?
Heroku assigns a port dynamically. The command must use that port.
The correct Procfile entry uses $PORT so Heroku can assign the port dynamically. It also uses bundle exec rails server to start the server.
PG::ConnectionBad error?You deployed your Rails app to Heroku but get this error in logs: PG::ConnectionBad: could not connect to server. What is the most likely cause?
Heroku uses DATABASE_URL to connect to the database.
The error means the app cannot connect to the Postgres database. Usually, this happens if DATABASE_URL is missing or wrong.
heroku config:set RAILS_ENV=production?You run heroku config:set RAILS_ENV=production on your app. What does this change do?
Environment variables on Heroku control app behavior in the cloud.
Setting RAILS_ENV=production on Heroku tells Rails to run in production mode, which changes logging, caching, and other settings.
Rails uses asset precompilation before deployment. Why is this step necessary on Heroku?
Think about what assets are and how browsers use them.
Precompiling assets creates optimized CSS and JS files that browsers can load quickly, improving app performance on Heroku.