Skip to content

Commit 3bd14f8

Browse files
committed
docs: migration guide
1 parent 6791bcb commit 3bd14f8

File tree

2 files changed

+144
-2
lines changed

2 files changed

+144
-2
lines changed

MIGRATION_FROM_V2.md

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
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

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
Sidekiq integration for Capistrano - providing systemd service management and deployment coordination for Sidekiq 7+.
77

8+
**Upgrading from v2.x?** See the [Migration Guide](MIGRATION_FROM_V2.md) for breaking changes and upgrade instructions.
9+
810
## Example Application
911

1012
For a complete working example of this gem in action, see the [capistrano-example-app](https://github.com/seuros/capistrano-example-app) which demonstrates:
@@ -35,10 +37,12 @@ Add to your Capfile:
3537
```ruby
3638
# Capfile
3739
require 'capistrano/sidekiq'
38-
install_plugin Capistrano::Sidekiq # Default sidekiq tasks
39-
install_plugin Capistrano::Sidekiq::Systemd # Systemd integration
40+
install_plugin Capistrano::Sidekiq # Default sidekiq tasks (REQUIRED!)
41+
install_plugin Capistrano::Sidekiq::Systemd # Systemd integration (REQUIRED!)
4042
```
4143

44+
**Important:** Both `require` and `install_plugin` lines are necessary. The `require` loads the gem code, while `install_plugin` actually registers the Capistrano tasks. Without `install_plugin`, commands like `cap sidekiq:start` will not be available.
45+
4246
## Configuration Options
4347

4448
### Basic Settings

0 commit comments

Comments
 (0)