[RAILS] Update Ruby in Unicorn environment

I updated ruby from 2.3 to 2.5 in a Rails application using Unicorn and capistrano, so I tried to summarize the procedure.

1. Update rbenv

Install the version of ruby you want to update, and specify the target version with global

$ rbenv install  2.5.8
$ rbenv global 2.5.8

If the version you want to update does not come out with rbenv install --list, Since rbenv install cannot be done, you should be able to install it by updating rbenv by following the steps below.

$ cd ~/.rbenv/plugins/ruby-build
$ git pull

2. Do bundler install and bundle install

Install bundler and other libraries in advance so that bundle install does not work at the time of deployment

# gemfile.Check lock and specify the same version of bundler
$ gem install bundler -v 1.17.3
$ bundle install

3. Deploy

Deploy as usual with capistrano However, at this time, it is necessary to restart to switch the version of ruby, I had to kill unicorn and restart it.

Be careful with types that have preload_app: true set

$ kill -QUIT `cat /path/to/unicorn.pid`
$ bundle exec unicorn_rails -E production -D

Recommended Posts

Update Ruby in Unicorn environment
Class in Ruby
Use selenium (Firefox) in Ruby in WSL environment
Install ruby serial port in WSL environment
Heavy in Ruby! ??
Use selenium (Chrome) in Ruby in WSL environment
About eval in Ruby
Ruby: Update CouchDB data (Update)
Output triangle in Ruby
Variable type in ruby
Fast popcount in Ruby
ABC177 --solving E in Ruby
Validate JWT token in Ruby
Implemented XPath 1.0 parser in Ruby
Read design patterns in Ruby
Rails environment construction Rails5.2.1 ruby2.5.1 Catalina
Write class inheritance in Ruby
Integer unified into Integer in Ruby 2.4
[Ruby] Exception handling in functions
Use ruby variables in javascript.
Multiplication in a Ruby array
About regular expressions in Ruby
JavaFX environment construction in Java 13
Resolve ArgumentError in TasksController # update
Birthday attack calculation in Ruby
Offline environment construction Ruby edition
[Super easy] Ruby environment construction
Judgment of fractions in Ruby
Find Roman numerals in Ruby
Try using gRPC in Ruby
Ruby ① Build a Windows environment
[Ruby] Find numbers in arrays
NCk mod p in Ruby
Chinese Remainder Theorem in Ruby
Install gem in Serverless Framework and AWS Lambda with Ruby environment
From building to deploying Ruby on Jets in docker-compose environment <Part 2>
From building to deploying Ruby on Jets in docker-compose environment <Part 1>
AWS Cloud9 environment construction Update Ruby to the latest stable version
Sorting hashes in a Ruby array
Basics of sending Gmail in Ruby
How to iterate infinitely in Ruby
[Note] Update to production environment [heroku]
Ruby environment construction summary ~ mac version ~
Java Spring environment in vs Code
Achieve 3-digit delimited display in Ruby
Encoding when getting in Windows + Ruby
Create a database in a production environment
Run GraphQL Ruby resolver in parallel
Ruby on Rails Japanese-English support i18n
[Ruby] Extracting double hash in array
[Ruby] then keyword and case in
How to install Bootstrap in Ruby
Ruby on Rails 6.0 environment construction memo
String output method memo in Ruby
Implement a gRPC client in Ruby
Write keys and values in Ruby
Install laravel/Dusk in docker environment (laravel6)
[Super Introduction] About Symbols in Ruby
Hanachan in Ruby (non-destructive array manipulation)
[Note] Update to production environment (heroku)
Manipulating data in GCS during Ruby