LoginSignup
1
0

More than 3 years have passed since last update.

AWSのEC2インスタンス内(本番環境)の整え方(自動デプロイ後の方法)

Last updated at Posted at 2019-07-22

※全てのコマンドは、本番環境のディレクトリで行うこと。

1.Railsを起動する。

(1).起動方法

ローカル環境でのアプリのディレクトリにおいて、自動デプロイ(Capistranoを使った自動デプロイ)を行う。

 bundle exec cap production deploy

(2).シャットダウン方法

①.起動しているプロセスの確認方法

ps aux | grep unicorn

コマンドを実行すると、unicorn_rails masterと表示されている(unicornの文字の部分は、赤字で表示されている。)行の一番左から、ec2-userの隣に表示されている4桁〜6桁くらい(?)の数字を確認する。
ちなみに、この数字のことをプロセスというらしい。

②.プロセスの切り方

Killコマンドで、上記コマンドで確認したunicorn_rails masterのプロセスを止める。

sudo kill -9  数字(unicorn rails masterのプロセスID)

2.webサーバー(Nginx)を起動する。

webサーバー(Nginx)の再起動

sudo service nginx restart

3.MySQLを起動する。

MySQLの再起動

sudo service mysqld restart
1
0
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
1
0