zoukankan      html  css  js  c++  java
  • Deploy One Project on Heroku (Week IV)

    Advanced Software Engineering

    1.运行如下命令,下载一个项目,这个项目是课堂内部的项目,下载需要密码,所以暂时先不把密码放出来。这一步随便下载一个项目就可以。

    git clone http://cgao_rottenpotatoes-rails-intro@reposi tory.trustie.net/cgao/rottenpotatoes-rails-intro.git

    2.在本地bundle install 这个项目,运行如下命令

    bundle install

    在执行上述命令过程中,可能会出现que少依赖包的情况,问题可以参照我的上一篇blog(#Some Problems about Gem#)。成功之后,如下所示:

    3.接下来先在本地进行部署

    (1)迁移数据库

    rake db:migrate

    运行如下:

    (2)再执行

    rake db:seed

    如下:

    (3)之后,启动本地服务器

    rails s

    如下:

    (4)可以现在本地查看(http://127.0.0.1:3000),默认端口3000,也可能会发生变化,根据服务器启动提示信息来定

    4.接下来在hero进行部署

    (1)创建rsa密钥

    ssh-keygen -t rsa

    选择默认路径即可,然后根据提示输入两遍密码:

    (2)登录heroku账号

     heroku lgin

    根据提示输入用户名和密码:

    (3)为项目添加密钥

    heroku keys:add

    可能之前已经存在其他的密钥,根据提示选择需要使用的密钥即可:

    (4)使用命令创建项目git:

    heroku create

    如下:

    (5)push项目到heroku上

    git push heroku master

    如下:

    PS:

    最后的提示信息中“vast-sea-3454”即是刚创建添加的app名称

    (6)迁移远程heroku数据库

    1 heroku run rake db:migrate --app  vast-sea-3454

    如下:

    (7)执行如下命令:

    1 heroku run rake db:seed --app vast-sea-3454

    如下:

    (8)运行打开

    1 heroku open

    如下:

    (9)浏览器打开“https://vast-sea-3454.herokuapp.com

    至此,完成。

    即使关闭终端,依旧可以根据“https://vast-sea-3454.herokuapp.com”进行访问

  • 相关阅读:
    周末之个人杂想(十三)
    PowerTip of the DaySorting Multiple Properties
    PowerTip of the DayCreate Remoting Solutions
    PowerTip of the DayAdd Help to Your Functions
    PowerTip of the DayAcessing Function Parameters by Type
    PowerTip of the DayReplace Text in Files
    PowerTip of the DayAdding Extra Information
    PowerTip of the DayPrinting Results
    Win7下IIS 7.5配置SSAS(2008)远程访问
    PowerTip of the DayOpening Current Folder in Explorer
  • 原文地址:https://www.cnblogs.com/moonseazj/p/4912230.html
Copyright © 2011-2022 走看看