LoginSignup
42
48

More than 5 years have passed since last update.

Herokuの初期設定方法(ruby on rails)

Last updated at Posted at 2013-07-23

Herokuのサイトでアカウント登録
その後に
gem install heroku
railsでアプリを作成、、、newの後は名前はなんでも可。
rails new UhoUho

Gemfileの修正(herokuにデプロイする際に必要)
gem'sqlite3'の記述の前後で

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

production.rbの修正 (フォルダ構成:config/enviroments/production.rb)

config.assets.compile = false
falseをtrueにかえる
config.assets.compile = true

公開キーの作成、SSHの公開キーを作ってHerokuに登録,安全にデータをやりとりするためにSSHという暗号化通信を行う

> ssh-keygen

色々たずねられるがOverwrite(y/n)?の時だけ「y」と入力.

Herokuを登録

> heroku keys:add

自分の作ったアプリのパスに入って
gitを初期化

> git init

Herokuのアプリケーションの登録,すでに使われている名前だと失敗するので注意

> heroku create 名前

herokuにデプロイ

> git add .
> git commit -m "メッセージ(なんでも適当に)"
> git push heroku master

Herokuでマイグレーション、データベースに反映させないと動かないので忘れずにやる

> heroku run rake db:migrate

Herokuでシード、初期で登録してあるデータを反映させる場合に使う

> heroku run rake db:seed

サイトに接続

> heroku open

サーバーのログを確認する

> heroku logs
42
48
0

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
42
48