For developers
Using Hosty CLI
28 min
hosty cli respects user permissions documented in roles & permissions docid\ a1wjrpsbcu t9noetmcxa 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 verbosity levels 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 v flag 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 how to get a list of available commands? hosty list how to access application logs? this command requires vpn connection to the cluster run the following command hosty environment\ logs \<environmentname> or use a shorthand hosty logs \<environmentname> if you have more than one application configured, pass application flag with the name of the application you need the logs for hosty logs \<environmentname> application=backend 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 container flag hosty logs \<environmentname> container=nginx how to download database backup? this command requires two factor authentication to downloads the latest database backup without personal identifiable information to the local environment run hosty backup\ database\ download partial /dump sql gz to download full database backup (only lead developers have permission for it) hosty backup\ database\ download full /dump sql gz to download a database backup from a specific date and time, first print the list of available backup names hosty backup\ database\ list partial then, use name flag to download the selected backup hosty backup\ database\ download partial name=2024 07 08t00 42 13z partial gzip /dump sql gz how to download files backup? this command requires two factor authentication to downloads the latest files backup, run the following command hosty backup\ files\ download \<storagename> \<targetpath> \<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 exclude flag hosty backup\ files\ download \<storagename> \<targetpath> exclude=css/ exclude=cache/ how to access environment console? this command requires vpn connection to the cluster to open the console of the environment, run the following command hosty environment\ shell \<environmentname> or use a shorthand hosty sh \<environmentname> for example hosty sh production to open the console of a particular application (if you have more than 1 application configured for the project) hosty sh \<environmentname> application=backend to open the console of a particular container (i e nginx ) hosty sh \<environmentname> container=nginx how to execute a command in an environment? this command requires vpn connection to the cluster to execute a command in the remote environment, run the following command hosty environment\ exec \<environmentname> command="your command" or use a shorthand hosty exec \<environmentname> command="your command" for example hosty exec production command="drush status" to execute a command for a particular application (if you have more than 1 application configured for the project) hosty exec \<environmentname> application=backend command="your command" to execute a command inside of a particular container (i e nginx ) hosty exec \<environmentname> container=nginx command="your command" how to get a list of available environments? this command requires vpn connection to the cluster to print the list of all deployed environments, run hosty list 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 docid\ a1wjrpsbcu t9noetmcxa for more details how to get urls assigned to an environment? this command requires vpn connection to the cluster to get a list of the environment urls, run hosty environment\ domains \<environmentname> or use a shorthand hosty domains \<environmentname> for example hosty domains production to get a domains only for a particular application (if you have more than one application configured for the project) hosty domains production application=backend how to copy files between local and remote environments? 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 hosty environment\ copy \<environmentname> \<from> \<to> or use a shorthand hosty cp \<environmentname> \<from> \<to> \<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 hosty cp production hosty //web/sites/default/files /my local files v