简体   繁体   English

Heroku 部署问题

[英]Heroku deployment issue

I'm following this tutorial, and have followed the steps to deploying to Heroku .我正在学习教程,并按照部署到Heroku的步骤进行操作。

When I open the application from Heroku , this is what I get:当我从Heroku打开应用程序时,这就是我得到的:

Heroku | Heroku | Welcome to your new app!欢迎使用您的新应用!

Why isn't my application showing up?为什么我的应用程序没有出现?

EDIT: This is what I get when I run heroku logs :编辑:这是我运行heroku logs时得到的:

$ heroku logs
←[36m2011-07-29T18:08:11+00:00 heroku[api]:←[0m Add-on add logging:basic by xyz@xyz.com
←[36m2011-07-29T18:08:11+00:00 heroku[api]:←[0m Release v1 created by xyz@xyz.com
←[36m2011-07-29T18:08:13+00:00 heroku[api]:←[0m Add-on update shared-database
←[36m2011-07-29T18:08:13+00:00 heroku[api]:←[0m Release v3 created by xyz@xyz.com
←[33m2011-07-29T18:08:45+00:00 heroku[slugc]:←[0m Slug compilation started
←[36m2011-07-29T18:09:37+00:00 heroku[api]:←[0m Deploy e04b0d1 by xyz@xyz.com
←[36m2011-07-29T18:09:37+00:00 heroku[api]:←[0m Release v4 created by xyz@xyz.com
←[32m2011-07-29T18:09:39+00:00 heroku[web.1]:←[0m State changed from created to
starting
←[33m2011-07-29T18:09:40+00:00 heroku[slugc]:←[0m Slug compilation finished
←[32m2011-07-29T18:09:41+00:00 heroku[web.1]:←[0m Starting process with command
`thin -p 59785 -e production -R /home/heroku_rack/heroku.ru start`
←[32m2011-07-29T18:09:44+00:00 app[web.1]:←[0m >> Maximum connections set to 102
4
←[32m2011-07-29T18:09:44+00:00 app[web.1]:←[0m >> Thin web server (v1.2.6 codena
me Crazy Delicious)
←[32m2011-07-29T18:09:44+00:00 app[web.1]:←[0m >> Listening on 0.0.0.0:59785, CT
RL+C to stop
←[32m2011-07-29T18:09:45+00:00 heroku[web.1]:←[0m State changed from starting to
 up
←[35m2011-07-29T18:10:08+00:00 heroku[rake.1]:←[0m State changed from created to
 starting
←[35m2011-07-29T18:10:10+00:00 app[rake.1]:←[0m Awaiting client
←[35m2011-07-29T18:10:11+00:00 heroku[rake.1]:←[0m State changed from starting t
o up
←[35m2011-07-29T18:10:11+00:00 heroku[rake.1]:←[0m Process exited
←[35m2011-07-29T18:10:12+00:00 heroku[rake.1]:←[0m State changed from up to comp
lete
←[33m2011-07-29T18:13:55+00:00 heroku[slugc]:←[0m Slug compilation started
←[36m2011-07-29T18:14:52+00:00 heroku[api]:←[0m Deploy dbed18f by xyz@xyz.com
←[36m2011-07-29T18:14:52+00:00 heroku[api]:←[0m Release v5 created by xyz@xyz.com
←[32m2011-07-29T18:14:52+00:00 heroku[web.1]:←[0m State changed from up to bounc
ing
←[32m2011-07-29T18:14:52+00:00 heroku[web.1]:←[0m State changed from bouncing to
 created
←[32m2011-07-29T18:14:52+00:00 heroku[web.1]:←[0m State changed from created to
starting
←[33m2011-07-29T18:14:53+00:00 heroku[slugc]:←[0m Slug compilation finished
←[32m2011-07-29T18:14:54+00:00 heroku[web.1]:←[0m Stopping process with SIGTERM
←[32m2011-07-29T18:14:54+00:00 app[web.1]:←[0m >> Stopping ...
←[32m2011-07-29T18:14:55+00:00 heroku[web.1]:←[0m Process exited
←[32m2011-07-29T18:14:55+00:00 heroku[web.1]:←[0m Starting process with command
`thin -p 49961 -e production -R /home/heroku_rack/heroku.ru start`
←[32m2011-07-29T18:14:58+00:00 app[web.1]:←[0m >> Thin web server (v1.2.6 codena
me Crazy Delicious)
←[32m2011-07-29T18:14:58+00:00 app[web.1]:←[0m >> Maximum connections set to 102
4
←[32m2011-07-29T18:14:58+00:00 app[web.1]:←[0m >> Listening on 0.0.0.0:49961, CT
RL+C to stop
←[32m2011-07-29T18:14:59+00:00 heroku[web.1]:←[0m State changed from starting to
 up
←[35m2011-07-29T18:15:21+00:00 heroku[rake.2]:←[0m State changed from created to
 starting
←[35m2011-07-29T18:15:24+00:00 heroku[rake.2]:←[0m State changed from starting t
o up
←[35m2011-07-29T18:15:25+00:00 heroku[rake.2]:←[0m State changed from up to comp
lete
←[32m2011-07-29T18:17:47+00:00 app[web.1]:←[0m
←[32m2011-07-29T18:17:47+00:00 app[web.1]:←[0m
←[32m2011-07-29T18:17:47+00:00 app[web.1]:←[0m Started GET "/use
←[31m←[0m
←[32m2011-07-29T18:17:48+00:00 app[web.1]:←[0m   Processing by UsersController#i
ndex as HTML
←[32m2011-07-29T18:17:48+00:00 app[web.1]:←[0m Completed 500 Internal Server Err
or in 61ms
←[32m2011-07-29T18:17:48+00:00 app[web.1]:←[0m
←[32m2011-07-29T18:17:48+00:00 app[web.1]:←[0m ActiveRecord::StatementInvalid (P
GError: ERROR:  relation "users" does not exist
←[32m2011-07-29T18:17:48+00:00 app[web.1]:←[0m : SELECT "users".* FROM "users"):

←[32m2011-07-29T18:17:48+00:00 app[web.1]:←[0m   app/controllers/users_controlle
r.rb:5:in `index'
←[32m2011-07-29T18:17:48+00:00 app[web.1]:←[0m
←[32m2011-07-29T18:17:48+00:00 app[web.1]:←[0m
←[32m2011-07-29T19:18:57+00:00 heroku[web.1]:←[0m Idling
←[32m2011-07-29T19:18:58+00:00 heroku[web.1]:←[0m State changed from up to down
←[32m2011-07-29T19:18:58+00:00 heroku[web.1]:←[0m Stopping process with SIGTERM
←[32m2011-07-29T19:18:58+00:00 app[web.1]:←[0m >> Stopping ...
←[32m2011-07-29T19:18:59+00:00 heroku[web.1]:←[0m Process exited
←[35m2011-08-02T07:38:42+00:00 heroku[rake.1]:←[0m State changed from created to
 starting
←[35m2011-08-02T07:38:44+00:00 app[rake.1]:←[0m Awaiting client
←[35m2011-08-02T07:38:45+00:00 app[rake.1]:←[0m Starting process with command `r
ake db:migrate`
←[35m2011-08-02T07:38:45+00:00 heroku[rake.1]:←[0m State changed from starting t
o up
←[35m2011-08-02T07:38:45+00:00 heroku[rake.1]:←[0m Process exited
←[35m2011-08-02T07:38:46+00:00 heroku[rake.1]:←[0m State changed from up to comp
lete
←[33m2011-08-02T07:58:10+00:00 heroku[slugc]:←[0m Slug compilation started
←[36m2011-08-02T07:59:08+00:00 heroku[api]:←[0m Deploy e5db406 by xyz@xyz.com
←[36m2011-08-02T07:59:08+00:00 heroku[api]:←[0m Release v6 created by xyz@xyz.com
←[33m2011-08-02T07:59:11+00:00 heroku[slugc]:←[0m Slug compilation finished
←[35m2011-08-02T07:59:44+00:00 heroku[rake.2]:←[0m State changed from created to
 starting
←[35m2011-08-02T07:59:46+00:00 app[rake.2]:←[0m Awaiting client
←[35m2011-08-02T07:59:46+00:00 app[rake.2]:←[0m Starting process with command `r
ake db:migrate`
←[35m2011-08-02T07:59:47+00:00 heroku[rake.2]:←[0m State changed from starting t
o up
←[35m2011-08-02T07:59:48+00:00 heroku[rake.2]:←[0m Process exited
←[35m2011-08-02T07:59:49+00:00 heroku[rake.2]:←[0m State changed from up to comp
lete
←[32m2011-08-02T08:00:27+00:00 heroku[web.1]:←[0m Unidling
←[32m2011-08-02T08:00:27+00:00 heroku[web.1]:←[0m State changed from down to cre
ated
←[32m2011-08-02T08:00:27+00:00 heroku[web.1]:←[0m State changed from created to
starting
←[32m2011-08-02T08:00:29+00:00 heroku[web.1]:←[0m Starting process with command
`thin -p 12972 -e production -R /home/heroku_rack/heroku.ru start`
←[32m2011-08-02T08:00:32+00:00 app[web.1]:←[0m >> Thin web server (v1.2.6 codena
me Crazy Delicious)
←[32m2011-08-02T08:00:32+00:00 app[web.1]:←[0m >> Maximum connections set to 102
4
←[32m2011-08-02T08:00:32+00:00 app[web.1]:←[0m >> Listening on 0.0.0.0:12972, CT
RL+C to stop
←[32m2011-08-02T08:00:32+00:00 heroku[web.1]:←[0m State changed from starting to
 up
←[32m2011-08-02T09:01:44+00:00 heroku[web.1]:←[0m Idling
←[32m2011-08-02T09:01:45+00:00 heroku[web.1]:←[0m State changed from up to down
←[32m2011-08-02T09:01:46+00:00 heroku[web.1]:←[0m Stopping process with SIGTERM
←[32m2011-08-02T09:01:46+00:00 app[web.1]:←[0m >> Stopping ...
←[32m2011-08-02T09:01:46+00:00 heroku[web.1]:←[0m Process exited

Thanks.谢谢。

From the logs it looks like you have not migrated your database, because it is looking for a table users. 从日志看来,您尚未迁移数据库,因为它正在寻找表用户。 To migrate type this in 'heroku rake db:migrate VERSION=0' and then type 'heroku rake db:migrate'. 要进行迁移,请在“ heroku rake db:migrate VERSION = 0”中键入此内容,然后键入“ heroku rake db:migrate”。 Take a look here in heroku docs 在heroku docs中查看这里

http://devcenter.heroku.com/articles/database http://devcenter.heroku.com/articles/database

under the 'Common Issues Migrating to PostgreSQL' section. 在“迁移到PostgreSQL的常见问题”部分中。 Also checkout this 也结帐这个

http://devcenter.heroku.com/articles/using-the-cli http://devcenter.heroku.com/articles/using-the-cli

, for all the commands that you can run from terminal. ,对于您可以从终端运行的所有命令。 Since you are using heroku, try and get your local database to also be postgresql, will solve some minor problems later. 由于您使用的是heroku,请尝试使本地数据库也成为postgresql,稍后将解决一些小问题。 Remember every time that you push files to heroku, you will want to migrate database, if you have changes something in database structure. 请记住,每次将文件推送到heroku时,如果您对数据库结构进行了更改,都将需要迁移数据库。

Abit late, but i encountered this issue. 升技晚了,但是我遇到了这个问题。 I was missing foreman in my gemfile 我的宝石文件中缺少工头

If you're following the railstutorial.org comment out sqlite 3 (#gem 'sqlite3') in the Gemfile 如果您关注railstutorial.org,请在Gemfile中注释sqlite 3(#gem'sqlite3')

then: 然后:

git add .

git commit -am "fix heroku"

git push heroku

You can use: 您可以使用:

heroku logs

to see what is currently happening on the server. 看看服务器上当前正在发生什么。

I think the easiest thing would be to start over. 我认为最简单的方法是重新开始。 Go into the root of your app. 进入您的应用程序的根目录。 Such as myapp and remove the git repo. myapp并删除git repo。

cd sites
cd myApp
git rm -r .git

Then log into Heroku and destroy your app in the CMS. 然后登录Heroku并在CMS中销毁您的应用程序。 After that create a new heroku rails app by going into your directory, creating a new repo, adding your directory, committing as master, creating a heroku app and then pushing to heroku. 之后,通过进入目录,创建新的仓库,添加目录,以主用户身份提交,创建一个heroku应用程序,然后推送到heroku,从而创建一个新的heroku rails应用程序。

git init
git add .
git commit -m 'master'

heroku create
heroku rename myApp
git push heroku master

Then you will need to run your migrations. 然后,您将需要运行迁移。

heroku rake db:migrate

And if you want to push data from your local machine to production you will want to use the taps gem but make sure you add that to your bundle. 如果要将数据从本地计算机推送到生产环境,则需要使用taps gem,但请确保将其添加到捆绑包中。

gem 'taps'

And then run bundle again. 然后再次运行捆绑软件。

bundle

Then you can push your local data if need be. 然后,您可以根据需要推送本地数据。

heroku db:push

Try this, delete your package.json then npm init.试试这个,删除你的 package.json 然后 npm 初始化。 Delete your existing app in Heroku and push back the app with new package.json.在 Heroku 中删除您现有的应用程序,并使用新的 package.json 推回该应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM