やったこと
サーバセットアップ
DO は EC2 と違い root を渡してくるので、下記を参考にまずは新規にユーザを作成して root を潰す設定を行った。
これだけだと ssh [email protected]
時にパスワードを聞かれ気持ち悪いので下記を追加で設定した。
/etc/ssh/sshd_config
- PasswordAuthentication yes
+ PasswordAuthentication no
さらに security group 的なものがないので Firewall と NTP までやった。
/etc/sudoers
+ Defaults requiretty
+ Defaults:root !requiretty
Capistrano deploy実行時にでたエラーとその対応
git:check
Permission denied (publickey).
--> GitHubに鍵
deploy:assets:precompile
Could not find a JavaScript runtime
--> gem 'therubyracer'
deploy:migrating
Can't connect to local MySQL server through socket
--> mysql_config --socket
ActiveRecord::NoDatabaseError: Unknown database 'gemba'
--> bundle exec rake db:create
puma:start
Puma starting in single mode...
--> bundle exec cap production puma:config
https://github.com/seuros/capistrano-puma#config