繁体   English   中英

将应用程序部署到Heroku时出错:Railsbridge Installfest-部署Rails应用程序

[英]Error When Deploying App to Heroku: Railsbridge Installfest—Deploy a Rails App

我正在执行railsbridge installfest (作为Odin项目的一部分),并且在最后阶段遇到了问题:“部署Rails应用程序”。 我从终端获得了很多意外的结果,当我导航到教程末尾的heroku应用程序的网址时,我得到了:

“您要查找的页面不存在。您可能输入了错误的地址或页面已移动。如果您是应用程序所有者,请检查日志以获取更多信息。”

我将Ubuntu 16.04 LTS作为VM在Windows 10上运行。我尝试删除在教程中创建的test_app(在线和关闭)并重新启动,并且尝试重新启动VM,然后再次启动,但没有运气。 我也在这个网站上寻找了类似问题的人,但是找不到任何等效的错误消息。

在出现这些问题之前,本教程让我创建了一个Rails服务器,该服务器的功能完全符合我的要求。 仅当我尝试将应用程序部署到heroku时,问题才开始出现。

我已经涵盖了我经历的所有阶段。 如果预期的命令行结果(在本教程中指定)与我的实际结果有所不同,则我将两者都包括在内,并标记为差异。 我没有包含预期的命令行结果-在没有我添加所有内容的情况下,这个问题已经足够长了! 如果您需要该信息以帮助我,我已将其保存下来,所以请告诉我。

道歉,如果我错过了一些东西很明显,我是完全新的编码。

我执行(在终端):

git init
git add -A
git commit -m "initial commit"
git log
heroku create

第一个差异:

预期的代码:

Enter your Heroku credentials.
Email: myemail@example.com
Password:
Uploading ssh public key /Users/smei/.ssh/id_rsa.pub
Creating floating-winter-18... done, stack is cedar
http://floating-winter-18.heroku.com/ | git@heroku.com:floating-winter-18.git
Git remote heroku added

实际代码:

Creating app... done, ⬢ tranquil-beyond-97147
https://tranquil-beyond-97147.herokuapp.com/ | https://git.heroku.com/tranquil-beyond-97147.git

然后我从〜/ railsbridge / test_app / Gemfile中更改了一行

gem 'sqlite3'

group :development, :test do
  gem 'sqlite3'
end

group :production do
  gem 'pg'
end

然后(再次在终端中)执行:

gem install bundler
bundle install --without production

然后我在〜/ railsbridge / test_app / config / routes.rb中的Rails.application.routes.draw行下面添加了一行:

行添加:

root 'drinks#index'

然后(在终端中)我执行了:

git add .
git commit -m "Updates for heroku deployment"
git push heroku master

第二个差异:

预期代码:

The authenticity of host 'heroku.com (75.101.145.87)' can't be established.
RSA key fingerprint is 8b:48:5e:67:0e:c9:16:47:32:f2:87:0c:1f:c8:60:ad.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'heroku.com,75.101.145.87' (RSA) to the list of known hosts.
Counting objects: 60, done.
Compressing objects: 100% (54/54), done.
Writing objects: 100% (60/60), 79.03 KiB, done.
Total 60 (delta 10), reused 0 (delta 0)

-----> Heroku receiving push
-----> Rails app detected
       Compiled slug size is 080K
-----> Launching...... done
       App deployed to Heroku

To git@heroku.com:floating-winter-18.git
 * [new branch]      master -> master

实际代码:

