##Working configuration to accomplish 0-downtime deploy with unicorn 5.x and systemd on centos 7
The scope is to accomplish a 0-downtime reload of a unicorn service managed by Systemd on a Centos 7 distro.
The examples and assumptions that i found on the bogomips's unicorn repo seems not working for centos 7.
Below a working configuration tested on Centos 7 and unicorn 5.1
Any advice/remark will be appreciated
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Retriable | |
# This will catch any exception and retry twice (three tries total): | |
# with_retries { ... } | |
# | |
# This will catch any exception and retry four times (five tries total): | |
# with_retries(:limit => 5) { ... } | |
# | |
# This will catch a specific exception and retry once (two tries total): | |
# with_retries(Some::Error, :limit => 2) { ... } | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D | |
rails_env = ENV['RAILS_ENV'] || 'production' | |
# 16 workers and 1 master | |
worker_processes (rails_env == 'production' ? 16 : 4) | |
# Load rails+github.git into the master before forking workers | |
# for super-fast worker spawn times | |
preload_app true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module OneTimePassword | |
# Concern containing logic and methods for OTP authentication. | |
# Is used Time-based One-time Password Algorithm(TOTP) | |
# https://tools.ietf.org/html/rfc6238 | |
extend ActiveSupport::Concern | |
OTP_DIGITS = 6 | |
OTP_NUMBER_OF_BACKUP_CODES = 10 | |
OTP_BACKUP_CODE_LENGTH = 12 |