capistrano-data_plane_api 0.2.0 → 0.3.0
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/.ruby-version +1 -1
- data/CHANGELOG.md +7 -2
- data/Gemfile.lock +3 -2
- data/README.md +10 -0
- data/lib/capistrano/data_plane_api/configuration/backend.rb +1 -0
- data/lib/capistrano/data_plane_api/deploy/args.rb +8 -1
- data/lib/capistrano/data_plane_api/version.rb +1 -1
- data/lib/capistrano/data_plane_api.rb +15 -15
- data/sorbet/rbi/dsl/capistrano/data_plane_api/configuration/backend.rbi +6 -0
- data/templates/config/data_plane_api.yml +1 -0
- 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: 502c957860848750f102b26efbdc1bae2e4aacc70d4597394806fa48f877bde5
|
4
|
+
data.tar.gz: 6be72e9c47e67a70ed54833f74bce86a736a40750dada0892f9481009318c55a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cf8ee103dbf52dc98e19c3f3927b3e997cb7b2b5fd504338dd8d3f754dd44f4073e53218baa6a821d7d0667af0f99e595786b6ad5cf2343aeb150df5265fa76
|
7
|
+
data.tar.gz: d3efeff078f47dce3c04aa93ffb169da6b8c575e2725313adceea52a706d34c0d3b1fce63b610c2ebb6b68828e7e92a47675044ef271968d0f4b8bc243c0a9f8
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.4.
|
1
|
+
3.4.5
|
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,16 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
-
## [0.
|
3
|
+
## [0.3.0] - 09.09.2025
|
4
|
+
|
5
|
+
- Add `api_url` per HAProxy backend
|
6
|
+
- Add `--no-asset-precompilation` CLI flag
|
7
|
+
|
8
|
+
## [0.2.0] - 11.04.2025
|
4
9
|
|
5
10
|
- Update `data_plane_api` to `>= 0.2.0`
|
6
11
|
- Add the `-C`/`--check` flag to `bin/deploy`
|
7
12
|
- Rewrite YARD to sorbet (with inline RBS)
|
8
13
|
|
9
|
-
## [0.1.0] - 2022
|
14
|
+
## [0.1.0] - 28.12.2022
|
10
15
|
|
11
16
|
- Initial release
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
capistrano-data_plane_api (0.
|
4
|
+
capistrano-data_plane_api (0.3.0)
|
5
5
|
booleans (~> 0.1)
|
6
6
|
data_plane_api (>= 0.2)
|
7
7
|
pastel (< 1)
|
@@ -147,6 +147,7 @@ GEM
|
|
147
147
|
PLATFORMS
|
148
148
|
arm64-darwin-20
|
149
149
|
arm64-darwin-23
|
150
|
+
arm64-darwin-24
|
150
151
|
x86_64-linux
|
151
152
|
|
152
153
|
DEPENDENCIES
|
@@ -164,4 +165,4 @@ DEPENDENCIES
|
|
164
165
|
webmock (~> 3.25.1)
|
165
166
|
|
166
167
|
BUNDLED WITH
|
167
|
-
2.
|
168
|
+
2.7.2
|
data/README.md
CHANGED
@@ -85,6 +85,7 @@ This script can be used to deploy this app to remote servers.
|
|
85
85
|
-h, --help Prints this help
|
86
86
|
-b, --branch=BRANCH Deploy the code from the passed Git branch
|
87
87
|
--no-migrations Do not carry out migrations
|
88
|
+
--no-asset-precompilation Skip asset precompilation during deployment
|
88
89
|
```
|
89
90
|
|
90
91
|
### Example of commands
|
@@ -197,6 +198,15 @@ deploy
|
|
197
198
|
|
198
199
|
These tasks will only run when the `:web` role is added to the deployment stage.
|
199
200
|
|
201
|
+
## Database migrations and asset precompilation
|
202
|
+
|
203
|
+
In order for the `--no-migrations` and `--no-asset-precompilation` flags to work correctly, you need to use this configuration in your `Capfile`:
|
204
|
+
|
205
|
+
```rb
|
206
|
+
require 'capistrano/rails/assets' if ::ENV['NO_ASSET_PRECOMPILATION'].nil?
|
207
|
+
require 'capistrano/rails/migrations' if ::ENV['NO_MIGRATIONS'].nil?
|
208
|
+
```
|
209
|
+
|
200
210
|
## Development
|
201
211
|
|
202
212
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -11,6 +11,7 @@ module Capistrano
|
|
11
11
|
class Backend < Type
|
12
12
|
attribute :name, ::Shale::Type::String
|
13
13
|
attribute :styles, Symbol, collection: true
|
14
|
+
attribute :api_url, ::Shale::Type::String
|
14
15
|
attribute :basic_user, ::Shale::Type::String
|
15
16
|
attribute :basic_password, ::Shale::Type::String
|
16
17
|
attribute :servers, Server, collection: true
|
@@ -11,7 +11,7 @@ module Capistrano
|
|
11
11
|
# passed to the deployment script and saves them in
|
12
12
|
# an object.
|
13
13
|
class Args
|
14
|
-
PRINTABLE_ENV_VARS = %w[BRANCH NO_MIGRATIONS].freeze
|
14
|
+
PRINTABLE_ENV_VARS = %w[BRANCH NO_MIGRATIONS NO_ASSET_PRECOMPILATION].freeze
|
15
15
|
|
16
16
|
#: (Array[untyped]?) -> instance
|
17
17
|
def self.parse(options = nil) # rubocop:disable Metrics/MethodLength, Style/ClassMethodsDefinitions
|
@@ -156,6 +156,13 @@ module Capistrano
|
|
156
156
|
args.no_migrations = val
|
157
157
|
::ENV['NO_MIGRATIONS'] = 'true'
|
158
158
|
end
|
159
|
+
|
160
|
+
parser.on(
|
161
|
+
'--no-asset-precompilation',
|
162
|
+
'Skip asset precompilation during deployment',
|
163
|
+
) do
|
164
|
+
::ENV['NO_ASSET_PRECOMPILATION'] = 'true'
|
165
|
+
end
|
159
166
|
end
|
160
167
|
|
161
168
|
opt_parser.parse!(options || ::ARGV)
|
@@ -91,10 +91,10 @@ module Capistrano
|
|
91
91
|
validate_backend_state(haproxy_backend, haproxy_server) unless force
|
92
92
|
|
93
93
|
conf = ::DataPlaneApi::Configuration.new(
|
94
|
-
basic_user: haproxy_backend.basic_user ||
|
95
|
-
basic_password: haproxy_backend.basic_password ||
|
94
|
+
basic_user: haproxy_backend.basic_user || configuration.basic_user,
|
95
|
+
basic_password: haproxy_backend.basic_password || configuration.basic_password,
|
96
|
+
url: haproxy_backend.api_url || configuration.api_url,
|
96
97
|
parent: config,
|
97
|
-
url: configuration.api_url,
|
98
98
|
)
|
99
99
|
|
100
100
|
# set the target server's state to `drain`
|
@@ -128,10 +128,10 @@ module Capistrano
|
|
128
128
|
validate_backend_state(haproxy_backend, haproxy_server) unless force
|
129
129
|
|
130
130
|
conf = ::DataPlaneApi::Configuration.new(
|
131
|
-
basic_user: haproxy_backend.basic_user ||
|
132
|
-
basic_password: haproxy_backend.basic_password ||
|
131
|
+
basic_user: haproxy_backend.basic_user || configuration.basic_user,
|
132
|
+
basic_password: haproxy_backend.basic_password || configuration.basic_password,
|
133
|
+
url: haproxy_backend.api_url || configuration.api_url,
|
133
134
|
parent: config,
|
134
|
-
url: configuration.api_url,
|
135
135
|
)
|
136
136
|
|
137
137
|
# set the target server's state to `maint`
|
@@ -162,10 +162,10 @@ module Capistrano
|
|
162
162
|
return if servers.length < 2 # skip HAProxy if there is only a single server
|
163
163
|
|
164
164
|
conf = ::DataPlaneApi::Configuration.new(
|
165
|
-
basic_user: haproxy_backend.basic_user ||
|
166
|
-
basic_password: haproxy_backend.basic_password ||
|
165
|
+
basic_user: haproxy_backend.basic_user || configuration.basic_user,
|
166
|
+
basic_password: haproxy_backend.basic_password || configuration.basic_password,
|
167
|
+
url: haproxy_backend.api_url || configuration.api_url,
|
167
168
|
parent: config,
|
168
|
-
url: configuration.api_url,
|
169
169
|
)
|
170
170
|
|
171
171
|
# set the target server's state to `drain`
|
@@ -250,10 +250,10 @@ module Capistrano
|
|
250
250
|
def get_backend_servers_settings(backend_name, config: nil)
|
251
251
|
haproxy_backend = find_backend(backend_name)
|
252
252
|
conf = ::DataPlaneApi::Configuration.new(
|
253
|
-
basic_user: haproxy_backend.basic_user ||
|
254
|
-
basic_password: haproxy_backend.basic_password ||
|
253
|
+
basic_user: haproxy_backend.basic_user || configuration.basic_user,
|
254
|
+
basic_password: haproxy_backend.basic_password || configuration.basic_password,
|
255
|
+
url: haproxy_backend.api_url || configuration.api_url,
|
255
256
|
parent: config,
|
256
|
-
url: configuration.api_url,
|
257
257
|
)
|
258
258
|
response = ::DataPlaneApi::Server.get_runtime_settings(
|
259
259
|
backend: backend_name.to_s,
|
@@ -271,10 +271,10 @@ module Capistrano
|
|
271
271
|
def get_server_settings(backend_name, server_name, config: nil)
|
272
272
|
haproxy_backend = find_backend(backend_name)
|
273
273
|
conf = ::DataPlaneApi::Configuration.new(
|
274
|
-
basic_user: haproxy_backend.basic_user ||
|
275
|
-
basic_password: haproxy_backend.basic_password ||
|
274
|
+
basic_user: haproxy_backend.basic_user || configuration.basic_user,
|
275
|
+
basic_password: haproxy_backend.basic_password || configuration.basic_password,
|
276
|
+
url: haproxy_backend.api_url || configuration.api_url,
|
276
277
|
parent: config,
|
277
|
-
url: configuration.api_url,
|
278
278
|
)
|
279
279
|
response = ::DataPlaneApi::Server.get_runtime_settings(
|
280
280
|
backend: backend_name.to_s,
|
@@ -9,6 +9,12 @@ class Capistrano::DataPlaneApi::Configuration::Backend
|
|
9
9
|
include ShaleAttributeMethods
|
10
10
|
|
11
11
|
module ShaleAttributeMethods
|
12
|
+
sig { returns(T.nilable(String)) }
|
13
|
+
def api_url; end
|
14
|
+
|
15
|
+
sig { params(value: T.nilable(String)).returns(T.nilable(String)) }
|
16
|
+
def api_url=(value); end
|
17
|
+
|
12
18
|
sig { returns(T.nilable(String)) }
|
13
19
|
def basic_password; end
|
14
20
|
|
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.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mateusz Drewniak
|
@@ -274,7 +274,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
274
274
|
- !ruby/object:Gem::Version
|
275
275
|
version: '0'
|
276
276
|
requirements: []
|
277
|
-
rubygems_version: 3.
|
277
|
+
rubygems_version: 3.7.1
|
278
278
|
specification_version: 4
|
279
279
|
summary: Capistrano plugin which helps you automatically change the admin state of
|
280
280
|
your HAProxy servers
|