Skip to content

Commit

Permalink
Prefer "--disk-size" over "--size" (#256)
Browse files Browse the repository at this point in the history
* Prefer "--disk-size" over "--size"
* Sync README with usage.
* Warning when --size is used.
  • Loading branch information
UserNotFound authored Apr 17, 2020
1 parent fc0d0e8 commit 07bb06f
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 60 deletions.
94 changes: 47 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,53 +29,53 @@ From `aptible help`:
<!-- BEGIN USAGE -->
```
Commands:
aptible apps # List all applications
aptible apps:create HANDLE # Create a new application
aptible apps:deprovision # Deprovision an app
aptible apps:scale SERVICE [--container-count COUNT] [--container-size SIZE_MB] # Scale a service
aptible backup:list DB_HANDLE # List backups for a database
aptible backup:purge BACKUP_ID # Restore a backup
aptible backup:restore BACKUP_ID [--environment ENVIRONMENT_HANDLE] [--handle HANDLE] [--container-size SIZE_MB] [--size SIZE_GB] # Restore a backup
aptible config # Print an app's current configuration
aptible config:add [VAR1=VAL1] [VAR2=VAL2] [...] # Add an ENV variable to an app
aptible config:rm [VAR1] [VAR2] [...] # Remove an ENV variable from an app
aptible config:set [VAR1=VAL1] [VAR2=VAL2] [...] # Add an ENV variable to an app
aptible config:unset [VAR1] [VAR2] [...] # Remove an ENV variable from an app
aptible db:backup HANDLE # Backup a database
aptible db:clone SOURCE DEST # Clone a database to create a new one
aptible db:create HANDLE [--type TYPE] [--version VERSION] [--container-size SIZE_MB] [--size SIZE_GB] # Create a new database
aptible db:deprovision HANDLE # Deprovision a database
aptible db:dump HANDLE [pg_dump options] # Dump a remote database to file
aptible db:execute HANDLE SQL_FILE [--on-error-stop] # Executes sql against a database
aptible db:list # List all databases
aptible db:reload HANDLE # Reload a database
aptible db:replicate HANDLE REPLICA_HANDLE [--container-size SIZE_MB] [--size SIZE_GB] # Create a replica/follower of a database
aptible db:restart HANDLE [--container-size SIZE_MB] [--size SIZE_GB] # Restart a database
aptible db:tunnel HANDLE # Create a local tunnel to a database
aptible db:url HANDLE # Display a database URL
aptible db:versions # List available database versions
aptible deploy [OPTIONS] [VAR1=VAL1] [VAR2=VAL2] [...] # Deploy an app
aptible domains # Print an app's current virtual domains - DEPRECATED
aptible endpoints:database:create DATABASE # Create a Database Endpoint
aptible endpoints:deprovision [--app APP | --database DATABASE] ENDPOINT_HOSTNAME # Deprovision an App or Database Endpoint
aptible endpoints:https:create [--app APP] SERVICE # Create an App HTTPS Endpoint
aptible endpoints:https:modify [--app APP] ENDPOINT_HOSTNAME # Modify an App HTTPS Endpoint
aptible endpoints:list [--app APP | --database DATABASE] # List Endpoints for an App or Database
aptible endpoints:renew [--app APP] ENDPOINT_HOSTNAME # Renew an App Managed TLS Endpoint
aptible endpoints:tcp:create [--app APP] SERVICE # Create an App TCP Endpoint
aptible endpoints:tcp:modify [--app APP] ENDPOINT_HOSTNAME # Modify an App TCP Endpoint
aptible endpoints:tls:create [--app APP] SERVICE # Create an App TLS Endpoint
aptible endpoints:tls:modify [--app APP] ENDPOINT_HOSTNAME # Modify an App TLS Endpoint
aptible help [COMMAND] # Describe available commands or one specific command
aptible login # Log in to Aptible
aptible logs [--app APP | --database DATABASE] # Follows logs from a running app or database
aptible operation:cancel OPERATION_ID # Cancel a running operation
aptible ps # Display running processes for an app - DEPRECATED
aptible rebuild # Rebuild an app, and restart its services
aptible restart # Restart all services associated with an app
aptible services # List Services for an App
aptible ssh [COMMAND] # Run a command against an app
aptible version # Print Aptible CLI version
aptible apps # List all applications
aptible apps:create HANDLE # Create a new application
aptible apps:deprovision # Deprovision an app
aptible apps:scale SERVICE [--container-count COUNT] [--container-size SIZE_MB] # Scale a service
aptible backup:list DB_HANDLE # List backups for a database
aptible backup:purge BACKUP_ID # Restore a backup
aptible backup:restore BACKUP_ID [--environment ENVIRONMENT_HANDLE] [--handle HANDLE] [--container-size SIZE_MB] [--disk-size SIZE_GB] # Restore a backup
aptible config # Print an app's current configuration
aptible config:add [VAR1=VAL1] [VAR2=VAL2] [...] # Add an ENV variable to an app
aptible config:rm [VAR1] [VAR2] [...] # Remove an ENV variable from an app
aptible config:set [VAR1=VAL1] [VAR2=VAL2] [...] # Add an ENV variable to an app
aptible config:unset [VAR1] [VAR2] [...] # Remove an ENV variable from an app
aptible db:backup HANDLE # Backup a database
aptible db:clone SOURCE DEST # Clone a database to create a new one
aptible db:create HANDLE [--type TYPE] [--version VERSION] [--container-size SIZE_MB] [--disk-size SIZE_GB] # Create a new database
aptible db:deprovision HANDLE # Deprovision a database
aptible db:dump HANDLE [pg_dump options] # Dump a remote database to file
aptible db:execute HANDLE SQL_FILE [--on-error-stop] # Executes sql against a database
aptible db:list # List all databases
aptible db:reload HANDLE # Reload a database
aptible db:replicate HANDLE REPLICA_HANDLE [--container-size SIZE_MB] [--disk-size SIZE_GB] # Create a replica/follower of a database
aptible db:restart HANDLE [--container-size SIZE_MB] [--disk-size SIZE_GB] # Restart a database
aptible db:tunnel HANDLE # Create a local tunnel to a database
aptible db:url HANDLE # Display a database URL
aptible db:versions # List available database versions
aptible deploy [OPTIONS] [VAR1=VAL1] [VAR2=VAL2] [...] # Deploy an app
aptible domains # Print an app's current virtual domains - DEPRECATED
aptible endpoints:database:create DATABASE # Create a Database Endpoint
aptible endpoints:deprovision [--app APP | --database DATABASE] ENDPOINT_HOSTNAME # Deprovision an App or Database Endpoint
aptible endpoints:https:create [--app APP] SERVICE # Create an App HTTPS Endpoint
aptible endpoints:https:modify [--app APP] ENDPOINT_HOSTNAME # Modify an App HTTPS Endpoint
aptible endpoints:list [--app APP | --database DATABASE] # List Endpoints for an App or Database
aptible endpoints:renew [--app APP] ENDPOINT_HOSTNAME # Renew an App Managed TLS Endpoint
aptible endpoints:tcp:create [--app APP] SERVICE # Create an App TCP Endpoint
aptible endpoints:tcp:modify [--app APP] ENDPOINT_HOSTNAME # Modify an App TCP Endpoint
aptible endpoints:tls:create [--app APP] SERVICE # Create an App TLS Endpoint
aptible endpoints:tls:modify [--app APP] ENDPOINT_HOSTNAME # Modify an App TLS Endpoint
aptible help [COMMAND] # Describe available commands or one specific command
aptible login # Log in to Aptible
aptible logs [--app APP | --database DATABASE] # Follows logs from a running app or database
aptible operation:cancel OPERATION_ID # Cancel a running operation
aptible ps # Display running processes for an app - DEPRECATED
aptible rebuild # Rebuild an app, and restart its services
aptible restart # Restart all services associated with an app
aptible services # List Services for an App
aptible ssh [COMMAND] # Run a command against an app
aptible version # Print Aptible CLI version
```
<!-- END USAGE -->

Expand Down
11 changes: 9 additions & 2 deletions lib/aptible/cli/subcommands/backup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ def self.included(thor)

desc 'backup:restore BACKUP_ID ' \
'[--environment ENVIRONMENT_HANDLE] [--handle HANDLE] ' \
'[--container-size SIZE_MB] [--size SIZE_GB]',
'[--container-size SIZE_MB] [--disk-size SIZE_GB]',
'Restore a backup'
option :handle, desc: 'a name to use for the new database'
option :environment, desc: 'a different environment to restore to'
option :container_size, type: :numeric
option :size, type: :numeric
option :disk_size, type: :numeric
define_method 'backup:restore' do |backup_id|
backup = Aptible::Api::Backup.find(backup_id, token: fetch_token)
raise Thor::Error, "Backup ##{backup_id} not found" if backup.nil?
Expand All @@ -35,10 +36,16 @@ def self.included(thor)
type: 'restore',
handle: handle,
container_size: options[:container_size],
disk_size: options[:size],
disk_size: options[:disk_size] || options[:size],
destination_account: destination_account
}.delete_if { |_, v| v.nil? }

CLI.logger.warn([
'You have used the "--size" option to specify a disk size.',
'This option which be deprecated in a future version.',
'Please use the "--disk-size" option, instead.'
].join("\n")) if options[:size]

operation = backup.create_operation!(opts)
CLI.logger.info "Restoring backup into #{handle}"
attach_to_operation_logs(operation)
Expand Down
Loading

0 comments on commit 07bb06f

Please sign in to comment.