ruby on rails

heroku로 배포하기

흰두부1 2020. 11. 10. 12:12

준비

sqlite >postgresql로 바꾸기

 

gemfile로 가서

 

group :development, :test do
  gem 'sqlite3', '~> 1.4'
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end
group :production do
  gem 'pg'
end

로 바꿔주기(global에서 development로 sqlite3 옮기기)

 

$ bundle install --without production

실행해서 gemfile.lock 업데이트하기

 

git add -A
git commit -m "Make app production ready"

 

-

 

heroku 설치(brew)
heroku login
heroku create

*make sure all your code changes are committed by checking git status first*

git push heroku master
heroku rename newnameofyourapp

 

여기까지 과정을 마친 후

newnameofyourapp.herokuapp.com으로 가면 접속 가능하다.