aptible-cli 0.20.0 → 0.22.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/.github/workflows/test.yml +50 -0
- data/Gemfile +0 -4
- data/Gemfile.lock +17 -22
- data/README.md +9 -6
- data/aptible-cli.gemspec +12 -9
- data/lib/aptible/cli/helpers/database.rb +3 -1
- data/lib/aptible/cli/subcommands/apps.rb +6 -1
- data/lib/aptible/cli/subcommands/backup.rb +7 -1
- data/lib/aptible/cli/subcommands/backup_retention_policy.rb +42 -9
- data/lib/aptible/cli/subcommands/db.rb +23 -5
- data/lib/aptible/cli/subcommands/deploy.rb +15 -2
- data/lib/aptible/cli/subcommands/endpoints.rb +31 -1
- data/lib/aptible/cli/subcommands/services.rb +23 -0
- data/lib/aptible/cli/version.rb +1 -1
- data/spec/aptible/cli/subcommands/backup_retention_policy_spec.rb +115 -0
- data/spec/aptible/cli/subcommands/backup_spec.rb +15 -0
- data/spec/aptible/cli/subcommands/db_spec.rb +14 -0
- data/spec/aptible/cli/subcommands/deploy_spec.rb +21 -0
- data/spec/aptible/cli/subcommands/endpoints_spec.rb +38 -0
- data/spec/aptible/cli/subcommands/services_spec.rb +61 -28
- data/spec/fabricators/account_fabricator.rb +1 -0
- data/spec/fabricators/backup_retention_policy_fabricator.rb +18 -0
- metadata +92 -46
- data/.travis.yml +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97db514e9f8cadd2d35e757350cf16038dc6e319a1bc259b5a9cf28101467f39
|
4
|
+
data.tar.gz: e2058f731955e95d3bd024d1535a96bfe7e2bb9d9dc61a96192b56346e1c992a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bcbc491db4584b58ec9d8cc59ab382302a86cfa83422f29900e57e5e30feb2240ec5f9621b39129852bc03f4d36c0d34383e5efabeeb26cd943c79183e321297
|
7
|
+
data.tar.gz: 1f2a33631bc7ef8d248bafe247cec5fbf856307e0483fedf03bbe5ff077f38b85b7488c41d6b58016a34a4874ec03d2ce7209dcadd69bfca71af2f91f700034c
|
@@ -0,0 +1,50 @@
|
|
1
|
+
on:
|
2
|
+
pull_request:
|
3
|
+
branches:
|
4
|
+
- main
|
5
|
+
- master
|
6
|
+
push:
|
7
|
+
branches:
|
8
|
+
- main
|
9
|
+
- master
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
test:
|
13
|
+
name: Build and Publish
|
14
|
+
runs-on: ubuntu-20.04
|
15
|
+
strategy:
|
16
|
+
fail-fast: false
|
17
|
+
matrix:
|
18
|
+
ruby-version: [2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7]
|
19
|
+
steps:
|
20
|
+
- name: Check out code
|
21
|
+
uses: actions/checkout@v4
|
22
|
+
|
23
|
+
- name: Setup ruby
|
24
|
+
uses: ruby/setup-ruby@v1
|
25
|
+
with:
|
26
|
+
ruby-version: ${{ matrix.ruby-version }}
|
27
|
+
bundler: 1.17.3
|
28
|
+
bundler-cache: true
|
29
|
+
|
30
|
+
- name: Test
|
31
|
+
run: bundle exec rake
|
32
|
+
|
33
|
+
- name: Sync README
|
34
|
+
run: |
|
35
|
+
bundle exec script/sync-readme-usage
|
36
|
+
git diff --exit-code
|
37
|
+
|
38
|
+
results:
|
39
|
+
if: ${{ always() }}
|
40
|
+
runs-on: ubuntu-latest
|
41
|
+
name: Final Results
|
42
|
+
needs: [test]
|
43
|
+
steps:
|
44
|
+
- run: exit 1
|
45
|
+
# see https://stackoverflow.com/a/67532120/4907315
|
46
|
+
if: >-
|
47
|
+
${{
|
48
|
+
contains(needs.*.result, 'failure')
|
49
|
+
|| contains(needs.*.result, 'cancelled')
|
50
|
+
}}
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,28 +1,21 @@
|
|
1
|
-
GIT
|
2
|
-
remote: https://github.com/fancyremarker/pry.git
|
3
|
-
revision: be3823aa4ffc51260f2f3ce84f0984da3dc6dd10
|
4
|
-
branch: aptible
|
5
|
-
specs:
|
6
|
-
pry (0.10.0)
|
7
|
-
coderay (~> 1.1.0)
|
8
|
-
method_source (~> 0.8.1)
|
9
|
-
slop (~> 3.4)
|
10
|
-
|
11
1
|
PATH
|
12
2
|
remote: .
|
13
3
|
specs:
|
14
|
-
aptible-cli (0.
|
4
|
+
aptible-cli (0.22.0)
|
15
5
|
activesupport (>= 4.0, < 6.0)
|
16
|
-
aptible-api (~> 1.5
|
17
|
-
aptible-auth (~> 1.2.
|
6
|
+
aptible-api (~> 1.6.5)
|
7
|
+
aptible-auth (~> 1.2.5)
|
18
8
|
aptible-billing (~> 1.0)
|
19
9
|
aptible-resource (~> 1.1)
|
20
10
|
aws-sdk (~> 2.0)
|
21
11
|
bigdecimal (~> 1.3.5)
|
22
12
|
cbor
|
23
13
|
chronic_duration (~> 0.10.6)
|
14
|
+
concurrent-ruby (< 1.1.10)
|
24
15
|
git (< 1.10)
|
25
|
-
|
16
|
+
jwt (~> 2.3.0)
|
17
|
+
rack (~> 1.0)
|
18
|
+
term-ansicolor (~> 1.8.0)
|
26
19
|
thor (~> 0.20.0)
|
27
20
|
|
28
21
|
GEM
|
@@ -35,9 +28,9 @@ GEM
|
|
35
28
|
tzinfo (~> 1.1)
|
36
29
|
addressable (2.8.0)
|
37
30
|
public_suffix (>= 2.0.2, < 5.0)
|
38
|
-
aptible-api (1.5
|
39
|
-
aptible-auth
|
40
|
-
aptible-resource
|
31
|
+
aptible-api (1.6.5)
|
32
|
+
aptible-auth
|
33
|
+
aptible-resource
|
41
34
|
gem_config
|
42
35
|
multipart-post (< 2.2.0)
|
43
36
|
aptible-auth (1.2.5)
|
@@ -92,14 +85,14 @@ GEM
|
|
92
85
|
gem_config (0.3.2)
|
93
86
|
git (1.7.0)
|
94
87
|
rchardet (~> 1.8)
|
95
|
-
hashdiff (1.1.
|
88
|
+
hashdiff (1.1.1)
|
96
89
|
httpclient (2.8.3)
|
97
90
|
i18n (0.9.5)
|
98
91
|
concurrent-ruby (~> 1.0)
|
99
92
|
jmespath (1.6.2)
|
100
93
|
json (2.5.1)
|
101
94
|
jwt (2.3.0)
|
102
|
-
method_source (
|
95
|
+
method_source (1.1.0)
|
103
96
|
minitest (5.12.0)
|
104
97
|
multi_json (1.15.0)
|
105
98
|
multi_xml (0.6.0)
|
@@ -116,6 +109,9 @@ GEM
|
|
116
109
|
parser (2.7.2.0)
|
117
110
|
ast (~> 2.4.1)
|
118
111
|
powerpack (0.1.3)
|
112
|
+
pry (0.14.2)
|
113
|
+
coderay (~> 1.1)
|
114
|
+
method_source (~> 1.0)
|
119
115
|
public_suffix (3.1.1)
|
120
116
|
rack (1.6.13)
|
121
117
|
rainbow (2.2.2)
|
@@ -129,7 +125,7 @@ GEM
|
|
129
125
|
rspec-mocks (~> 3.13.0)
|
130
126
|
rspec-core (3.13.0)
|
131
127
|
rspec-support (~> 3.13.0)
|
132
|
-
rspec-expectations (3.13.
|
128
|
+
rspec-expectations (3.13.1)
|
133
129
|
diff-lcs (>= 1.2.0, < 2.0)
|
134
130
|
rspec-support (~> 3.13.0)
|
135
131
|
rspec-mocks (3.13.1)
|
@@ -143,7 +139,6 @@ GEM
|
|
143
139
|
ruby-progressbar (~> 1.7)
|
144
140
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
145
141
|
ruby-progressbar (1.13.0)
|
146
|
-
slop (3.6.0)
|
147
142
|
stripe (4.24.0)
|
148
143
|
faraday (~> 0.13)
|
149
144
|
net-http-persistent (~> 3.0)
|
@@ -174,7 +169,7 @@ DEPENDENCIES
|
|
174
169
|
bundler (~> 1.3)
|
175
170
|
climate_control (= 0.0.3)
|
176
171
|
fabrication (~> 2.15.2)
|
177
|
-
pry
|
172
|
+
pry
|
178
173
|
rack (~> 1.0)
|
179
174
|
rake
|
180
175
|
rspec (~> 3.2)
|
data/README.md
CHANGED
@@ -30,13 +30,13 @@ Commands:
|
|
30
30
|
aptible apps:create HANDLE # Create a new application
|
31
31
|
aptible apps:deprovision # Deprovision an app
|
32
32
|
aptible apps:rename OLD_HANDLE NEW_HANDLE [--environment ENVIRONMENT_HANDLE] # Rename an app handle. In order for the new app handle to appear in log drain and metric drain destinations, you must restart the app.
|
33
|
-
aptible apps:scale SERVICE [--container-count COUNT] [--container-size SIZE_MB]
|
33
|
+
aptible apps:scale SERVICE [--container-count COUNT] [--container-size SIZE_MB] [--container-profile PROFILE] # Scale a service
|
34
34
|
aptible backup:list DB_HANDLE # List backups for a database
|
35
35
|
aptible backup:orphaned # List backups associated with deprovisioned databases
|
36
36
|
aptible backup:purge BACKUP_ID # Permanently delete a backup and any copies of it
|
37
|
-
aptible backup:restore BACKUP_ID [--environment ENVIRONMENT_HANDLE] [--handle HANDLE] [--container-size SIZE_MB] [--disk-size SIZE_GB] [--key-arn KEY_ARN]
|
37
|
+
aptible backup:restore BACKUP_ID [--environment ENVIRONMENT_HANDLE] [--handle HANDLE] [--container-size SIZE_MB] [--disk-size SIZE_GB] [--container-profile PROFILE] [--iops IOPS] [--key-arn KEY_ARN] # Restore a backup
|
38
38
|
aptible backup_retention_policy [ENVIRONMENT_HANDLE] # Show the current backup retention policy for the environment
|
39
|
-
aptible backup_retention_policy:set [ENVIRONMENT_HANDLE] [--daily DAILY_BACKUPS] [--monthly MONTHLY_BACKUPS] [--yearly YEARLY_BACKUPS] [--make-copy|--no-make-copy] [--keep-final|--no-keep-final]
|
39
|
+
aptible backup_retention_policy:set [ENVIRONMENT_HANDLE] [--daily DAILY_BACKUPS] [--monthly MONTHLY_BACKUPS] [--yearly YEARLY_BACKUPS] [--make-copy|--no-make-copy] [--keep-final|--no-keep-final] [--force] # Change the environment's backup retention policy
|
40
40
|
aptible config # Print an app's current configuration
|
41
41
|
aptible config:add [VAR1=VAL1] [VAR2=VAL2] [...] # Add an ENV variable to an app
|
42
42
|
aptible config:get [VAR1] # Print a specific key within an app's current configuration
|
@@ -45,7 +45,7 @@ Commands:
|
|
45
45
|
aptible config:unset [VAR1] [VAR2] [...] # Remove an ENV variable from an app
|
46
46
|
aptible db:backup HANDLE # Backup a database
|
47
47
|
aptible db:clone SOURCE DEST # Clone a database to create a new one
|
48
|
-
aptible db:create HANDLE [--type TYPE] [--version VERSION] [--container-size SIZE_MB] [--disk-size SIZE_GB] [--key-arn KEY_ARN]
|
48
|
+
aptible db:create HANDLE [--type TYPE] [--version VERSION] [--container-size SIZE_MB] [--disk-size SIZE_GB] [--container-profile PROFILE] [--iops IOPS] [--key-arn KEY_ARN] # Create a new database
|
49
49
|
aptible db:deprovision HANDLE # Deprovision a database
|
50
50
|
aptible db:dump HANDLE [pg_dump options] # Dump a remote database to file
|
51
51
|
aptible db:execute HANDLE SQL_FILE [--on-error-stop] # Executes sql against a database
|
@@ -53,8 +53,8 @@ Commands:
|
|
53
53
|
aptible db:modify HANDLE [--iops IOPS] [--volume-type [gp2, gp3]] # Modify a database disk
|
54
54
|
aptible db:reload HANDLE # Reload a database
|
55
55
|
aptible db:rename OLD_HANDLE NEW_HANDLE [--environment ENVIRONMENT_HANDLE] # Rename a database handle. In order for the new database handle to appear in log drain and metric drain destinations, you must reload the database.
|
56
|
-
aptible db:replicate HANDLE REPLICA_HANDLE [--container-size SIZE_MB] [--disk-size SIZE_GB] [--logical --version VERSION] [--key-arn KEY_ARN]
|
57
|
-
aptible db:restart HANDLE [--container-size SIZE_MB] [--disk-size SIZE_GB] [--iops IOPS] [--volume-type [gp2, gp3]]
|
56
|
+
aptible db:replicate HANDLE REPLICA_HANDLE [--container-size SIZE_MB] [--disk-size SIZE_GB] [--container-profile PROFILE] [--iops IOPS] [--logical --version VERSION] [--key-arn KEY_ARN] # Create a replica/follower of a database
|
57
|
+
aptible db:restart HANDLE [--container-size SIZE_MB] [--disk-size SIZE_GB] [--container-profile PROFILE] [--iops IOPS] [--volume-type [gp2, gp3]] # Restart a database
|
58
58
|
aptible db:tunnel HANDLE # Create a local tunnel to a database
|
59
59
|
aptible db:url HANDLE # Display a database URL
|
60
60
|
aptible db:versions # List available database versions
|
@@ -62,6 +62,8 @@ Commands:
|
|
62
62
|
aptible endpoints:database:create DATABASE # Create a Database Endpoint
|
63
63
|
aptible endpoints:database:modify --database DATABASE ENDPOINT_HOSTNAME # Modify a Database Endpoint
|
64
64
|
aptible endpoints:deprovision [--app APP | --database DATABASE] ENDPOINT_HOSTNAME # Deprovision an App or Database Endpoint
|
65
|
+
aptible endpoints:grpc:create [--app APP] SERVICE # Create an App gRPC Endpoint
|
66
|
+
aptible endpoints:grpc:modify [--app APP] ENDPOINT_HOSTNAME # Modify an App gRPC Endpoint
|
65
67
|
aptible endpoints:https:create [--app APP] SERVICE # Create an App HTTPS Endpoint
|
66
68
|
aptible endpoints:https:modify [--app APP] ENDPOINT_HOSTNAME # Modify an App HTTPS Endpoint
|
67
69
|
aptible endpoints:list [--app APP | --database DATABASE] # List Endpoints for an App or Database
|
@@ -100,6 +102,7 @@ Commands:
|
|
100
102
|
aptible rebuild # Rebuild an app, and restart its services
|
101
103
|
aptible restart # Restart all services associated with an app
|
102
104
|
aptible services # List Services for an App
|
105
|
+
aptible services:settings SERVICE [--force-zero-downtime|--no-force-zero-downtime] [--simple-health-check|--no-simple-health-check] # Modifies the zero-downtime deploy setting for a service
|
103
106
|
aptible ssh [COMMAND] # Run a command against an app
|
104
107
|
aptible version # Print Aptible CLI version
|
105
108
|
```
|
data/aptible-cli.gemspec
CHANGED
@@ -20,23 +20,26 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.test_files = spec.files.grep(%r{spec/})
|
21
21
|
spec.require_paths = ['lib']
|
22
22
|
|
23
|
-
spec.add_dependency '
|
24
|
-
spec.add_dependency 'aptible-api', '~> 1.5
|
25
|
-
spec.add_dependency 'aptible-auth', '~> 1.2.
|
23
|
+
spec.add_dependency 'activesupport', '>= 4.0', '< 6.0'
|
24
|
+
spec.add_dependency 'aptible-api', '~> 1.6.5'
|
25
|
+
spec.add_dependency 'aptible-auth', '~> 1.2.5'
|
26
26
|
spec.add_dependency 'aptible-billing', '~> 1.0'
|
27
|
-
spec.add_dependency '
|
28
|
-
spec.add_dependency 'git', '< 1.10'
|
29
|
-
spec.add_dependency 'term-ansicolor'
|
30
|
-
spec.add_dependency 'chronic_duration', '~> 0.10.6'
|
31
|
-
spec.add_dependency 'cbor'
|
27
|
+
spec.add_dependency 'aptible-resource', '~> 1.1'
|
32
28
|
spec.add_dependency 'aws-sdk', '~> 2.0'
|
33
29
|
spec.add_dependency 'bigdecimal', '~> 1.3.5' # https://github.com/ruby/bigdecimal#which-version-should-you-select
|
30
|
+
spec.add_dependency 'cbor'
|
31
|
+
spec.add_dependency 'chronic_duration', '~> 0.10.6'
|
32
|
+
spec.add_dependency 'concurrent-ruby', '< 1.1.10'
|
33
|
+
spec.add_dependency 'jwt', '~> 2.3.0'
|
34
|
+
spec.add_dependency 'git', '< 1.10'
|
35
|
+
spec.add_dependency 'rack', '~> 1.0'
|
36
|
+
spec.add_dependency 'term-ansicolor', '~> 1.8.0'
|
37
|
+
spec.add_dependency 'thor', '~> 0.20.0'
|
34
38
|
|
35
39
|
# Temporarily pin ffi until https://github.com/ffi/ffi/issues/868 is fixed
|
36
40
|
spec.add_dependency 'ffi', '<= 1.14.1' if Gem.win_platform?
|
37
41
|
spec.add_dependency 'win32-process' if Gem.win_platform?
|
38
42
|
|
39
|
-
spec.add_dependency 'activesupport', '>= 4.0', '< 6.0'
|
40
43
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
41
44
|
spec.add_development_dependency 'aptible-tasks', '~> 0.5.8'
|
42
45
|
spec.add_development_dependency 'rake'
|
@@ -52,7 +52,9 @@ module Aptible
|
|
52
52
|
handle: dest_handle,
|
53
53
|
container_size: options[:container_size],
|
54
54
|
disk_size: options[:size],
|
55
|
-
key_arn: options[:key_arn]
|
55
|
+
key_arn: options[:key_arn],
|
56
|
+
instance_profile: options[:instance_profile],
|
57
|
+
provisioned_iops: options[:provisioned_iops]
|
56
58
|
}.reject { |_, v| v.nil? }
|
57
59
|
|
58
60
|
if options[:logical]
|
@@ -47,16 +47,20 @@ module Aptible
|
|
47
47
|
end
|
48
48
|
|
49
49
|
desc 'apps:scale SERVICE ' \
|
50
|
-
'[--container-count COUNT] [--container-size SIZE_MB]'
|
50
|
+
'[--container-count COUNT] [--container-size SIZE_MB] ' \
|
51
|
+
'[--container-profile PROFILE]',
|
51
52
|
'Scale a service'
|
52
53
|
app_options
|
53
54
|
option :container_count, type: :numeric
|
54
55
|
option :container_size, type: :numeric
|
56
|
+
option :container_profile, type: :string,
|
57
|
+
desc: 'Examples: m c r'
|
55
58
|
define_method 'apps:scale' do |type|
|
56
59
|
service = ensure_service(options, type)
|
57
60
|
|
58
61
|
container_count = options[:container_count]
|
59
62
|
container_size = options[:container_size]
|
63
|
+
container_profile = options[:container_profile]
|
60
64
|
|
61
65
|
if options[:size]
|
62
66
|
m = 'You have used the "--size" option to specify a container '\
|
@@ -74,6 +78,7 @@ module Aptible
|
|
74
78
|
opts = { type: 'scale' }
|
75
79
|
opts[:container_count] = container_count if container_count
|
76
80
|
opts[:container_size] = container_size if container_size
|
81
|
+
opts[:instance_profile] = container_profile if container_profile
|
77
82
|
|
78
83
|
op = service.create_operation!(opts)
|
79
84
|
attach_to_operation_logs(op)
|
@@ -10,6 +10,7 @@ module Aptible
|
|
10
10
|
desc 'backup:restore BACKUP_ID ' \
|
11
11
|
'[--environment ENVIRONMENT_HANDLE] [--handle HANDLE] ' \
|
12
12
|
'[--container-size SIZE_MB] [--disk-size SIZE_GB] ' \
|
13
|
+
'[--container-profile PROFILE] [--iops IOPS] ' \
|
13
14
|
'[--key-arn KEY_ARN]',
|
14
15
|
'Restore a backup'
|
15
16
|
option :handle, desc: 'a name to use for the new database'
|
@@ -18,6 +19,9 @@ module Aptible
|
|
18
19
|
option :size, type: :numeric
|
19
20
|
option :disk_size, type: :numeric
|
20
21
|
option :key_arn, type: :string
|
22
|
+
option :container_profile, type: :string,
|
23
|
+
desc: 'Examples: m c r'
|
24
|
+
option :iops, type: :numeric
|
21
25
|
define_method 'backup:restore' do |backup_id|
|
22
26
|
backup = Aptible::Api::Backup.find(backup_id, token: fetch_token)
|
23
27
|
raise Thor::Error, "Backup ##{backup_id} not found" if backup.nil?
|
@@ -41,7 +45,9 @@ module Aptible
|
|
41
45
|
container_size: options[:container_size],
|
42
46
|
disk_size: options[:disk_size],
|
43
47
|
destination_account: destination_account,
|
44
|
-
key_arn: options[:key_arn]
|
48
|
+
key_arn: options[:key_arn],
|
49
|
+
instance_profile: options[:container_profile],
|
50
|
+
provisioned_iops: options[:iops]
|
45
51
|
}.delete_if { |_, v| v.nil? }
|
46
52
|
|
47
53
|
if options[:size]
|
@@ -33,8 +33,8 @@ module Aptible
|
|
33
33
|
desc 'backup_retention_policy:set [ENVIRONMENT_HANDLE] ' \
|
34
34
|
'[--daily DAILY_BACKUPS] [--monthly MONTHLY_BACKUPS] ' \
|
35
35
|
'[--yearly YEARLY_BACKUPS] [--make-copy|--no-make-copy] ' \
|
36
|
-
'[--keep-final|--no-keep-final]',
|
37
|
-
"Change the
|
36
|
+
'[--keep-final|--no-keep-final] [--force]',
|
37
|
+
"Change the environment's backup retention policy"
|
38
38
|
option :daily, type: :numeric,
|
39
39
|
desc: 'Number of daily backups to retain'
|
40
40
|
option :monthly, type: :numeric,
|
@@ -43,12 +43,14 @@ module Aptible
|
|
43
43
|
desc: 'Number of yearly backups to retain'
|
44
44
|
option :make_copy, type: :boolean,
|
45
45
|
desc: 'If backup copies should be created'
|
46
|
-
option
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
46
|
+
option :keep_final,
|
47
|
+
type: :boolean,
|
48
|
+
desc: 'If final backups should be kept when databases are ' \
|
49
|
+
'deprovisioned'
|
50
|
+
option :force,
|
51
|
+
type: :boolean,
|
52
|
+
desc: 'Do not prompt for confirmation if the new policy ' \
|
53
|
+
'retains fewer backups than the current policy'
|
52
54
|
define_method 'backup_retention_policy:set' do |env|
|
53
55
|
if options.empty?
|
54
56
|
raise Thor::Error,
|
@@ -69,11 +71,42 @@ module Aptible
|
|
69
71
|
# If any of the attribues are missing, raise an error so that
|
70
72
|
# we're not relying on the server's defaults
|
71
73
|
if attrs.values.any?(&:nil?)
|
72
|
-
raise Thor::Error, "
|
74
|
+
raise Thor::Error, "Environment #{env} does not have a " \
|
73
75
|
'custom backup retention policy. Please ' \
|
74
76
|
'specify all attributes to create one.'
|
75
77
|
end
|
76
78
|
|
79
|
+
# Check if the number of backups over any period have been reduced
|
80
|
+
do_confirm = %i(daily monthly yearly).any? do |a|
|
81
|
+
cur = current_policy.try(a)
|
82
|
+
next if cur.nil?
|
83
|
+
cur > attrs[a]
|
84
|
+
end
|
85
|
+
|
86
|
+
# Check if any of the boolean fields have been disabled
|
87
|
+
do_confirm ||= %i(make_copy keep_final).any? do |a|
|
88
|
+
cur = current_policy.try(a)
|
89
|
+
next if cur.nil?
|
90
|
+
cur && !attrs[a]
|
91
|
+
end
|
92
|
+
|
93
|
+
if do_confirm && !options[:force]
|
94
|
+
m = 'The specified backup retention policy retains fewer ' \
|
95
|
+
"backups than the environment's current policy. This may " \
|
96
|
+
'result in the deletion of existing, automated backups ' \
|
97
|
+
"if they exceed the new policy's rules and it may " \
|
98
|
+
"violate your company's internal compliance controls. " \
|
99
|
+
'For more information, see https://www.aptible.com/docs' \
|
100
|
+
'/core-concepts/managed-databases/managing-databases' \
|
101
|
+
'/database-backups.'
|
102
|
+
|
103
|
+
m = set_color(m, :yellow)
|
104
|
+
print_wrapped m
|
105
|
+
confirmation = yes?('Do you want to proceed [y/N]:')
|
106
|
+
puts ''
|
107
|
+
raise Thor::Error, 'Aborting' unless confirmation
|
108
|
+
end
|
109
|
+
|
77
110
|
new_policy = account.create_backup_retention_policy!(**attrs)
|
78
111
|
|
79
112
|
Formatter.render(Renderer.current) do |root|
|
@@ -54,6 +54,7 @@ module Aptible
|
|
54
54
|
desc 'db:create HANDLE ' \
|
55
55
|
'[--type TYPE] [--version VERSION] ' \
|
56
56
|
'[--container-size SIZE_MB] [--disk-size SIZE_GB] ' \
|
57
|
+
'[--container-profile PROFILE] [--iops IOPS] ' \
|
57
58
|
'[--key-arn KEY_ARN]',
|
58
59
|
'Create a new database'
|
59
60
|
option :type, type: :string
|
@@ -63,6 +64,9 @@ module Aptible
|
|
63
64
|
option :size, type: :numeric
|
64
65
|
option :key_arn, type: :string
|
65
66
|
option :environment
|
67
|
+
option :container_profile, type: :string,
|
68
|
+
desc: 'Examples: m c r'
|
69
|
+
option :iops, type: :numeric
|
66
70
|
define_method 'db:create' do |handle|
|
67
71
|
account = ensure_environment(options)
|
68
72
|
|
@@ -100,8 +104,11 @@ module Aptible
|
|
100
104
|
op_opts = {
|
101
105
|
type: 'provision',
|
102
106
|
container_size: options[:container_size],
|
103
|
-
disk_size: options[:disk_size]
|
107
|
+
disk_size: options[:disk_size],
|
108
|
+
instance_profile: options[:container_profile],
|
109
|
+
provisioned_iops: options[:iops]
|
104
110
|
}.delete_if { |_, v| v.nil? }
|
111
|
+
|
105
112
|
op = database.create_operation(op_opts)
|
106
113
|
|
107
114
|
if op.errors.any?
|
@@ -129,6 +136,7 @@ module Aptible
|
|
129
136
|
|
130
137
|
desc 'db:replicate HANDLE REPLICA_HANDLE ' \
|
131
138
|
'[--container-size SIZE_MB] [--disk-size SIZE_GB] ' \
|
139
|
+
'[--container-profile PROFILE] [--iops IOPS] ' \
|
132
140
|
'[--logical --version VERSION] [--key-arn KEY_ARN]',
|
133
141
|
'Create a replica/follower of a database'
|
134
142
|
option :environment
|
@@ -138,6 +146,9 @@ module Aptible
|
|
138
146
|
option :logical, type: :boolean
|
139
147
|
option :version, type: :string
|
140
148
|
option :key_arn, type: :string
|
149
|
+
option :container_profile, type: :string,
|
150
|
+
desc: 'Examples: m c r'
|
151
|
+
option :iops, type: :numeric
|
141
152
|
define_method 'db:replicate' do |source_handle, dest_handle|
|
142
153
|
source = ensure_database(options.merge(db: source_handle))
|
143
154
|
|
@@ -162,7 +173,9 @@ module Aptible
|
|
162
173
|
size: options[:disk_size],
|
163
174
|
logical: options[:logical],
|
164
175
|
database_image: image || nil,
|
165
|
-
key_arn: options[:key_arn]
|
176
|
+
key_arn: options[:key_arn],
|
177
|
+
instance_profile: options[:container_profile],
|
178
|
+
provisioned_iops: options[:iops]
|
166
179
|
}.delete_if { |_, v| v.nil? }
|
167
180
|
|
168
181
|
if options[:size]
|
@@ -284,10 +297,13 @@ module Aptible
|
|
284
297
|
|
285
298
|
desc 'db:restart HANDLE ' \
|
286
299
|
'[--container-size SIZE_MB] [--disk-size SIZE_GB] ' \
|
287
|
-
'[--
|
300
|
+
'[--container-profile PROFILE] [--iops IOPS] ' \
|
301
|
+
'[--volume-type [gp2, gp3]]',
|
288
302
|
'Restart a database'
|
289
303
|
option :environment
|
290
304
|
option :container_size, type: :numeric
|
305
|
+
option :container_profile, type: :string,
|
306
|
+
desc: 'Examples: m c r'
|
291
307
|
option :disk_size, type: :numeric
|
292
308
|
option :size, type: :numeric
|
293
309
|
option :iops, type: :numeric
|
@@ -300,7 +316,8 @@ module Aptible
|
|
300
316
|
container_size: options[:container_size],
|
301
317
|
disk_size: options[:disk_size],
|
302
318
|
provisioned_iops: options[:iops],
|
303
|
-
ebs_volume_type: options[:volume_type]
|
319
|
+
ebs_volume_type: options[:volume_type],
|
320
|
+
instance_profile: options[:container_profile]
|
304
321
|
}.delete_if { |_, v| v.nil? }
|
305
322
|
|
306
323
|
if options[:size]
|
@@ -327,7 +344,8 @@ module Aptible
|
|
327
344
|
opts = {
|
328
345
|
type: 'modify',
|
329
346
|
provisioned_iops: options[:iops],
|
330
|
-
ebs_volume_type: options[:volume_type]
|
347
|
+
ebs_volume_type: options[:volume_type],
|
348
|
+
instance_profile: options[:container_profile]
|
331
349
|
}.delete_if { |_, v| v.nil? }
|
332
350
|
|
333
351
|
CLI.logger.info "Modifying #{database.handle}..."
|
@@ -29,6 +29,16 @@ module Aptible
|
|
29
29
|
desc: 'Detach this app from its git repository: ' \
|
30
30
|
'its Procfile, Dockerfile, and .aptible.yml will be ' \
|
31
31
|
'ignored until you deploy again with git'
|
32
|
+
option :container_count, type: :numeric,
|
33
|
+
desc: 'This option only affects new ' \
|
34
|
+
'services, not existing ones.'
|
35
|
+
option :container_size, type: :numeric,
|
36
|
+
desc: 'This option only affects new ' \
|
37
|
+
'services, not existing ones.'
|
38
|
+
option :container_profile, type: :string,
|
39
|
+
desc: 'This option only affects new ' \
|
40
|
+
'services, not existing ones. ' \
|
41
|
+
'Examples: m c r'
|
32
42
|
DOCKER_IMAGE_DEPLOY_ARGS.each_pair do |opt, var|
|
33
43
|
option opt,
|
34
44
|
type: :string, banner: var,
|
@@ -63,8 +73,11 @@ module Aptible
|
|
63
73
|
opts = {
|
64
74
|
type: 'deploy',
|
65
75
|
env: env,
|
66
|
-
git_ref: git_ref
|
67
|
-
|
76
|
+
git_ref: git_ref,
|
77
|
+
container_count: options[:container_count],
|
78
|
+
container_size: options[:container_size],
|
79
|
+
instance_profile: options[:container_profile]
|
80
|
+
}.delete_if { |_, v| v.nil? || v.try(:empty?) }
|
68
81
|
|
69
82
|
allow_it = [
|
70
83
|
opts[:git_ref],
|
@@ -107,6 +107,36 @@ module Aptible
|
|
107
107
|
modify_app_vhost(tls_modify_flags, options, hostname)
|
108
108
|
end
|
109
109
|
|
110
|
+
grpc_create_flags = Helpers::Vhost::OptionSetBuilder.new do
|
111
|
+
app!
|
112
|
+
create!
|
113
|
+
port!
|
114
|
+
tls!
|
115
|
+
end
|
116
|
+
|
117
|
+
desc 'endpoints:grpc:create [--app APP] SERVICE',
|
118
|
+
'Create an App gRPC Endpoint'
|
119
|
+
grpc_create_flags.declare_options(self)
|
120
|
+
define_method 'endpoints:grpc:create' do |type|
|
121
|
+
create_app_vhost(
|
122
|
+
grpc_create_flags, options, type,
|
123
|
+
type: 'grpc', platform: 'elb'
|
124
|
+
)
|
125
|
+
end
|
126
|
+
|
127
|
+
grpc_modify_flags = Helpers::Vhost::OptionSetBuilder.new do
|
128
|
+
app!
|
129
|
+
port!
|
130
|
+
tls!
|
131
|
+
end
|
132
|
+
|
133
|
+
desc 'endpoints:grpc:modify [--app APP] ENDPOINT_HOSTNAME',
|
134
|
+
'Modify an App gRPC Endpoint'
|
135
|
+
grpc_modify_flags.declare_options(self)
|
136
|
+
define_method 'endpoints:grpc:modify' do |hostname|
|
137
|
+
modify_app_vhost(grpc_modify_flags, options, hostname)
|
138
|
+
end
|
139
|
+
|
110
140
|
https_create_flags = Helpers::Vhost::OptionSetBuilder.new do
|
111
141
|
app!
|
112
142
|
create!
|
@@ -175,7 +205,7 @@ module Aptible
|
|
175
205
|
|
176
206
|
WARNING: review the documentation on rate limits before using
|
177
207
|
this command automatically
|
178
|
-
(
|
208
|
+
(https://www.aptible.com/docs/core-concepts/apps/connecting-to-apps/app-endpoints/managed-tls#rate-limits).
|
179
209
|
LONGDESC
|
180
210
|
app_options
|
181
211
|
define_method 'endpoints:renew' do |hostname|
|
@@ -21,6 +21,29 @@ module Aptible
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
24
|
+
|
25
|
+
desc 'services:settings SERVICE'\
|
26
|
+
' [--force-zero-downtime|--no-force-zero-downtime]'\
|
27
|
+
' [--simple-health-check|--no-simple-health-check]',
|
28
|
+
'Modifies the zero-downtime deploy setting for a service'
|
29
|
+
app_options
|
30
|
+
option :force_zero_downtime,
|
31
|
+
type: :boolean, default: false,
|
32
|
+
desc: 'Force zero downtime deployments.'\
|
33
|
+
' Has no effect if service has an associated Endpoint'
|
34
|
+
option :simple_health_check,
|
35
|
+
type: :boolean, default: false,
|
36
|
+
desc: 'Use a simple uptime healthcheck during deployments'
|
37
|
+
define_method 'services:settings' do |service|
|
38
|
+
service = ensure_service(options, service)
|
39
|
+
updates = {}
|
40
|
+
updates[:force_zero_downtime] =
|
41
|
+
options[:force_zero_downtime] if options[:force_zero_downtime]
|
42
|
+
updates[:naive_health_check] =
|
43
|
+
options[:simple_health_check] if options[:simple_health_check]
|
44
|
+
|
45
|
+
service.update!(**updates) if updates.any?
|
46
|
+
end
|
24
47
|
end
|
25
48
|
end
|
26
49
|
end
|
data/lib/aptible/cli/version.rb
CHANGED