Counting objects: 114, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (100/100), done.
Writing objects: 100% (114/114), 25.05 KiB | 0 bytes/s, done.
Total 114 (delta 7), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.2.4
remote: -----> Installing dependencies using bundler 1.11.2
remote:        Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote:        Warning: the running version of Bundler is older than the version that created the lockfile. We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
remote:        Fetching gem metadata from https://rubygems.org/..........
remote:        Fetching version metadata from https://rubygems.org/...
remote:        Fetching dependency metadata from https://rubygems.org/..
remote:        Installing i18n 0.7.0
remote:        Installing concurrent-ruby 1.0.2
remote:        Installing rake 11.3.0
remote:        Installing minitest 5.9.1
remote:        Installing builder 3.2.2
remote:        Installing thread_safe 0.3.5
remote:        Installing mini_portile2 2.1.0
remote:        Installing erubis 2.7.0
remote:        Installing rack 2.0.1
remote:        Installing nio4r 1.2.1 with native extensions
remote:        Installing websocket-extensions 0.1.2
remote:        Installing mime-types-data 3.2016.0521
remote:        Installing arel 7.1.4
remote:        Installing coffee-script-source 1.10.0
remote:        Installing execjs 2.7.0
remote:        Installing thor 0.19.1
remote:        Installing multi_json 1.12.1
remote:        Installing pg 0.19.0 with native extensions
remote:        Installing method_source 0.8.2
remote:        Installing puma 3.6.0 with native extensions
remote:        Using bundler 1.11.2
remote:        Installing sass 3.4.22
remote:        Installing tilt 2.0.5
remote:        Installing turbolinks-source 5.0.0
remote:        Installing nokogiri 1.6.8.1 with native extensions
remote:        Installing tzinfo 1.2.2
remote:        Installing websocket-driver 0.6.4 with native extensions
remote:        Installing rack-test 0.6.3
remote:        Installing sprockets 3.7.0
remote:        Installing mime-types 3.1
remote:        Installing coffee-script 2.4.1
remote:        Installing uglifier 3.0.2
remote:        Installing turbolinks 5.0.1
remote:        Installing activesupport 5.0.0.1
remote:        Installing mail 2.6.4
remote:        Installing globalid 0.3.7
remote:        Installing activemodel 5.0.0.1
remote:        Installing jbuilder 2.6.0
remote:        Installing activejob 5.0.0.1
remote:        Installing activerecord 5.0.0.1
remote:        Installing loofah 2.0.3
remote:        Installing rails-html-sanitizer 1.0.3
remote:        Installing rails-dom-testing 2.0.1
remote:        Installing actionview 5.0.0.1
remote:        Installing actionpack 5.0.0.1
remote:        Installing actionmailer 5.0.0.1
remote:        Installing actioncable 5.0.0.1
remote:        Installing railties 5.0.0.1
remote:        Installing sprockets-rails 3.2.0
remote:        Installing coffee-rails 4.2.1
remote:        Installing rails 5.0.0.1
remote:        Installing jquery-rails 4.2.1
remote:        Installing sass-rails 5.0.6
remote:        Bundle complete! 16 Gemfile dependencies, 53 gems now installed.
remote:        Gems in the groups development and test were not installed.
remote:        Bundled gems are installed into ./vendor/bundle.
remote:        Bundle completed (25.91s)
remote:        Cleaning up the bundler cache.
remote: -----> Preparing app for Rails asset pipeline
remote:        Running: rake assets:precompile
remote:        I, [2016-10-16T22:14:51.182054 #1022]  INFO -- : Writing /tmp/build_eaa9178115288d749f254409ffd66e9f/public/assets/application-ea005870b2299ed0464e134ab4079aa8856885e9ffd3d81e60417322f2fa0a97.js
remote:        I, [2016-10-16T22:14:51.202261 #1022]  INFO -- : Writing /tmp/build_eaa9178115288d749f254409ffd66e9f/public/assets/application-ea005870b2299ed0464e134ab4079aa8856885e9ffd3d81e60417322f2fa0a97.js.gz
remote:        I, [2016-10-16T22:14:51.252933 #1022]  INFO -- : Writing /tmp/build_eaa9178115288d749f254409ffd66e9f/public/assets/application-d12397cbc3a266ce5a99f7b588223090c55ca04a439953bb5f9304395de93fc3.css
remote:        I, [2016-10-16T22:14:51.253116 #1022]  INFO -- : Writing /tmp/build_eaa9178115288d749f254409ffd66e9f/public/assets/application-d12397cbc3a266ce5a99f7b588223090c55ca04a439953bb5f9304395de93fc3.css.gz
remote:        Asset precompilation completed (3.83s)
remote:        Cleaning assets
remote:        Running: rake assets:clean
remote: 
remote: ###### WARNING:
remote:        You have not declared a Ruby version in your Gemfile.
remote:        To set your Ruby version add this line to your Gemfile:
remote:        ruby '2.2.4'
remote:        # See https://devcenter.heroku.com/articles/ruby-versions for more information.
remote: 
remote: ###### WARNING:
remote:        No Procfile detected, using the default web server.
remote:        We recommend explicitly declaring how to boot your server process via a Procfile.
remote:        https://devcenter.heroku.com/articles/ruby-default-web-server
remote: 
remote: -----> Discovering process types
remote:        Procfile declares types     -> (none)
remote:        Default types for buildpack -> console, rake, web, worker
remote: 
remote: -----> Compressing...
remote:        Done: 27.9M
remote: -----> Launching...
remote:        Released v5
remote:        https://tranquil-beyond-97147.herokuapp.com/ deployed to Heroku
remote: 
remote: Verifying deploy... done.
To https://git.heroku.com/tranquil-beyond-97147.git
 * [new branch]      master -> master

最后,我进入

heroku run rake db:migrate

第三差异:

预期代码:

Migrating to CreateDrinks (20160706063236)
==  20160706063236 CreateDrinks: migrating =====================================
-- create_table(:drinks)
   -> 0.0084s
==  20160706063236 CreateDrinks: migrated (0.0085s) ============================

实际代码:

Running rake db:migrate on ⬢ tranquil-beyond-97147... up, run.1313 (Free)
D, [2016-10-16T22:16:19.568857 #3] DEBUG -- :    (12.1ms)  CREATE TABLE "schema_migrations" ("version" character varying PRIMARY KEY)
D, [2016-10-16T22:16:19.582446 #3] DEBUG -- :    (7.5ms)  CREATE TABLE "ar_internal_metadata" ("key" character varying PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
D, [2016-10-16T22:16:19.586398 #3] DEBUG -- :    (1.8ms)  SELECT pg_try_advisory_lock(4170385879066863015);
D, [2016-10-16T22:16:19.598567 #3] DEBUG -- :   ActiveRecord::SchemaMigration Load (1.9ms)  SELECT "schema_migrations".* FROM "schema_migrations"
I, [2016-10-16T22:16:19.604863 #3]  INFO -- : Migrating to CreateDrinks (20161016221052)
D, [2016-10-16T22:16:19.607807 #3] DEBUG -- :    (1.8ms)  BEGIN
== 20161016221052 CreateDrinks: migrating =====================================
-- create_table(:drinks)
D, [2016-10-16T22:16:19.615754 #3] DEBUG -- :    (7.0ms)  CREATE TABLE "drinks" ("id" serial primary key, "name" character varying, "temperature" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
   -> 0.0078s
== 20161016221052 CreateDrinks: migrated (0.0079s) ============================

D, [2016-10-16T22:16:19.623202 #3] DEBUG -- :   SQL (1.9ms)  INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version"  [["version", "20161016221052"]]
D, [2016-10-16T22:16:19.627228 #3] DEBUG -- :    (3.8ms)  COMMIT
D, [2016-10-16T22:16:19.637096 #3] DEBUG -- :   ActiveRecord::InternalMetadata Load (1.8ms)  SELECT  "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2  [["key", :environment], ["LIMIT", 1]]
D, [2016-10-16T22:16:19.644393 #3] DEBUG -- :    (1.6ms)  BEGIN
D, [2016-10-16T22:16:19.647314 #3] DEBUG -- :   SQL (1.9ms)  INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key"  [["key", "environment"], ["value", "production"], ["created_at", 2016-10-16 22:16:19 UTC], ["updated_at", 2016-10-16 22:16:19 UTC]]
D, [2016-10-16T22:16:19.649903 #3] DEBUG -- :    (2.4ms)  COMMIT
D, [2016-10-16T22:16:19.651778 #3] DEBUG -- :    (1.7ms)  SELECT pg_advisory_unlock(4170385879066863015)

我希望我已尽可能清楚地说明了这一点,并在此先感谢您能提供的任何帮助。

我要说的是,您应该检查tranquil-beyond-97147.herokuapp.com ,因为那是Heroku为您创建的应用程序的名称。 如果未通过,则应运行heroku logs并粘贴内容,错误原因始终在日志中。

暂无
暂无

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

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