sidekiq_alive 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +60 -1
- data/lib/sidekiq_alive/server.rb +1 -1
- data/lib/sidekiq_alive/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42f950238fc2224907b8c32fe4219f1ad5d3f3a083e68e0230ce98ede04753a9
|
4
|
+
data.tar.gz: e8d383349ac91b93c86a0f459d59fe963b9e318157c2fe3c7648f5e88cc1c394
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71ce02b4cbdc408a6ab9db14200d78bf2750f130a2d5c1bf877c80854f4b03cfd87e7eda9c3874f6f1ae13950f2d7df61c49a587f7a20c6ca8f1e28bd581ac30
|
7
|
+
data.tar.gz: 981d3bccb5c3fc813614c85b4656708af80c7bb392b7454379d740444a2cb8c0ac0c00bf2d5d2e12a8bd67e68d19236d2eaa39970b79719598f32b79d01ffc76
|
data/README.md
CHANGED
@@ -11,7 +11,7 @@ __How?__
|
|
11
11
|
|
12
12
|
A http server is started and on each requests validates that a liveness key is stored in Redis. If it is there means is working.
|
13
13
|
|
14
|
-
A Sidekiq worker is the
|
14
|
+
A Sidekiq worker is the responsible to storing this key. If Sidekiq stops processing workers
|
15
15
|
this key gets expired by Redis an consequently the http server will return a 500 error.
|
16
16
|
|
17
17
|
This worker is responsible to requeue itself for the next liveness probe.
|
@@ -83,6 +83,8 @@ Set `livenessProbe` in your Kubernetes deployment
|
|
83
83
|
|
84
84
|
example with recommended setup:
|
85
85
|
|
86
|
+
#### Sidekiq < 6
|
87
|
+
|
86
88
|
```yaml
|
87
89
|
spec:
|
88
90
|
containers:
|
@@ -117,6 +119,63 @@ spec:
|
|
117
119
|
terminationGracePeriodSeconds: 60 # put your longest Job time here plus security time.
|
118
120
|
```
|
119
121
|
|
122
|
+
#### Sidekiq >= 6
|
123
|
+
|
124
|
+
Create file:
|
125
|
+
|
126
|
+
__kube/sidekiq_quiet__
|
127
|
+
|
128
|
+
```bash
|
129
|
+
#!/bin/bash
|
130
|
+
|
131
|
+
# Find Pid
|
132
|
+
SIDEKIQ_PID=$(ps aux | grep sidekiq | grep busy | awk '{ print $2 }')
|
133
|
+
# Send TSTP signal
|
134
|
+
kill -SIGTSTP $SIDEKIQ_PID
|
135
|
+
```
|
136
|
+
|
137
|
+
Make it executable:
|
138
|
+
|
139
|
+
```
|
140
|
+
$ chmod +x kube/sidekiq_quiet
|
141
|
+
```
|
142
|
+
|
143
|
+
Execute it in your deployment preStop:
|
144
|
+
|
145
|
+
```yaml
|
146
|
+
spec:
|
147
|
+
containers:
|
148
|
+
- name: my_app
|
149
|
+
image: my_app:latest
|
150
|
+
env:
|
151
|
+
- name: RAILS_ENV
|
152
|
+
value: production
|
153
|
+
command:
|
154
|
+
- bundle
|
155
|
+
- exec
|
156
|
+
- sidekiq
|
157
|
+
ports:
|
158
|
+
- containerPort: 7433
|
159
|
+
livenessProbe:
|
160
|
+
httpGet:
|
161
|
+
path: /
|
162
|
+
port: 7433
|
163
|
+
initialDelaySeconds: 80 # app specific. Time your sidekiq takes to start processing.
|
164
|
+
timeoutSeconds: 5 # can be much less
|
165
|
+
readinessProbe:
|
166
|
+
httpGet:
|
167
|
+
path: /
|
168
|
+
port: 7433
|
169
|
+
initialDelaySeconds: 80 # app specific
|
170
|
+
timeoutSeconds: 5 # can be much less
|
171
|
+
lifecycle:
|
172
|
+
preStop:
|
173
|
+
exec:
|
174
|
+
# SIGTERM triggers a quick exit; gracefully terminate instead
|
175
|
+
command: ["kube", "sidekiq_quiet"]
|
176
|
+
terminationGracePeriodSeconds: 60 # put your longest Job time here plus security time.
|
177
|
+
```
|
178
|
+
|
120
179
|
### Outside kubernetes
|
121
180
|
|
122
181
|
It's just up to you how you want to use it.
|
data/lib/sidekiq_alive/server.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq_alive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Artur Pañach
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|