1, Purpose: Use Heroku to deploy the development environment to the production environment. Heroku is dedicated to deploying rails and other Web applications, and the process of deploying rails applications is straightforward-as long as the source code is incorporated into the GIT version control system.
2. Build Heroku Deployment Environment
(1) Heroku use PostgreSQL database, so to add PG to the production group, so that rails can communicate with PostgreSQL, at the end of the Gemfile file, add the following code:
' PG ' ' 0.17.1 ' 'rails_12factor'0.0.2'end
(2) Run the Bundle install command and specify the--without producttion option to prohibit local installation of gems (i.e. PG and rails_12factor) used in the production environment
$ bundle Install--without production
$ git commit-a-M "Update Gemfile.lock for Heroku"
(3) Register and configure Heroku account
Heroku Website: https://signup.heroku.com
(4) Check if the system has Heroku installed
$ Heroku Version
(5) Log in using the Heroku command and then add the SSH key
$ Heroku Login #要求输入Heroku注册是用的邮箱和密码
$ Heroku Keys:add
(6) Create a new application in Heroku
$ Heroku Create #结果中的网址即访问个人项目的网址
(7) Use Git to push the main branch to Heroku:
$ git push Heroku Master
Deployment Success!
Ruby on Rails Tutorial the first chapter of Heroku deployment