部署 怎么部署到已经有的 heroku repo?(重复使用免费的 heroku 空间)

cqcn1991 · 2015年05月22日 · 最后由 JulietteDerrig 回复于 2022年09月14日 · 2492 次阅读

因为没有钱的缘故,一直都是使用的 heroku 的免费空间 不过 heroku 的免费空间是有限的,所以有时候就把以前的 demo 给推了,把新的 demo 放上去,这里就是讲的这个意思 步骤如下: 1.heroku git:remote -a falling-wind-1624 https://devcenter.heroku.com/articles/git 就是把已经有的 repo 加入到新的 repo 的 git push 列表中

2.heroku buildpacks:set https://github.com/heroku/heroku-buildpack-ruby https://devcenter.heroku.com/articles/buildpacks#default-buildpacks 可能会碰到 Buildpack 报错的问题,手动设置一下即可

3.git push -f heroku master 直接-f push,推掉以前的代码

4.heroku pg:reset DATABASE && migrate http://stackoverflow.com/questions/6906715/clearing-rails-app-database-on-heroku-production-site 然后删除以前的数据库,并且重新 migrate

5.rename the app http://stackoverflow.com/questions/14161098/whats-the-correct-way-to-rename-a-heroku-app 最后,把名字改了呗~

最后注意一下,本地可能用的 gemfile 的 source 是淘宝的,Push 到 heroku 的话,最好能改成 rubygem 的

source 'https://rubygems.org' # for heroku
# source 'http://ruby.taobao.org/'  # local development

删了再创建不就行了。

PS:有必要设置 Buildpack 吗?

#1 楼 @rei 哈哈,因为我之前创建的超过了 5 个。删了就木有了哈哈哈哈哈

heroku 的 free tier 很快就不能长开了

I can understand your problem because I have faced this problem. It is not the only problem that Heroku confers limited resources when you use its free tier but it also becomes very costly when you transfer your app from its freemium to a premium version. It becomes a very annoying situation for developers. To avoid this problem, I am considering Heroku alternatives from here and probably, I would like to go with Dokku with great customized plugins. By the way, DigitalOcean is also a very affordable platform itself.

I also heard a lot about Northflank and usually, developers consider it a workable option for Ruby projects. I think you should also give it a chance. You can also include OpenShift in your list because of its good reviews.

需要 登录 后方可回复, 如果你还没有账号请 注册新账号