LoginSignup
0
0

More than 3 years have passed since last update.

Unicorn環境でRubyをアップデートする

Posted at

Unicorn と capistrano を使った Railsアプリケーション で ruby を 2.3 から2.5にアップデートしたので、
その手順をまとめてみました。

1. rbenv の更新

updateしたい対象のrubyのバージョンをinstall し、global で対象のバージョンを指定しておく

$ rbenv install  2.5.8
$ rbenv global 2.5.8

rbenv install --list でアップデートしたい対象のバージョンが出てこない時は、
rbenv install ができないので、下記の手順でrbenvを更新すると、installできるはずです。

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

2. bundler の install と bundle install をしておく

デプロイ時に bundle install でこけないように予め bundler と 他のライブラリを install しておく

# gemfile.lock を確認して、同じ version の bundler を指定する
$ gem install bundler -v 1.17.3
$ bundle install

3. デプロイ

capistrano で通常通りデプロイする
しかし、この時必要なのが、 ruby のバージョンを切り替えるには、再起動が必要であり、
一度 unicorn を kill して立ち上げ直す必要があった。

preload_app: true の設定をしている型は注意が必要です

$ kill -QUIT `cat /path/to/unicorn.pid`
$ bundle exec unicorn_rails -E production -D
0
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
0
0