|
| 1 | +# Migration Guide: From v2.x to v3.x |
| 2 | + |
| 3 | +This guide helps you migrate from capistrano-sidekiq v2.x to v3.x. |
| 4 | + |
| 5 | +## Breaking Changes |
| 6 | + |
| 7 | +### 1. Monit Support Removed |
| 8 | + |
| 9 | +**v3.0.0 removed monit support completely.** The gem now only supports systemd for service management. |
| 10 | + |
| 11 | +#### Before (v2.x with Monit): |
| 12 | +```ruby |
| 13 | +# Capfile |
| 14 | +require 'capistrano/sidekiq' |
| 15 | +install_plugin Capistrano::Sidekiq |
| 16 | +install_plugin Capistrano::Sidekiq::Monit # No longer available |
| 17 | +``` |
| 18 | + |
| 19 | +#### After (v3.x with Systemd only): |
| 20 | +```ruby |
| 21 | +# Capfile |
| 22 | +require 'capistrano/sidekiq' |
| 23 | +install_plugin Capistrano::Sidekiq |
| 24 | +install_plugin Capistrano::Sidekiq::Systemd |
| 25 | +``` |
| 26 | + |
| 27 | +### 2. Default Role Changed |
| 28 | + |
| 29 | +The default role changed from `:app` to `:worker`. |
| 30 | + |
| 31 | +#### Before (v2.x): |
| 32 | +```ruby |
| 33 | +# Sidekiq tasks ran on :app role by default |
| 34 | +server 'app1.example.com', roles: [:app] # Sidekiq would run here |
| 35 | +``` |
| 36 | + |
| 37 | +#### After (v3.x): |
| 38 | +```ruby |
| 39 | +# Sidekiq tasks now run on :worker role by default |
| 40 | +server 'worker1.example.com', roles: [:worker] # Sidekiq runs here |
| 41 | + |
| 42 | +# Or override the default: |
| 43 | +set :sidekiq_roles, :app # Use old behavior |
| 44 | +``` |
| 45 | + |
| 46 | +### 3. Task Names Changed |
| 47 | + |
| 48 | +Some task names have changed or been removed: |
| 49 | + |
| 50 | +- `sidekiq:monit:*` tasks are completely removed |
| 51 | +- Use standard systemd tasks: `sidekiq:start`, `sidekiq:stop`, `sidekiq:restart` |
| 52 | + |
| 53 | +## Migration Steps |
| 54 | + |
| 55 | +### Step 1: Update Your Gemfile |
| 56 | + |
| 57 | +```ruby |
| 58 | +# Gemfile |
| 59 | +gem 'capistrano-sidekiq', '~> 3.0' |
| 60 | +``` |
| 61 | + |
| 62 | +### Step 2: Update Your Capfile |
| 63 | + |
| 64 | +```ruby |
| 65 | +# Capfile |
| 66 | +require 'capistrano/sidekiq' |
| 67 | +install_plugin Capistrano::Sidekiq |
| 68 | +install_plugin Capistrano::Sidekiq::Systemd |
| 69 | +``` |
| 70 | + |
| 71 | +### Step 3: Update Your Deploy Configuration |
| 72 | + |
| 73 | +```ruby |
| 74 | +# config/deploy.rb or config/deploy/production.rb |
| 75 | + |
| 76 | +# If you were using :app role, explicitly set it: |
| 77 | +set :sidekiq_roles, :app |
| 78 | + |
| 79 | +# Or update your server definitions to use :worker role: |
| 80 | +server 'worker1.example.com', roles: [:worker] |
| 81 | +``` |
| 82 | + |
| 83 | +### Step 4: Install Systemd Services |
| 84 | + |
| 85 | +Before your first deployment with v3.x: |
| 86 | + |
| 87 | +```bash |
| 88 | +# Install systemd service files on your servers |
| 89 | +cap production sidekiq:install |
| 90 | + |
| 91 | +# This replaces any monit configuration you had |
| 92 | +``` |
| 93 | + |
| 94 | +### Step 5: Remove Monit Configuration |
| 95 | + |
| 96 | +On your servers, remove old monit configuration files: |
| 97 | + |
| 98 | +```bash |
| 99 | +# On each server |
| 100 | +sudo rm /etc/monit/conf.d/sidekiq_* |
| 101 | +sudo monit reload |
| 102 | +``` |
| 103 | + |
| 104 | +## Troubleshooting |
| 105 | + |
| 106 | +### "Don't know how to build task 'sidekiq:start'" |
| 107 | + |
| 108 | +Make sure you have both lines in your Capfile: |
| 109 | +```ruby |
| 110 | +require 'capistrano/sidekiq' |
| 111 | +install_plugin Capistrano::Sidekiq::Systemd |
| 112 | +``` |
| 113 | + |
| 114 | +### "undefined method `as'" |
| 115 | + |
| 116 | +This is a known issue in v3.0.0. Make sure you're using the latest version which includes the fix. |
| 117 | + |
| 118 | +### Sidekiq doesn't start after deployment |
| 119 | + |
| 120 | +1. Check that systemd services are installed: |
| 121 | + ```bash |
| 122 | + cap production sidekiq:install |
| 123 | + ``` |
| 124 | + |
| 125 | +2. Check service status: |
| 126 | + ```bash |
| 127 | + systemctl --user status sidekiq_myapp_production |
| 128 | + ``` |
| 129 | + |
| 130 | +3. Ensure your servers have the `:worker` role or you've set `:sidekiq_roles` appropriately. |
| 131 | + |
| 132 | +## Getting Help |
| 133 | + |
| 134 | +If you encounter issues during migration: |
| 135 | + |
| 136 | +1. Check the [GitHub issues](https://github.com/seuros/capistrano-sidekiq/issues) |
| 137 | +2. Review the [README](README.md) for current configuration options |
| 138 | +3. Open a new issue with your specific migration problem |
0 commit comments