aptible-cli 0.26.1 → 0.26.4
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/.rubocop.yml +5 -0
- data/Gemfile.lock +2 -2
- data/Makefile +3 -0
- data/README.md +83 -83
- data/lib/aptible/cli/agent.rb +14 -4
- data/lib/aptible/cli/helpers/app.rb +11 -0
- data/lib/aptible/cli/helpers/database.rb +29 -13
- data/lib/aptible/cli/helpers/log_drain.rb +3 -1
- data/lib/aptible/cli/helpers/metric_drain.rb +3 -1
- data/lib/aptible/cli/resource_formatter.rb +16 -3
- data/lib/aptible/cli/subcommands/apps.rb +2 -2
- data/lib/aptible/cli/subcommands/config.rb +8 -8
- data/lib/aptible/cli/subcommands/db.rb +4 -3
- data/lib/aptible/cli/subcommands/deploy.rb +1 -1
- data/lib/aptible/cli/subcommands/log_drain.rb +2 -0
- data/lib/aptible/cli/subcommands/logs.rb +5 -5
- data/lib/aptible/cli/subcommands/metric_drain.rb +2 -0
- data/lib/aptible/cli/subcommands/rebuild.rb +2 -1
- data/lib/aptible/cli/subcommands/restart.rb +2 -1
- data/lib/aptible/cli/subcommands/services.rb +4 -4
- data/lib/aptible/cli/subcommands/ssh.rb +1 -1
- data/lib/aptible/cli/version.rb +1 -1
- data/lib/aptible/cli.rb +14 -0
- data/spec/aptible/cli/agent_spec.rb +70 -0
- data/spec/aptible/cli/subcommands/config_spec.rb +8 -0
- data/spec/aptible/cli/subcommands/db_spec.rb +3 -51
- data/spec/aptible/cli/subcommands/log_drain_spec.rb +6 -0
- data/spec/aptible/cli/subcommands/metric_drain_spec.rb +4 -0
- data/spec/fabricators/account_fabricator.rb +9 -1
- data/spec/fabricators/app_external_aws_rds_connection_fabricator.rb +1 -1
- data/spec/fabricators/app_fabricator.rb +1 -1
- data/spec/fabricators/backup_fabricator.rb +1 -1
- data/spec/fabricators/backup_retention_policy_fabricator.rb +1 -1
- data/spec/fabricators/certificate_fabricator.rb +1 -1
- data/spec/fabricators/configuration_fabricator.rb +1 -1
- data/spec/fabricators/database_credential_fabricator.rb +1 -1
- data/spec/fabricators/database_disk_fabricator.rb +1 -1
- data/spec/fabricators/database_fabricator.rb +10 -1
- data/spec/fabricators/database_image_fabricator.rb +1 -1
- data/spec/fabricators/external_aws_account_fabricator.rb +1 -1
- data/spec/fabricators/external_aws_database_credential_fabricator.rb +1 -1
- data/spec/fabricators/external_aws_resource_fabricator.rb +1 -1
- data/spec/fabricators/log_drain_fabricator.rb +1 -1
- data/spec/fabricators/maintenance_app_fabricator.rb +1 -1
- data/spec/fabricators/maintenance_database_fabricator.rb +1 -1
- data/spec/fabricators/metric_drain_fabricator.rb +15 -1
- data/spec/fabricators/operation_fabricator.rb +1 -1
- data/spec/fabricators/service_fabricator.rb +1 -1
- data/spec/fabricators/service_sizing_policy_fabricator.rb +1 -1
- data/spec/fabricators/stack_fabricator.rb +1 -1
- data/spec/fabricators/vhost_fabricator.rb +1 -1
- data/spec/spec_helper.rb +5 -0
- data/spec/support/stub_aptible_resource.rb +25 -0
- metadata +5 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1c756f930a26ab5b060f01270b80c9ec2963c8f739be4ffcd2a5d56e9dac2860
|
|
4
|
+
data.tar.gz: 55fdde5cde257bd36c6c16a17e7f639745f85947b1cf40269c0d73ab0093615c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 01122dab06813f9b67100c11e6e59ec6942f5263340efc26bbf73440b51c39c7cd0be7258b987fa39056092b29bf181ded4d14423d27ff795cd18bf85b97fe96
|
|
7
|
+
data.tar.gz: d7ed67882c43c958dcc60c7ef5ba518f3eb6ad72ca014f4c0b761478f2748054af64286aca26b8ac97b5ca5ea03964bc34fd422d3cf42f4996b4c6949815d870
|
data/.rubocop.yml
ADDED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
aptible-cli (0.26.
|
|
4
|
+
aptible-cli (0.26.4)
|
|
5
5
|
activesupport (>= 4.0, < 6.0)
|
|
6
6
|
aptible-api (~> 1.12)
|
|
7
7
|
aptible-auth (~> 1.4)
|
|
@@ -35,7 +35,7 @@ GEM
|
|
|
35
35
|
tzinfo (~> 1.1)
|
|
36
36
|
addressable (2.8.0)
|
|
37
37
|
public_suffix (>= 2.0.2, < 5.0)
|
|
38
|
-
aptible-api (1.12.
|
|
38
|
+
aptible-api (1.12.2)
|
|
39
39
|
aptible-auth
|
|
40
40
|
aptible-resource
|
|
41
41
|
gem_config
|
data/Makefile
CHANGED
data/README.md
CHANGED
|
@@ -26,89 +26,89 @@ From `aptible help`:
|
|
|
26
26
|
<!-- BEGIN USAGE -->
|
|
27
27
|
```
|
|
28
28
|
Commands:
|
|
29
|
-
aptible apps
|
|
30
|
-
aptible apps:create HANDLE
|
|
31
|
-
aptible apps:deprovision # Deprovision an app
|
|
32
|
-
aptible apps:rename OLD_HANDLE NEW_HANDLE [--environment ENVIRONMENT_HANDLE]
|
|
33
|
-
aptible apps:scale SERVICE [--container-count COUNT] [--container-size SIZE_MB] [--container-profile PROFILE] # Scale a service
|
|
34
|
-
aptible backup:list DB_HANDLE
|
|
35
|
-
aptible backup:orphaned
|
|
36
|
-
aptible backup:purge BACKUP_ID
|
|
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]
|
|
38
|
-
aptible backup_retention_policy [ENVIRONMENT_HANDLE]
|
|
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]
|
|
40
|
-
aptible config # Print an app's current configuration
|
|
41
|
-
aptible config:add [VAR1=VAL1] [VAR2=VAL2] [...] # Add an ENV variable to an app
|
|
42
|
-
aptible config:get [VAR1] # Print a specific key within an app's current configuration
|
|
43
|
-
aptible config:rm [VAR1] [VAR2] [...] # Remove an ENV variable from an app
|
|
44
|
-
aptible config:set [VAR1=VAL1] [VAR2=VAL2] [...] # Add an ENV variable to an app
|
|
45
|
-
aptible config:unset [VAR1] [VAR2] [...] # Remove an ENV variable from an app
|
|
46
|
-
aptible db:backup HANDLE
|
|
47
|
-
aptible db:clone SOURCE DEST
|
|
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]
|
|
49
|
-
aptible db:deprovision HANDLE
|
|
50
|
-
aptible db:dump HANDLE [pg_dump options]
|
|
51
|
-
aptible db:execute HANDLE SQL_FILE [--on-error-stop]
|
|
52
|
-
aptible db:list
|
|
53
|
-
aptible db:modify HANDLE [--iops IOPS] [--volume-type [gp2, gp3]]
|
|
54
|
-
aptible db:reload HANDLE
|
|
55
|
-
aptible db:rename OLD_HANDLE NEW_HANDLE [--environment ENVIRONMENT_HANDLE]
|
|
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]
|
|
57
|
-
aptible db:restart HANDLE [--container-size SIZE_MB] [--disk-size SIZE_GB] [--container-profile PROFILE] [--iops IOPS] [--volume-type [gp2, gp3]]
|
|
58
|
-
aptible db:tunnel HANDLE
|
|
59
|
-
aptible db:url HANDLE
|
|
60
|
-
aptible db:versions
|
|
61
|
-
aptible deploy [OPTIONS] [VAR1=VAL1] [VAR2=VAL2] [...] # Deploy an app
|
|
62
|
-
aptible endpoints:database:create DATABASE
|
|
63
|
-
aptible endpoints:database:modify --database DATABASE ENDPOINT_HOSTNAME
|
|
64
|
-
aptible endpoints:deprovision [--app APP | --database DATABASE] ENDPOINT_HOSTNAME
|
|
65
|
-
aptible endpoints:grpc:create [--app APP] SERVICE
|
|
66
|
-
aptible endpoints:grpc:modify [--app APP] ENDPOINT_HOSTNAME
|
|
67
|
-
aptible endpoints:https:create [--app APP] SERVICE
|
|
68
|
-
aptible endpoints:https:modify [--app APP] ENDPOINT_HOSTNAME
|
|
69
|
-
aptible endpoints:list [--app APP | --database DATABASE]
|
|
70
|
-
aptible endpoints:renew [--app APP] ENDPOINT_HOSTNAME
|
|
71
|
-
aptible endpoints:tcp:create [--app APP] SERVICE
|
|
72
|
-
aptible endpoints:tcp:modify [--app APP] ENDPOINT_HOSTNAME
|
|
73
|
-
aptible endpoints:tls:create [--app APP] SERVICE
|
|
74
|
-
aptible endpoints:tls:modify [--app APP] ENDPOINT_HOSTNAME
|
|
75
|
-
aptible environment:ca_cert
|
|
76
|
-
aptible environment:list
|
|
77
|
-
aptible environment:rename OLD_HANDLE NEW_HANDLE
|
|
78
|
-
aptible help [COMMAND]
|
|
79
|
-
aptible log_drain:create:datadog HANDLE --url DATADOG_URL --environment ENVIRONMENT [--drain-apps|--no-drain-apps] [--drain-databases|--no-drain-databases] [--drain-ephemeral-sessions|--no-drain-ephemeral-sessions] [--drain_proxies|--no-drain-proxies]
|
|
80
|
-
aptible log_drain:create:elasticsearch HANDLE --db DATABASE_HANDLE --environment ENVIRONMENT [--drain-apps|--no-drain-apps] [--drain-databases|--no-drain-databases] [--drain-ephemeral-sessions|--no-drain-ephemeral-sessions] [--drain_proxies|--no-drain-proxies]
|
|
81
|
-
aptible log_drain:create:https HANDLE --url URL --environment ENVIRONMENT [--drain-apps|--no-drain-apps] [--drain-databases|--no-drain-databases] [--drain-ephemeral-sessions|--no-drain-ephemeral-sessions] [--drain_proxies|--no-drain-proxies]
|
|
82
|
-
aptible log_drain:create:logdna HANDLE --url LOGDNA_URL --environment ENVIRONMENT [--drain-apps|--no-drain-apps] [--drain-databases|--no-drain-databases] [--drain-ephemeral-sessions|--no-drain-ephemeral-sessions] [--drain_proxies|--no-drain-proxies]
|
|
83
|
-
aptible log_drain:create:papertrail HANDLE --host PAPERTRAIL_HOST --port PAPERTRAIL_PORT --environment ENVIRONMENT [--drain-apps|--no-drain-apps] [--drain-databases|--no-drain-databases] [--drain-ephemeral-sessions|--no-drain-ephemeral-sessions] [--drain_proxies|--no-drain-proxies]
|
|
84
|
-
aptible log_drain:create:solarwinds HANDLE --host SWO_HOSTNAME --token SWO_TOKEN --environment ENVIRONMENT [--drain-apps|--no-drain-apps] [--drain-databases|--no-drain-databases] [--drain-ephemeral-sessions|--no-drain-ephemeral-sessions] [--drain_proxies|--no-drain-proxies]
|
|
85
|
-
aptible log_drain:create:sumologic HANDLE --url SUMOLOGIC_URL --environment ENVIRONMENT [--drain-apps|--no-drain-apps] [--drain-databases|--no-drain-databases] [--drain-ephemeral-sessions|--no-drain-ephemeral-sessions] [--drain_proxies|--no-drain-proxies]
|
|
86
|
-
aptible log_drain:create:syslog HANDLE --host SYSLOG_HOST --port SYSLOG_PORT [--token TOKEN] --environment ENVIRONMENT [--drain-apps|--no-drain-apps] [--drain-databases|--no-drain-databases] [--drain-ephemeral-sessions|--no-drain-ephemeral-sessions] [--drain_proxies|--no-drain-proxies]
|
|
87
|
-
aptible log_drain:deprovision HANDLE --environment ENVIRONMENT
|
|
88
|
-
aptible log_drain:list
|
|
89
|
-
aptible login
|
|
90
|
-
aptible logs [--app APP | --database DATABASE]
|
|
91
|
-
aptible logs_from_archive --bucket NAME --region REGION --stack NAME [ --decryption-keys ONE [OR MORE] ] [ --download-location LOCATION ] [ [ --string-matches ONE [OR MORE] ] | [ --app-id ID | --database-id ID | --endpoint-id ID | --container-id ID ] [ --start-date YYYY-MM-DD --end-date YYYY-MM-DD ] ] --bucket=BUCKET --region=REGION --stack=STACK
|
|
92
|
-
aptible maintenance:apps
|
|
93
|
-
aptible maintenance:dbs
|
|
94
|
-
aptible metric_drain:create:datadog HANDLE --api_key DATADOG_API_KEY --site DATADOG_SITE --environment ENVIRONMENT
|
|
95
|
-
aptible metric_drain:create:influxdb HANDLE --db DATABASE_HANDLE --environment ENVIRONMENT
|
|
96
|
-
aptible metric_drain:create:influxdb:custom HANDLE --username USERNAME --password PASSWORD --url URL_INCLUDING_PORT --db INFLUX_DATABASE_NAME --environment ENVIRONMENT
|
|
97
|
-
aptible metric_drain:create:influxdb:customv2 HANDLE --org ORGANIZATION --token INFLUX_TOKEN --url URL_INCLUDING_PORT --bucket INFLUX_BUCKET_NAME --environment ENVIRONMENT
|
|
98
|
-
aptible metric_drain:deprovision HANDLE --environment ENVIRONMENT
|
|
99
|
-
aptible metric_drain:list
|
|
100
|
-
aptible operation:cancel OPERATION_ID
|
|
101
|
-
aptible operation:follow OPERATION_ID
|
|
102
|
-
aptible operation:logs OPERATION_ID
|
|
103
|
-
aptible organizations
|
|
104
|
-
aptible rebuild # Rebuild an app, and restart its services
|
|
105
|
-
aptible restart # Restart all services associated with an app
|
|
106
|
-
aptible services # List Services for an App
|
|
107
|
-
aptible services:autoscaling_policy SERVICE # Returns the associated sizing policy, if any
|
|
108
|
-
aptible services:autoscaling_policy:set SERVICE --autoscaling-type (horizontal|vertical) [--metric-lookback-seconds SECONDS] [--percentile PERCENTILE] [--post-scale-up-cooldown-seconds SECONDS] [--post-scale-down-cooldown-seconds SECONDS] [--post-release-cooldown-seconds SECONDS] [--mem-cpu-ratio-r-threshold RATIO] [--mem-cpu-ratio-c-threshold RATIO] [--mem-scale-up-threshold THRESHOLD] [--mem-scale-down-threshold THRESHOLD] [--minimum-memory MEMORY] [--maximum-memory MEMORY] [--min-cpu-threshold THRESHOLD] [--max-cpu-threshold THRESHOLD] [--min-containers CONTAINERS] [--max-containers CONTAINERS] [--scale-up-step STEPS] [--scale-down-step STEPS] [--restart-free-scale|--no-restart-free-scale] # Sets the sizing (autoscaling) policy for a service. This is not incremental, all arguments must be sent at once or they will be set to defaults.
|
|
109
|
-
aptible services:settings SERVICE [--force-zero-downtime|--no-force-zero-downtime] [--simple-health-check|--no-simple-health-check] [--restart-free-scaling|--no-restart-free-scaling] [--stop-timeout SECONDS] # Modifies the deployment settings for a service
|
|
110
|
-
aptible ssh [COMMAND] # Run a command against an app
|
|
111
|
-
aptible version
|
|
29
|
+
aptible apps # List all applications
|
|
30
|
+
aptible apps:create HANDLE # Create a new application
|
|
31
|
+
aptible apps:deprovision [--app APP] # Deprovision an app
|
|
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 [--app APP] SERVICE [--container-count COUNT] [--container-size SIZE_MB] [--container-profile PROFILE] # Scale a service
|
|
34
|
+
aptible backup:list DB_HANDLE # List backups for a database
|
|
35
|
+
aptible backup:orphaned # List backups associated with deprovisioned databases
|
|
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] [--container-profile PROFILE] [--iops IOPS] [--key-arn KEY_ARN] # Restore a backup
|
|
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] [--force] # Change the environment's backup retention policy
|
|
40
|
+
aptible config [--app APP] # Print an app's current configuration
|
|
41
|
+
aptible config:add [--app APP] [VAR1=VAL1] [VAR2=VAL2] [...] # Add an ENV variable to an app
|
|
42
|
+
aptible config:get [--app APP] [VAR1] # Print a specific key within an app's current configuration
|
|
43
|
+
aptible config:rm [--app APP] [VAR1] [VAR2] [...] # Remove an ENV variable from an app
|
|
44
|
+
aptible config:set [--app APP] [VAR1=VAL1] [VAR2=VAL2] [...] # Add an ENV variable to an app
|
|
45
|
+
aptible config:unset [--app APP] [VAR1] [VAR2] [...] # Remove an ENV variable from an app
|
|
46
|
+
aptible db:backup HANDLE # Backup a database
|
|
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] [--container-profile PROFILE] [--iops IOPS] [--key-arn KEY_ARN] # Create a new database
|
|
49
|
+
aptible db:deprovision HANDLE # Deprovision a database
|
|
50
|
+
aptible db:dump HANDLE [pg_dump options] # Dump a remote database to file
|
|
51
|
+
aptible db:execute HANDLE SQL_FILE [--on-error-stop] # Executes sql against a database
|
|
52
|
+
aptible db:list # List all databases
|
|
53
|
+
aptible db:modify HANDLE [--iops IOPS] [--volume-type [gp2, gp3]] # Modify a database disk
|
|
54
|
+
aptible db:reload HANDLE # Reload a database
|
|
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] [--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
|
+
aptible db:tunnel HANDLE # Create a local tunnel to a database
|
|
59
|
+
aptible db:url HANDLE # Display a database URL
|
|
60
|
+
aptible db:versions # List available database versions
|
|
61
|
+
aptible deploy [--app APP] [OPTIONS] [VAR1=VAL1] [VAR2=VAL2] [...] # Deploy an app
|
|
62
|
+
aptible endpoints:database:create DATABASE # Create a Database Endpoint
|
|
63
|
+
aptible endpoints:database:modify --database DATABASE ENDPOINT_HOSTNAME # Modify a Database Endpoint
|
|
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
|
|
67
|
+
aptible endpoints:https:create [--app APP] SERVICE # Create an App HTTPS Endpoint
|
|
68
|
+
aptible endpoints:https:modify [--app APP] ENDPOINT_HOSTNAME # Modify an App HTTPS Endpoint
|
|
69
|
+
aptible endpoints:list [--app APP | --database DATABASE] # List Endpoints for an App or Database
|
|
70
|
+
aptible endpoints:renew [--app APP] ENDPOINT_HOSTNAME # Renew an App Managed TLS Endpoint
|
|
71
|
+
aptible endpoints:tcp:create [--app APP] SERVICE # Create an App TCP Endpoint
|
|
72
|
+
aptible endpoints:tcp:modify [--app APP] ENDPOINT_HOSTNAME # Modify an App TCP Endpoint
|
|
73
|
+
aptible endpoints:tls:create [--app APP] SERVICE # Create an App TLS Endpoint
|
|
74
|
+
aptible endpoints:tls:modify [--app APP] ENDPOINT_HOSTNAME # Modify an App TLS Endpoint
|
|
75
|
+
aptible environment:ca_cert # Retrieve the CA certificate associated with the environment
|
|
76
|
+
aptible environment:list # List all environments
|
|
77
|
+
aptible environment:rename OLD_HANDLE NEW_HANDLE # Rename an environment handle. In order for the new environment handle to appear in log drain/metric destinations, you must restart the apps/databases in this environment.
|
|
78
|
+
aptible help [COMMAND] # Describe available commands or one specific command
|
|
79
|
+
aptible log_drain:create:datadog HANDLE --url DATADOG_URL --environment ENVIRONMENT [--drain-apps|--no-drain-apps] [--drain-databases|--no-drain-databases] [--drain-ephemeral-sessions|--no-drain-ephemeral-sessions] [--drain_proxies|--no-drain-proxies] # Create a Datadog Log Drain. By default, App, Database, Ephemeral Session, and Proxy logs will be sent to your chosen destination.
|
|
80
|
+
aptible log_drain:create:elasticsearch HANDLE --db DATABASE_HANDLE --environment ENVIRONMENT [--drain-apps|--no-drain-apps] [--drain-databases|--no-drain-databases] [--drain-ephemeral-sessions|--no-drain-ephemeral-sessions] [--drain_proxies|--no-drain-proxies] # Create an Elasticsearch Log Drain. By default, App, Database, Ephemeral Session, and Proxy logs will be sent to your chosen destination.
|
|
81
|
+
aptible log_drain:create:https HANDLE --url URL --environment ENVIRONMENT [--drain-apps|--no-drain-apps] [--drain-databases|--no-drain-databases] [--drain-ephemeral-sessions|--no-drain-ephemeral-sessions] [--drain_proxies|--no-drain-proxies] # Create a HTTPS Drain
|
|
82
|
+
aptible log_drain:create:logdna HANDLE --url LOGDNA_URL --environment ENVIRONMENT [--drain-apps|--no-drain-apps] [--drain-databases|--no-drain-databases] [--drain-ephemeral-sessions|--no-drain-ephemeral-sessions] [--drain_proxies|--no-drain-proxies] # Create a LogDNA/Mezmo Log Drain. By default, App, Database, Ephemeral Session, and Proxy logs will be sent to your chosen destination.
|
|
83
|
+
aptible log_drain:create:papertrail HANDLE --host PAPERTRAIL_HOST --port PAPERTRAIL_PORT --environment ENVIRONMENT [--drain-apps|--no-drain-apps] [--drain-databases|--no-drain-databases] [--drain-ephemeral-sessions|--no-drain-ephemeral-sessions] [--drain_proxies|--no-drain-proxies] # Create a Papertrail Log Drain. By default, App, Database, Ephemeral Session, and Proxy logs will be sent to your chosen destination.
|
|
84
|
+
aptible log_drain:create:solarwinds HANDLE --host SWO_HOSTNAME --token SWO_TOKEN --environment ENVIRONMENT [--drain-apps|--no-drain-apps] [--drain-databases|--no-drain-databases] [--drain-ephemeral-sessions|--no-drain-ephemeral-sessions] [--drain_proxies|--no-drain-proxies] # Create a SolarWinds Log Drain. By default, App, Database, Ephemeral Session, and Proxy logs will be sent to your chosen destination.
|
|
85
|
+
aptible log_drain:create:sumologic HANDLE --url SUMOLOGIC_URL --environment ENVIRONMENT [--drain-apps|--no-drain-apps] [--drain-databases|--no-drain-databases] [--drain-ephemeral-sessions|--no-drain-ephemeral-sessions] [--drain_proxies|--no-drain-proxies] # Create a Sumologic Drain. By default, App, Database, Ephemeral Session, and Proxy logs will be sent to your chosen destination.
|
|
86
|
+
aptible log_drain:create:syslog HANDLE --host SYSLOG_HOST --port SYSLOG_PORT [--token TOKEN] --environment ENVIRONMENT [--drain-apps|--no-drain-apps] [--drain-databases|--no-drain-databases] [--drain-ephemeral-sessions|--no-drain-ephemeral-sessions] [--drain_proxies|--no-drain-proxies] # Create a Syslog Log Drain. By default, App, Database, Ephemeral Session, and Proxy logs will be sent to your chosen destination.
|
|
87
|
+
aptible log_drain:deprovision HANDLE --environment ENVIRONMENT # Deprovisions a log drain
|
|
88
|
+
aptible log_drain:list # List all Log Drains
|
|
89
|
+
aptible login # Log in to Aptible
|
|
90
|
+
aptible logs [--app APP | --database DATABASE] # Follows logs from a running app or database
|
|
91
|
+
aptible logs_from_archive --bucket NAME --region REGION --stack NAME [ --decryption-keys ONE [OR MORE] ] [ --download-location LOCATION ] [ [ --string-matches ONE [OR MORE] ] | [ --app-id ID | --database-id ID | --endpoint-id ID | --container-id ID ] [ --start-date YYYY-MM-DD --end-date YYYY-MM-DD ] ] --bucket=BUCKET --region=REGION --stack=STACK # Retrieves container logs from an S3 archive in your own AWS account. You must provide your AWS credentials via the environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
|
|
92
|
+
aptible maintenance:apps # List Apps impacted by maintenance schedules where restarts are required
|
|
93
|
+
aptible maintenance:dbs # List Databases impacted by maintenance schedules where restarts are required
|
|
94
|
+
aptible metric_drain:create:datadog HANDLE --api_key DATADOG_API_KEY --site DATADOG_SITE --environment ENVIRONMENT # Create a Datadog Metric Drain
|
|
95
|
+
aptible metric_drain:create:influxdb HANDLE --db DATABASE_HANDLE --environment ENVIRONMENT # Create an InfluxDB Metric Drain
|
|
96
|
+
aptible metric_drain:create:influxdb:custom HANDLE --username USERNAME --password PASSWORD --url URL_INCLUDING_PORT --db INFLUX_DATABASE_NAME --environment ENVIRONMENT # Create an InfluxDB Metric Drain
|
|
97
|
+
aptible metric_drain:create:influxdb:customv2 HANDLE --org ORGANIZATION --token INFLUX_TOKEN --url URL_INCLUDING_PORT --bucket INFLUX_BUCKET_NAME --environment ENVIRONMENT # Create an InfluxDB v2 Metric Drain
|
|
98
|
+
aptible metric_drain:deprovision HANDLE --environment ENVIRONMENT # Deprovisions a Metric Drain
|
|
99
|
+
aptible metric_drain:list # List all Metric Drains
|
|
100
|
+
aptible operation:cancel OPERATION_ID # Cancel a running operation
|
|
101
|
+
aptible operation:follow OPERATION_ID # Follow logs of a running operation
|
|
102
|
+
aptible operation:logs OPERATION_ID # View logs for given operation
|
|
103
|
+
aptible organizations # List all organizations
|
|
104
|
+
aptible rebuild [--app APP] # Rebuild an app, and restart its services
|
|
105
|
+
aptible restart [--app APP] # Restart all services associated with an app
|
|
106
|
+
aptible services [--app APP] # List Services for an App
|
|
107
|
+
aptible services:autoscaling_policy [--app APP] SERVICE # Returns the associated sizing policy, if any
|
|
108
|
+
aptible services:autoscaling_policy:set [--app APP] SERVICE --autoscaling-type (horizontal|vertical) [--metric-lookback-seconds SECONDS] [--percentile PERCENTILE] [--post-scale-up-cooldown-seconds SECONDS] [--post-scale-down-cooldown-seconds SECONDS] [--post-release-cooldown-seconds SECONDS] [--mem-cpu-ratio-r-threshold RATIO] [--mem-cpu-ratio-c-threshold RATIO] [--mem-scale-up-threshold THRESHOLD] [--mem-scale-down-threshold THRESHOLD] [--minimum-memory MEMORY] [--maximum-memory MEMORY] [--min-cpu-threshold THRESHOLD] [--max-cpu-threshold THRESHOLD] [--min-containers CONTAINERS] [--max-containers CONTAINERS] [--scale-up-step STEPS] [--scale-down-step STEPS] [--restart-free-scale|--no-restart-free-scale] # Sets the sizing (autoscaling) policy for a service. This is not incremental, all arguments must be sent at once or they will be set to defaults.
|
|
109
|
+
aptible services:settings [--app APP] SERVICE [--force-zero-downtime|--no-force-zero-downtime] [--simple-health-check|--no-simple-health-check] [--restart-free-scaling|--no-restart-free-scaling] [--stop-timeout SECONDS] # Modifies the deployment settings for a service
|
|
110
|
+
aptible ssh [--app APP] [COMMAND] # Run a command against an app
|
|
111
|
+
aptible version # Print Aptible CLI version
|
|
112
112
|
```
|
|
113
113
|
<!-- END USAGE -->
|
|
114
114
|
|
data/lib/aptible/cli/agent.rb
CHANGED
|
@@ -92,10 +92,13 @@ module Aptible
|
|
|
92
92
|
level = Logger::WARN
|
|
93
93
|
debug_level = ENV['APTIBLE_DEBUG']
|
|
94
94
|
level = debug_level if debug_level
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
95
|
+
if ENV['BUNDLER_VERSION'] && \
|
|
96
|
+
ENV['APTIBLE_LOG_HTTP_REQUEST_RESPONSE'] && \
|
|
97
|
+
!ENV['APTIBLE_LOG_HTTP_REQUEST_RESPONSE'] \
|
|
98
|
+
.downcase.start_with?('f')
|
|
99
|
+
require 'httplog'
|
|
100
|
+
HttpLog.configure { |c| c.log_headers = true }
|
|
101
|
+
end
|
|
99
102
|
conf.logger.tap { |l| l.level = level }
|
|
100
103
|
end
|
|
101
104
|
warn_sso_enforcement
|
|
@@ -165,6 +168,13 @@ module Aptible
|
|
|
165
168
|
|
|
166
169
|
u2f = (e.response.parsed['exception_context'] || {})['u2f']
|
|
167
170
|
|
|
171
|
+
failed_login_attempt_id = e.response.parsed.dig(
|
|
172
|
+
'exception_context', 'failed_login_attempt_id'
|
|
173
|
+
)
|
|
174
|
+
if failed_login_attempt_id
|
|
175
|
+
token_options[:previous_login_attempt_id] = failed_login_attempt_id
|
|
176
|
+
end
|
|
177
|
+
|
|
168
178
|
q = Queue.new
|
|
169
179
|
mfa_threads = []
|
|
170
180
|
|
|
@@ -196,6 +196,17 @@ module Aptible
|
|
|
196
196
|
raise Thor::Error, "Invalid argument: #{k}" if v.nil?
|
|
197
197
|
end
|
|
198
198
|
|
|
199
|
+
def current_configuration(app)
|
|
200
|
+
conf_link = app.links['current_configuration']
|
|
201
|
+
return unless conf_link
|
|
202
|
+
|
|
203
|
+
Aptible::Api::Configuration.find_by_url(
|
|
204
|
+
conf_link.href,
|
|
205
|
+
token: fetch_token,
|
|
206
|
+
headers: { 'Prefer' => 'no_sensitive_extras=false' }
|
|
207
|
+
)
|
|
208
|
+
end
|
|
209
|
+
|
|
199
210
|
private
|
|
200
211
|
|
|
201
212
|
def handle_strategies
|
|
@@ -185,6 +185,14 @@ module Aptible
|
|
|
185
185
|
# Creates a local tunnel and yields the helper
|
|
186
186
|
|
|
187
187
|
def with_local_tunnel(credential, port = 0, target_account = nil)
|
|
188
|
+
# Credential has the senstive header set, and for some reason
|
|
189
|
+
# credential.create_operation! _lists all operations_. This would
|
|
190
|
+
# generate a show activity for every previous tunnel operation.
|
|
191
|
+
# So, we strip the sensitive header first to prevent that from happening
|
|
192
|
+
# This will also strip the connection_url, but we don't need it from
|
|
193
|
+
# this point on.
|
|
194
|
+
credential = without_sensitive(credential)
|
|
195
|
+
# Twice by here??
|
|
188
196
|
op = if target_account.nil?
|
|
189
197
|
credential.create_operation!(
|
|
190
198
|
type: 'tunnel',
|
|
@@ -284,7 +292,7 @@ module Aptible
|
|
|
284
292
|
raise Thor::Error, 'This command only works for PostgreSQL'
|
|
285
293
|
end
|
|
286
294
|
|
|
287
|
-
credential = find_credential(database)
|
|
295
|
+
credential, _credentials = find_credential(database)
|
|
288
296
|
|
|
289
297
|
with_local_tunnel(credential) do |tunnel_helper|
|
|
290
298
|
yield local_url(credential, tunnel_helper.port)
|
|
@@ -304,7 +312,7 @@ module Aptible
|
|
|
304
312
|
remote_url = credential.connection_url
|
|
305
313
|
|
|
306
314
|
uri = URI.parse(remote_url)
|
|
307
|
-
domain = credential.database.account.stack.internal_domain
|
|
315
|
+
domain = without_sensitive(credential).database.account.stack.internal_domain
|
|
308
316
|
"#{uri.scheme}://#{uri.user}:#{uri.password}@" \
|
|
309
317
|
"localhost.#{domain}:#{local_port}#{uri.path}"
|
|
310
318
|
end
|
|
@@ -314,21 +322,25 @@ module Aptible
|
|
|
314
322
|
raise Thor::Error, "Database #{database.handle} is not provisioned"
|
|
315
323
|
end
|
|
316
324
|
|
|
325
|
+
# Get the database credentials, without going using `with_senstive(database)`, as that
|
|
326
|
+
# would get the embedded last_operation, and generate an extra show activity
|
|
327
|
+
creds_link = database.links['database_credentials']
|
|
328
|
+
database_credentials = Aptible::Api::DatabaseCredential.all(
|
|
329
|
+
href: creds_link.href,
|
|
330
|
+
token: fetch_token,
|
|
331
|
+
headers: { 'Prefer' => 'no_sensitive_extras=false' }
|
|
332
|
+
)
|
|
333
|
+
|
|
317
334
|
finder = proc { |c| c.default }
|
|
318
335
|
finder = proc { |c| c.type == type } if type
|
|
319
|
-
credential =
|
|
336
|
+
credential = database_credentials.find(&finder)
|
|
320
337
|
|
|
321
|
-
return credential
|
|
338
|
+
# It may be weird to return the credential and all the credentials, but the db:tunnel
|
|
339
|
+
# command lists all the credential types if you do not provide one, and we want to avoid
|
|
340
|
+
# generating more show activity than needed
|
|
341
|
+
return credential, database_credentials if credential
|
|
322
342
|
|
|
323
|
-
types =
|
|
324
|
-
|
|
325
|
-
# On v1, we fallback to the DB. We make sure to make --type work, to
|
|
326
|
-
# avoid a confusing experience for customers.
|
|
327
|
-
if database.account.stack.version == 'v1'
|
|
328
|
-
types << database.type
|
|
329
|
-
types.uniq!
|
|
330
|
-
return database if type.nil? || type == database.type
|
|
331
|
-
end
|
|
343
|
+
types = database_credentials.map(&:type)
|
|
332
344
|
|
|
333
345
|
valid = types.join(', ')
|
|
334
346
|
|
|
@@ -365,6 +377,10 @@ module Aptible
|
|
|
365
377
|
end
|
|
366
378
|
|
|
367
379
|
def render_database(database, account)
|
|
380
|
+
# Maybe reload with senstive data
|
|
381
|
+
# Definately don't load the embedded last_operation
|
|
382
|
+
database.href = database.href + '?no_embed=true'
|
|
383
|
+
database = with_sensitive(database) if database.connection_url.nil?
|
|
368
384
|
Formatter.render(Renderer.current) do |root|
|
|
369
385
|
root.keyed_object('connection_url') do |node|
|
|
370
386
|
ResourceFormatter.inject_database(node, database, account)
|