⬆️を写経しようとしたが結構違ってしまった
git設定
$ git config --global user.name "ユーザ名"
$ git config --global user.email メアド
※ postgresql用
$ sudo apt-get install libpq-dev
$ gem i pg
※ postgresのロール追加
$ sudo su - postgres
$ createuser "rails newとかするユーザ名" -d
railsアプリ作成
$ mkdir rails_projects
$ cd rails_projects/
※この手順本当にいるのか不明
$ sudo apt-get install ruby-railties-4.0
$ rails new rails_tutrials -d postgresql
$ cd rails_tutrials
$ git init
$ git add .
$ git commit -m "Initialize repository"
※ログ確認
$ git log
githubにログインして、「rails_tutrials」リポジトリを作成する
$ git remote add origin git@github.com:ユーザ名/rails_tutrials.git
$ git push -u origin master
$ rake db:create
$ rake db:migrate
railsの起動を確認
$ rails s
heroku toolbeltをインストールする
https://toolbelt.heroku.com/
$ wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh
$ heroku login
$ cd ~/rails_projects/rails_tutrials
$ heroku create
$ ssh-keygen -t rsa
/home/ユーザ/.ssh/id_rsa_heroku
$ heroku keys:add ~/.ssh/id_rsa_heroku.pub
herokuに接続するための設定を追加
$vi ~/.ssh/config
Host heroku.com
User git
Hostname heroku.com
IdentityFile ~/.ssh/id_rsa_heroku
herokuデプロイ
$ git push heroku master
heroku停止
$ heroku ps:scale web=0
$ heroku ps:scale worker=0