在heroku上部署sinatra应用
本文假定你已经拥有了heroku账号和成功安装heroku toolbelt。如果你还没有这么做,可以看这里https://devcenter.heroku.com/articles/quickstart
-
在https://dashboard.heroku.com/apps页面中选择Create a new app
-
输入app的名字,完成创建
-
clone项目git clone
git@heroku.com:appname.git-o heroku -
创建Gemfile
source "https://rubygems.org" ruby "1.9.3" gem 'sinatra', '1.4.4' -
创建web.rb作为web服务启动文件
require "sinatra" get "/:name.html" do erb params[:name].to_sym end -
创建Procfile,foreman这个gem要用它作为配置,heroku通过foreman启动web服务
web: bundle exec ruby web.rb -p $PORT -
创建app需要的其他文件
-
添加文件到git中:git add . -m "add all"
-
登录heroku:heroku login
-
发布git push heroku master