Using Hosty CLI
Hosty CLI respects user permissions documented in Roles & Permissions. It means that certain users may not have access to certain commands or environments. For example, users with "developer" role can't access any resource related to production environments. Another example: users with "release manager" role can not access backups.
CLI supports 3 verbosity modes for every command:
- Normal: prints most important messages. Default verbosity mode.
- Verbose: prints more information about the command execution progress when -vflag is added to a command.
- Very, Very Verbose: prints exessive logs during the command execution, used mainly for debugging purpose. Add -vvv to a command.
This command requires VPN connection to the cluster.
Run the following command:
Or use a shorthand:
If you have more than one application configured, pass --application flag with the name of the application you need the logs for:
By default, the command prints logs from the primary container (i.e. php, node or python). If you need to get logs from another container, i.e. nginx, then use --containerflag:
This command requires two-factor authentication.
To downloads the latest database backup without personal identifiable information to the local environment run:
To download full database backup (only lead developers have permission for it):
To download a database backup from a specific date and time, first print the list of available backup names:
Then, use --name flag to download the selected backup:
This command requires two-factor authentication.
To downloads the latest files backup, run the following command:
- <storageName> is the name of persistent storage from your hosty.yaml file
- <targetPath> is the path where to sync the files, relative to the project root
If you want to exclude certain folder from sync, use --excludeflag:
This command requires VPN connection to the cluster.
To open the console of the environment, run the following command:
Or use a shorthand:
For example:
To open the console of a particular application (if you have more than 1 application configured for the project):
To open the console of a particular container (i.e. nginx):
This command requires VPN connection to the cluster.
To execute a command in the remote environment, run the following command:
Or use a shorthand:
For example:
To execute a command for a particular application (if you have more than 1 application configured for the project):
To execute a command inside of a particular container (i.e. nginx):
This command requires VPN connection to the cluster.
To print the list of all deployed environments, run:
Note that users with developer role will not see a "production" environment in the list, because they don't have access to it. See Roles & Permissions for more details.
This command requires VPN connection to the cluster.
To get a list of the environment URLs, run:
Or use a shorthand:
For example:
To get a domains only for a particular application (if you have more than one application configured for the project):
This command requires VPN connection to the cluster.
For security reasons, remote environments are read-only (apart from persistent storages defined in hosty.yaml file), so if you want to upload files to a remote environment make sure to use one of the persistent storage locations, otherwise the command will fail.
To copy files or folders between local and remove environments, use the following command:
Or use a shorthand:
- <environmentName> is the name of the remove environment
- <from> and <to> are paths from/to copy the files. For local paths use path relative to the project root. For remote paths use path starting with hosty://which will be relative to the project root on a remote environment
For example: