capistrano-data_plane_api 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +8 -2
- data/lib/capistrano/data_plane_api/deploy/deployment_stats.rb +2 -2
- data/lib/capistrano/data_plane_api/deploy/server_stats.rb +2 -0
- data/lib/capistrano/data_plane_api/helper.rb +2 -0
- data/lib/capistrano/data_plane_api/tasks.rb +4 -4
- data/lib/capistrano/data_plane_api/version.rb +1 -1
- data/templates/config/data_plane_api.yml +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4961a264a98074e2df17ebcc7947f3060a0c531c112f428c8d96c88c4bc60327
|
4
|
+
data.tar.gz: 2c8bc55c5748e119e1b9d088b124380b744eeb602127bb54b4ad47a075e63bf1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3280f16f6c65f1df0c46439bd1089950506382d2c0e5082a131549e7a9780ffd3e96ef462f0a3db6649c05f0006e7341c2dfa2c14b0bf44f221ae86a1c87f99
|
7
|
+
data.tar.gz: 4be8ebbe7e62c395b3774ffb292706da118217349b4edf36258bff6d34baf4b0a712ee4f4b4349ca306c78d8b30b176042ccf6020775ced7eba09c559c1473c2
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
# Capistrano::DataPlaneApi
|
2
2
|
|
3
|
-
Capistrano plugin which helps you
|
3
|
+
[Capistrano](https://capistranorb.com/) plugin which helps you
|
4
|
+
automatically change the admin state of your [HAProxy](https://www.haproxy.com/)
|
5
|
+
servers using the [Data Plane API](https://www.haproxy.com/documentation/dataplaneapi/community/).
|
6
|
+
|
7
|
+
[Capistrano](https://capistranorb.com/) is a remote server automation and deployment tool.
|
8
|
+
[HAProxy](https://www.haproxy.com/) is a load balancer.
|
4
9
|
|
5
10
|
## Installation
|
6
11
|
|
@@ -32,7 +37,8 @@ $ bundle exec cap_data_plane_api install
|
|
32
37
|
|
33
38
|
This gem hooks into capistrano to add new tasks which
|
34
39
|
enable you to change the admin state of your HAProxy
|
35
|
-
servers during the deployment process
|
40
|
+
servers during the deployment process
|
41
|
+
using using the [Data Plane API](https://www.haproxy.com/documentation/dataplaneapi/community/).
|
36
42
|
|
37
43
|
We recommend creating separate Capistrano stages
|
38
44
|
for every HAProxy server.
|
@@ -100,10 +100,10 @@ module Capistrano
|
|
100
100
|
nil
|
101
101
|
end
|
102
102
|
|
103
|
-
return
|
103
|
+
return if server_states.nil?
|
104
104
|
|
105
105
|
server_states.each do |server_state|
|
106
|
-
@server_stats[server_state['name']]&.
|
106
|
+
@server_stats[server_state['name']]&.tap do |s|
|
107
107
|
s.admin_state = server_state['admin_state']
|
108
108
|
s.operational_state = server_state['operational_state']
|
109
109
|
end
|
@@ -6,6 +6,7 @@ module Capistrano
|
|
6
6
|
module Helper
|
7
7
|
# @return [Hash{String => Symbol}]
|
8
8
|
ADMIN_STATE_COLORS = {
|
9
|
+
'unknown' => :on_red,
|
9
10
|
'drain' => :on_blue,
|
10
11
|
'ready' => :on_green,
|
11
12
|
'maint' => :on_yellow
|
@@ -13,6 +14,7 @@ module Capistrano
|
|
13
14
|
|
14
15
|
# @return [Hash{String => Symbol}]
|
15
16
|
OPERATIONAL_STATE_COLORS = {
|
17
|
+
'unknown' => :on_red,
|
16
18
|
'up' => :on_green,
|
17
19
|
'down' => :on_red,
|
18
20
|
'stopping' => :on_yellow
|
@@ -6,14 +6,14 @@ namespace :data_plane_api do
|
|
6
6
|
namespace :server do
|
7
7
|
desc "Set the server's admin state to DRAIN through the HAProxy Data Plane API"
|
8
8
|
task :set_drain do
|
9
|
-
next if no_haproxy?
|
9
|
+
next if ::Capistrano::DataPlaneApi.no_haproxy?
|
10
10
|
|
11
|
-
::Capistrano::DataPlaneApi.server_set_drain fetch(:stage), force: force_haproxy?
|
11
|
+
::Capistrano::DataPlaneApi.server_set_drain fetch(:stage), force: ::Capistrano::DataPlaneApi.force_haproxy?
|
12
12
|
end
|
13
13
|
|
14
14
|
desc "Set the server's admin state to READY through the HAProxy Data Plane API"
|
15
15
|
task :set_ready do
|
16
|
-
next if no_haproxy?
|
16
|
+
next if ::Capistrano::DataPlaneApi.no_haproxy?
|
17
17
|
|
18
18
|
sleep 3
|
19
19
|
::Capistrano::DataPlaneApi.server_set_ready fetch(:stage)
|
@@ -21,7 +21,7 @@ namespace :data_plane_api do
|
|
21
21
|
|
22
22
|
desc "Set the server's admin state to MAINT through the HAProxy Data Plane API"
|
23
23
|
task :set_maint do
|
24
|
-
next if no_haproxy?
|
24
|
+
next if ::Capistrano::DataPlaneApi.no_haproxy?
|
25
25
|
|
26
26
|
sleep 3
|
27
27
|
::Capistrano::DataPlaneApi.server_set_maint fetch(:stage), force: true
|
@@ -13,6 +13,7 @@ basic_password: my_password # Data Plane API BasicAuth password
|
|
13
13
|
|
14
14
|
# List of HAProxy backends
|
15
15
|
backends:
|
16
|
+
|
16
17
|
- name: back_production # your HAProxy backend name
|
17
18
|
# styles defined in the `Pastel` gem, used in the terminal to uniquely identify this backend
|
18
19
|
# by coloring its name.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-data_plane_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mateusz Drewniak
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2023-01-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: data_plane_api
|
@@ -169,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
169
|
- !ruby/object:Gem::Version
|
170
170
|
version: '0'
|
171
171
|
requirements: []
|
172
|
-
rubygems_version: 3.4.
|
172
|
+
rubygems_version: 3.4.3
|
173
173
|
signing_key:
|
174
174
|
specification_version: 4
|
175
175
|
summary: Capistrano plugin which helps you automatically change the admin state of
|