[RAILS] [Note] Update to production environment (AWS EC2)


--I'm writing an application in Rails --The initial settings of AWS have been completed, the EC2 instance etc. have been started, and the application has already been deployed. --The automatic deployment settings by Capistrano have been completed.

Purpose of this article

--Since you made changes locally to the created application, you want to reflect the changes in the production environment on AWS. --I always forget how to push AWS EC2, so I want to post it instead of a memorandum


  1. Push local changes to the master branch on github

  2. Log in to EC2


~ % cd .ssh
.ssh % ssh -i example.pem ec2-user@Elastic IP of the application you want to update
  1. Move to the application repository in EC2


[ec2-user@ip-○○○-○○-○○-○○ ~]$ cd /var/www/Application name
  1. Drop the currently running server


[ec2-user@ip-○○○-○○-○○-○○ Repository name]$ ps aux | grep unicorn
「unicorn master -Find the process ID with the letter c "
[ec2-user@ip-○○○-○○-○○-○○ Repository name]$kill process ID
Run exit to log out of your EC2 instance
  1. Perform automatic deployment in the local directory of the application you want to update


Application name% bundle exec cap production deploy
  1. Access from Elastic IP. Check if the changes are reflected

that's all.

Recommended Posts

[Note] Update to production environment (AWS EC2)
[Note] Update to production environment [heroku]
[Note] Update to production environment (heroku)
Memo to build a Servlet environment on AWS EC2
Deploy SpringBoot application to AWS EC2
[Rails] AWS EC2 instance environment construction
[Rails] How to execute "rails db: create" etc. in production environment EC2
How to publish an application using AWS (3) EC2 instance environment construction
AWS Cloud9 environment construction Update Ruby to the latest stable version
How to reflect seeds.rb in production environment
Temporarily move Docker environment from Mac to AWS
How to install Ruby on an EC2 instance on AWS
[Rails] Nginx, Puma environment deployment & server study [AWS EC2]
[Note] Build a Python3 environment with Docker in EC2
Build WordPress environment with Docker (Local) and AWS (Production)
Production environment and credentials.yml.enc
[AWS] Link memory usage of Ubuntu EC2 instance to CloudWatch
How to create an application server on an EC2 instance on AWS
Connect to AWS RDS from your local PC Docker environment