`
bellstar
  • 浏览: 148164 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

在heroku上部署sinatra应用

    博客分类:
  • ruby
 
阅读更多
本文假定你已经拥有了heroku账号和成功安装heroku toolbelt。如果你还没有这么做,可以看这里https://devcenter.heroku.com/articles/quickstart

  1. https://dashboard.heroku.com/apps页面中选择Create a new app  
  2. 输入app的名字,完成创建

  3. clone项目git clone git@heroku.com:appname.git -o heroku
  4. 创建Gemfile
    
    source "https://rubygems.org"
    ruby "1.9.3"
    gem 'sinatra', '1.4.4'
    
    
  5. 创建web.rb作为web服务启动文件
    
    require "sinatra"
    
    get "/:name.html" do
      erb params[:name].to_sym
    end
    
    
  6. 创建Procfile,foreman这个gem要用它作为配置,heroku通过foreman启动web服务
    web: bundle exec ruby web.rb -p $PORT
    
  7. 创建app需要的其他文件
  8. 添加文件到git中:git add . -m "add all"
  9. 登录heroku:heroku login
  10. 发布git push heroku master
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics