LoginSignup
7
5

More than 5 years have passed since last update.

RailsでSidekiqをCapistranoでAWSにデプロイする

Last updated at Posted at 2016-03-23

概要

RailsでSidekiqをCapistranoでAWSにデプロイする。

準備

アプリ

Gemfileにcapistrano-sidekiqを追加

Gemfile
gem 'capistrano-sidekiq'

Capfileに設定を追加

Capfile
require 'capistrano/sidekiq'
require 'capistrano/sidekiq/monit' #to require monit tasks # Only for capistrano3

deploy.rbに設定を追加

config/deploy.rb
set :sidekiq_monit_conf_dir, '/etc/monit.d'

サーバ

visudoを実行してアプリ実行ユーザがパスワード不用でsudoを実行できるようにする

visudo
## Same thing without a password
# %wheel        ALL=(ALL)       NOPASSWD: ALL
app     ALL=(ALL)       NOPASSWD: ALL

monitをインストール

sudo yum install -y monit

monitを自動起動にする

sudo chkconfig monit on

/etc/monit.confの以下の部分のコメントアウトを外す

/etc/monit.conf
set httpd port 2812 and
   use address localhost  # only accept connection from localhost
   allow localhost

デプロイ実行

bundle exec cap staging deploy
7
5
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
7
5