初めてRuby on Railsのアプリをデプロイしようとしている初心者で恐縮ですが、非常に困っています。
デプロイ時、コマンドでheroku run rake db:migrateを叩いても何も起こりません。
原因が分かる方おられましたら、よろしくお願いします。
データベースはMySQLを使おうとしています。
以下、ここまでの流れです。
1.Herokuにログイン
$ heroku login
2.Gemfileに以下を記述
Gemfile group :production, :staging do gem 'rails_12factor' end
$ bundle install
3.デプロイ
$ git init Reinitialized existing Git repository in /Users/ユーザー名/projects/アプリ名/.git/ $ git add . $ git commit -m "init commit" $ heroku create Creating app... done, ⬢ アプリ名 https://アプリ名.herokuapp.com/ | https://git.heroku.com/アプリ名.git
4.データベースをMySQLに変更
$ heroku addons:add cleardb Creating cleardb on ⬢ アプリ名... free Created cleardb-アプリ名 as CLEARDB_DATABASE_URL Use heroku addons:docs cleardb to view documentation
Gemfileの確認
gem 'mysql2', '0.3.18'
$ heroku config | grep CLEARDB_DATABASE_URL CLEARDB_DATABASE_URL: mysql://b1efe712be_______________________38710?reconnect=true
mysqlの部分をmysql2に変更
$ heroku config:set DATABASE_URL=mysql2://b1efe712be_______________________38710?reconnect=true Setting DATABASE_URL and restarting ⬢ アプリ名... done, v4 DATABASE_URL: mysql2://b1efe712be_______________________38710?reconnect=true
5.プッシュ
$ git push heroku master Counting objects: 63, done. Delta compression using up to 4 threads. Compressing objects: 100% (52/52), done. Writing objects: 100% (63/63), 16.63 KiB | 0 bytes/s, done. Total 63 (delta 2), 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.6 remote: -----> Installing dependencies using bundler 1.13.6 remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment 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 rake 11.3.0 remote: Installing json 1.8.3 with native extensions remote: Installing minitest 5.9.1 remote: Installing thread_safe 0.3.5 remote: Installing builder 3.2.2 remote: Installing mini_portile2 2.1.0 remote: Installing erubis 2.7.0 remote: Installing rack 1.6.4 remote: Installing arel 6.0.3 remote: Installing mime-types-data 3.2016.0521 remote: Installing coffee-script-source 1.10.0 remote: Installing execjs 2.7.0 remote: Installing thor 0.19.1 remote: Installing concurrent-ruby 1.0.2 remote: Installing multi_json 1.12.1 remote: Installing mysql2 0.4.4 with native extensions remote: Using bundler 1.13.6 remote: Installing sass 3.4.22 remote: Installing tilt 2.0.5 remote: Installing turbolinks-source 5.0.0 remote: Installing tzinfo 1.2.2 remote: Installing nokogiri 1.6.8.1 with native extensions remote: Installing rack-test 0.6.3 remote: Installing mime-types 3.1 remote: Installing coffee-script 2.4.1 remote: Installing uglifier 3.0.2 remote: Installing sprockets 3.7.0 remote: Installing turbolinks 5.0.1 remote: Installing mail 2.6.4 remote: Installing loofah 2.0.3 remote: Installing rails-html-sanitizer 1.0.3 remote: Installing activesupport 4.2.6 remote: Installing rdoc 4.2.2 remote: Installing globalid 0.3.7 remote: Installing rails-deprecated_sanitizer 1.0.3 remote: Installing jbuilder 2.6.0 remote: Installing activemodel 4.2.6 remote: Installing activejob 4.2.6 remote: Installing rails-dom-testing 1.0.7 remote: Installing actionview 4.2.6 remote: Installing activerecord 4.2.6 remote: Installing sdoc 0.4.1 remote: Installing actionpack 4.2.6 remote: Installing sprockets-rails 3.2.0 remote: Installing actionmailer 4.2.6 remote: Installing railties 4.2.6 remote: Installing coffee-rails 4.1.1 remote: Installing sass-rails 5.0.6 remote: Installing jquery-rails 4.2.1 remote: Installing rails 4.2.6 remote: Bundle complete! 12 Gemfile dependencies, 51 gems now installed. remote: Gems in the groups development and test were not installed. remote: Bundled gems are installed into ./vendor/bundle. remote: Post-install message from rdoc: remote: Depending on your version of ruby, you may need to install ruby rdoc/ri data: remote: <= 1.8.6 : unsupported remote: = 1.8.7 : gem install rdoc-data; rdoc-data --install remote: = 1.9.1 : gem install rdoc-data; rdoc-data --install remote: >= 1.9.2 : nothing to do! Yay! remote: Bundle completed (17.92s) remote: Cleaning up the bundler cache. remote: -----> Detecting rake tasks remote: -----> Preparing app for Rails asset pipeline remote: Running: rake assets:precompile remote: I, [2017-01-12T07:01:16.128127 #1458] INFO -- : Writing /tmp/build_aeb544f43777234f90021912454f70e5/public/assets/application-b57b3bdfe72296fe43304d7dcc0d525ba53322bda7a2be20284f11d266ddd7ba.js remote: I, [2017-01-12T07:01:16.129201 #1458] INFO -- : Writing /tmp/build_aeb544f43777234f90021912454f70e5/public/assets/application-b57b3bdfe72296fe43304d7dcc0d525ba53322bda7a2be20284f11d266ddd7ba.js.gz remote: I, [2017-01-12T07:01:16.137814 #1458] INFO -- : Writing /tmp/build_aeb544f43777234f90021912454f70e5/public/assets/application-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.css remote: I, [2017-01-12T07:01:16.138279 #1458] INFO -- : Writing /tmp/build_aeb544f43777234f90021912454f70e5/public/assets/application-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.css.gz remote: Asset precompilation completed (3.82s) remote: Cleaning assets remote: Running: rake assets:clean remote: remote: ###### WARNING: remote: Include 'rails_12factor' gem to enable all platform features remote: See https://devcenter.heroku.com/articles/rails-integration-gems for more information. 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.6' 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: 29M remote: -----> Launching... remote: Released v7 remote: https://アプリ名.herokuapp.com/ deployed to Heroku remote: remote: Verifying deploy... done. To https://git.heroku.com/アプリ名.git * [new branch] master -> master
最後に heroku run rake db:migrate(何も起こりません...)
$ heroku run rake db:migrate Running rake db:migrate on ⬢ アプリ名... up, run.4583 (Free) #エラーメッセージも何も表示されず終わってしまいます。 $
$ heroku open でアクセスすると
The page you were looking for doesn't exist. You may have mistyped the address or the page may have moved.
と表示されています。
データベースを覗いてみても、何もテーブルが読み込まれていません。
長文で申し訳有りませんが、エラー解決に役立つことがあればご教授ください。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。