[Ruby] What to do when it is not reflected even after updating after deploying Rails AWS

1 minute read

Introduction

Perhaps many of you may have been struggling to deploy an application that you had to build on AWS.

I also succeeded in deploying on AWS with considerable effort.

···But!

How can I update this when I rewrite the code locally?

Of course it’s Capistrano (I don’t know anything because I haven’t learned it yet) It may be possible to automatically deploy it, but for the time being, I want to update manually (?) instead of automatically.

At the first recognition, I thought that it would be reflected when I logged in to EC2 and git pull in the application repository, but it was not updated.

The result of checking

I looked it up, but I wonder if I’m the only one who isn’t hitting the information I want and is stopping because of this. ? ?

I was a little worried, but I wonder if this is something that I can do around. I was able to find the information.

That was a unicorn restart.

Solution

$ ps -ef | grep unicorn | grep -v grep

Log in to EC2 and check the status of unicorn from the app repository.

hiroaki 6472 1 0 Aug26 ?00:00:02 unicorn_rails master -c /var/www/rails/ride_on/config/unicorn.conf.rb -D -E production
hiroaki 7030 6472 0 Aug26 ?00:00:10 unicorn_rails worker[1] -c /var/www/rails/ride_on/config/unicorn.conf.rb -D -E production
hiroaki 7051 6472 0 Aug26 ?00:00:10 unicorn_rails worker[0] -c /var/www/rails/ride_on/config/unicorn.conf.rb -D -E production

When it is displayed like this, it is started, so Kill the master of unicorn to stop it.

$ kill -9 6472

If you stop it, check with this command, if there is no display it is stopped

$ ps -ef | grep unicorn | grep -v grep

Then start it with this command.

$ bundle exec unicorn_rails -c /var/www/rails/(app name)/config/unicorn.conf.rb -D -E production

When I checked it, the production environment was updated properly!

For the time being, I am relieved that the update has been reflected, but I do not understand AWS yet, so I will study more…