Rails with Postgresql: Problem running rake db:migrate in production
I have built a rails app on my local machine and would like to deploy it, following the tutorial here: https://www.digitalocean.com/community/tutorials/how-to-launch-your-ruby-on-rails-app-with-the-digitalocean-one-click-image
However, after uploading the whole app through SFTP, creating a postgresql user named ‘postgres’ (I did this to get around the peer authentication error), running the command
RAILS_ENV=production rake db:migrateas the UNIX user postgres gave me the following errors:
Rails Error: Unable to access log file. Please ensure that /home/rails/log/production.log exists and is chmod 0666. The log level has been raised to WARN and the output directed to STDERR until the problem is fixed.
Errno::EACCES: Permission denied - /home/rails/db/schema.rb
I have spent quite a bit of time googling around but no luck. Please help.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.