Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.4.2
3.4.5
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
## [Unreleased]

## [0.2.0] - 2025-04-11
## [0.3.0] - 09.09.2025

- Add `api_url` per HAProxy backend

## [0.2.0] - 11.04.2025

- Update `data_plane_api` to `>= 0.2.0`
- Add the `-C`/`--check` flag to `bin/deploy`
- Rewrite YARD to sorbet (with inline RBS)

## [0.1.0] - 2022-12-28
## [0.1.0] - 28.12.2022

- Initial release
3 changes: 2 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ GEM
PLATFORMS
arm64-darwin-20
arm64-darwin-23
arm64-darwin-24
x86_64-linux

DEPENDENCIES
Expand All @@ -164,4 +165,4 @@ DEPENDENCIES
webmock (~> 3.25.1)

BUNDLED WITH
2.6.7
2.7.2
30 changes: 15 additions & 15 deletions lib/capistrano/data_plane_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ def server_set_drain(deployment_stage, force: false, config: nil)
validate_backend_state(haproxy_backend, haproxy_server) unless force

conf = ::DataPlaneApi::Configuration.new(
basic_user: haproxy_backend.basic_user || @configuration.basic_user,
basic_password: haproxy_backend.basic_password || @configuration.basic_password,
basic_user: haproxy_backend.basic_user || configuration.basic_user,
basic_password: haproxy_backend.basic_password || configuration.basic_password,
url: haproxy_backend.api_url || configuration.api_url,
parent: config,
url: configuration.api_url,
)

# set the target server's state to `drain`
Expand Down Expand Up @@ -128,10 +128,10 @@ def server_set_maint(deployment_stage, force: false, config: nil)
validate_backend_state(haproxy_backend, haproxy_server) unless force

conf = ::DataPlaneApi::Configuration.new(
basic_user: haproxy_backend.basic_user || @configuration.basic_user,
basic_password: haproxy_backend.basic_password || @configuration.basic_password,
basic_user: haproxy_backend.basic_user || configuration.basic_user,
basic_password: haproxy_backend.basic_password || configuration.basic_password,
url: haproxy_backend.api_url || configuration.api_url,
parent: config,
url: configuration.api_url,
)

# set the target server's state to `maint`
Expand Down Expand Up @@ -162,10 +162,10 @@ def server_set_ready(deployment_stage, config: nil)
return if servers.length < 2 # skip HAProxy if there is only a single server

conf = ::DataPlaneApi::Configuration.new(
basic_user: haproxy_backend.basic_user || @configuration.basic_user,
basic_password: haproxy_backend.basic_password || @configuration.basic_password,
basic_user: haproxy_backend.basic_user || configuration.basic_user,
basic_password: haproxy_backend.basic_password || configuration.basic_password,
url: haproxy_backend.api_url || configuration.api_url,
parent: config,
url: configuration.api_url,
)

# set the target server's state to `drain`
Expand Down Expand Up @@ -250,10 +250,10 @@ def find_server_and_backend(deployment_stage)
def get_backend_servers_settings(backend_name, config: nil)
haproxy_backend = find_backend(backend_name)
conf = ::DataPlaneApi::Configuration.new(
basic_user: haproxy_backend.basic_user || @configuration.basic_user,
basic_password: haproxy_backend.basic_password || @configuration.basic_password,
basic_user: haproxy_backend.basic_user || configuration.basic_user,
basic_password: haproxy_backend.basic_password || configuration.basic_password,
url: haproxy_backend.api_url || configuration.api_url,
parent: config,
url: configuration.api_url,
)
response = ::DataPlaneApi::Server.get_runtime_settings(
backend: backend_name.to_s,
Expand All @@ -271,10 +271,10 @@ def get_backend_servers_settings(backend_name, config: nil)
def get_server_settings(backend_name, server_name, config: nil)
haproxy_backend = find_backend(backend_name)
conf = ::DataPlaneApi::Configuration.new(
basic_user: haproxy_backend.basic_user || @configuration.basic_user,
basic_password: haproxy_backend.basic_password || @configuration.basic_password,
basic_user: haproxy_backend.basic_user || configuration.basic_user,
basic_password: haproxy_backend.basic_password || configuration.basic_password,
url: haproxy_backend.api_url || configuration.api_url,
parent: config,
url: configuration.api_url,
)
response = ::DataPlaneApi::Server.get_runtime_settings(
backend: backend_name.to_s,
Expand Down
1 change: 1 addition & 0 deletions lib/capistrano/data_plane_api/configuration/backend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class Configuration < Type
class Backend < Type
attribute :name, ::Shale::Type::String
attribute :styles, Symbol, collection: true
attribute :api_url, ::Shale::Type::String
attribute :basic_user, ::Shale::Type::String
attribute :basic_password, ::Shale::Type::String
attribute :servers, Server, collection: true
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions templates/config/data_plane_api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ backends:
styles:
- :bold
- :on_green
api_url: http://example.com/other-haproxy-data-plane-api
# You can use ERB to read data from Environment Variables.
basic_user: <%= ENV['USER'] %>
basic_password: <%= ENV['PASS'] %>
Expand Down