Sha256: f1bc13598f8b536ac40a0033a2ccc08c21283b1a9e562724c88951f71a7a2ddd
Contents?: true
Size: 1.9 KB
Versions: 4
Compression:
Stored size: 1.9 KB
Contents
#!/usr/bin/env ruby # frozen_string_literal: true require 'bundler/setup' require 'sidekiq-redeploy' require 'puma-redeploy' require 'optparse' def run_sidekiq(ops, logger) deployer = Puma::Redeploy::DeployerFactory.create(target: ops[:app_dir], watch_file: ops[:watch], logger:) watch_file_data = deployer.watch_file_data archive_file = deployer.archive_file(watch_file_data[:archive_location]) # Load app archive on launch deployer.deploy(source: archive_file) if ops[:deploy] config = { watch_delay: ops[:watch_delay] } Sidekiq::Redeploy::Loader.new(deployer:, logger:, sidekiq_app: ops[:sidekiq_app], config:, num_processes: ops[:num_processes]).run end def option_parser(opts) OptionParser.new do |o| o.on '-a', '--app-dir=DIR', '[Required] Location of application directory.' do |arg| opts[:app_dir] = arg end o.on '-w', '--watch=WATCH', '[Required] Location of watch file (file or s3 location).' do |arg| opts[:watch] = arg end o.on '-y', '--watch-delay INTEGER', Integer, '[Optional] Specify the number of seconds between checking watch file. Defaults to 30.' do |arg| opts[:watch_delay] = arg end o.on '-d', '--[no-]deploy [FLAG]', TrueClass, '[Optional] Deploy archive on app startup. Defaults to true.' do |arg| opts[:deploy] = arg end o.on '-s', '--sidekiq-app [PATH|DIR]', '[Optional] Location of application to pass to sidekiq.' do |arg| opts[:sidekiq_app] = arg end o.on '-n', '--num-procs INTEGER', Integer, '[Optional] Specify the number of sidekiq processes to create. Defaults to 1.' do |arg| opts[:num_processes] = arg end end end def logger Logger.new($stdout) end ops = { deploy: true, watch_delay: 30 } parser = option_parser(ops) parser.parse!(ARGV) unless ops[:app_dir] && ops[:watch] puts parser.help exit 1 end run_sidekiq(ops, logger)
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
sidekiq-redeploy-0.2.2 | bin/sidekiq-loader |
sidekiq-redeploy-0.2.1 | bin/sidekiq-loader |
sidekiq-redeploy-0.2.0 | bin/sidekiq-loader |
sidekiq-redeploy-0.1.10 | bin/sidekiq-loader |