1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

rails on heroku Herokuでrails動かすまでにつまづいた点まとめ

Last updated at Posted at 2017-09-12

Herokuでrailsデプロイして動かすまでに参考にした情報と、参考にした情報だけでは足りずにつまづいた箇所をまとめます
【自分がかかった時間】ローカル環境でrails動かすまで3時間 herokuでrails動かすまで更に8時間
【各サイトで醸し出してる必要な時間】15分
全然簡単じゃなかった。っていうか前提とされる知識が自分に足りなすぎた。特にgit

自分の環境
ubuntu

必要なもの ローカル側
rbenv
ruby
ruby on rails
postgresql
git

必要なもの サーバー側
githubアカウント
herokuアカウント

英語読めるならまず参考にした方がいい公式ドキュメント
https://devcenter.heroku.com/articles/getting-started-with-rails5

参考にしたサイト
http://qiita.com/ibara1454/items/40ce2d82926f48cf02bc
https://www.oiax.jp/rails/zakkan/rails_4_2_installation_on_ubunt.html
https://techacademy.jp/magazine/6401#sec3
https://git-scm.com/book/ja/v1/使い始める-Gitのインストール
ハマらなければ上記4サイトでいけると思います。ただし、後述の.git/configの書き換えと、config/database.ymlの設定のコピペでハマらなければ。この2点にみんなハマると思う。

参考にしたサイトでつまづいた箇所を補足するサイト
https://git-scm.com/book/ja/v1/使い始める-Gitのインストール
http://qiita.com/yyyske/items/e0c2bb615daa323cfd90
http://qiita.com/konweb/items/621722f67fdd8f86a017
http://qiita.com/ay3/items/8d758ebde41d256a32dc
http://qiita.com/s-kiriki/items/3f9b1926d85aaa65c694
http://d.hatena.ne.jp/wats/20100915/1284478558
http://tetsuwo.tumblr.com/post/49687103213/heroku-push-fatal-heroku-does-not-appear
http://qiita.com/yyyske/items/e0c2bb615daa323cfd90
http://tweeeety.hateblo.jp/entry/2016/02/10/000712
http://qiita.com/RyochanUedasan/items/d447cbf2733e389994bb

必須ではないが推奨のサイト
http://fiveteesixone.lackland.io/2015/01/27/migrate-from-unicorn-to-puma-on-heroku/

つまづいたところ
gitの使い方が全然わからなかった(上記補足するサイトで補完OK。時間はかかるけどgitある程度知らないとどうにもならない)
.git/configの[remote "origin"]を[remote "heroku"]に書き換えないと動かないことに気づかなかった。っていうか参考サイトにはそのことは載ってなかった
config/database.ymlの設定が https://techacademy.jp/magazine/6401#sec3 の、データベースの設定の項目のサンプルをコピペしても動かない
動かないというのは具体的には(サイトに書いてあるやつコピペの動かない方は)
production:
半角空白1文字<<: *default
半角空白1文字adapter: postgresql
半角空白1文字encoding: unicode
半角空白1文字pool: 5
だと動かない。
production:
半角空白2文字<<: *default
半角空白2文字adapter: postgresql
半角空白2文字encoding: unicode
半角空白2文字pool: 5
だと動く。
要は参考にしたサイトに載ってるconfig/database.ymlのコピペのままだと、行頭が半角空白1文字だから動かねーっていうのでハマった
そのあとさらにgitでpushの仕方が分からなくてハマった(addしてpushしなきゃいけないのを、pushさえすればリモートリポジトリに追加されると思ってheroku側のconfig/database.ymlの書き換えができなかった)

以上です。
herokuでrails動かそうとして動かなかった人たちの参考になれば嬉しいです。

1
2
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?