Ubicloud provides a command line interface named ubi
, which allows you to interact with Ubicloud directly from the command line.
ubi
command line program.
ubi
from the ubicloud/cli releases page on GitHub. We offer downloads of ubi
for the following operating systems and platforms:
ubi
, which can be run directly without installation.
If you are a MacOS user, you can also install with homebrew by running:
ubi
is part of Ubicloud, it is open source, and available for review. It is a small program is written in Go, and if we do not already provide builds for your platform, you can build ubi
yourself using the Source Code download on the GitHub release page. You can also contact us at [email protected] and ask us to provide builds for your operating system and platform.
ubi
does not automatically update itself. It is a simple program that transmits your command to Ubicloud. As Ubicloud adds support for additional command line capabilities, ubi
can automatically take advantage of them. However, there may potentially be cases where you need a newer version of ubi
to take advantage of the additional command line capabilities. In that case, please download the newest version of ubi
using the link above.
ubi
requires a personal access token be provided via the UBI_TOKEN
environment variable. If you have not already created a personal access token for your project, you can create one by going to the Tokens
page for your project, and clicking the Create Token
button:
ubi
requires it be provided via the UBI_TOKEN
environment variable. If you have a password manager or other secure secret storage vault, you can store the token in there. If security is not your primary concern, you could store the access token in your shell startup files, so it is available for all programs.
As there a myriad number of ways that users may want to store the token, ubi
does not provide integrations for specific token storage. You can use any storage method you want as long as the UBI_TOKEN
environment variable is present when you execute the ubi
program.
ubi
ubi
with no arguments, it displays an error, followed by the program usage
ubi
will prefix errors with !
and print errors to stderr instead of stdout. In this case, you get an error because you did not provide a subcommand when calling the program. ubi
helpfully shows you the available subcommands in this case.
One of the subcommands is help
. You can use ubi help
to get usage information for various commands. For example, to see what is supported by the ps
subcommand, you can run ubi help ps
:
ps
subcommand. One way has subcommands that directly follow ps
. The only supported subcommand in this case is ps list
. So let’s use ubi help ps list
ps list
command. You can then try running the ubi ps list
command:
help
subcommand by asking for it:
-r
/--recursive
and -u
/--usage
options. It’s useful to combine those together to get a recursive display of usage for subcommands:
list
: display a subset of information for multiple objects of the same typeshow
: display detailed information about a specific objectcreate
: create an objectdestroy
: destroy an object (asks for confirmation by default before destruction)vm ssh
: connects to a virtual machine via ssh
vm sftp
: connects to a virtual machine via sftp
vm scp
: copy file/directory from the local computer to a virtual machine or from a virtual machine to the local computer via scp
pg psql
: connect to a PostgreSQL database via psql
pg pg_dump
: dump a single PostgreSQL database using pg_dump
pg pg_dumpall
: dump an entire PostgreSQL database cluster using pg_dumpall
UBI_SSH
for ssh
, UBI_SFTP
for sftp
).
ubi
. However, if you are interested in how ubi
works and why it works the way it does, you can read this section.
ubi
is different than many other similar command line programs in that it does no parsing of arguments (argv
) it is called with. It just takes the arguments and sends them to Ubicloud. Ubicloud parses the arguments, and determines what action to take, and returns the output to ubi
, which displays the output for the user (or in some cases, runs a supported program or asks for comfirmation). At Ubicloud, we call this a Thin CLIent approach to command line interface design.
The advantage of implementing ubi
this way is that Ubicloud can improve the command line interface at any time to add new features, and have users of ubi
automatically benefit from those features without having to update their program. With traditional command line programs, that do their own argument parsing, adding new features requires that each machine running the program be updated to use those features. By having ubi
pass the arguments to Ubicloud without parsing them, Ubicloud brings the advantages of web distribution to the command line, so that all users can immediately benefit from new features.
There are a couple disadvantages of implementing ubi
this way:
help
output takes some time.ubi
.ubi
does the following checks:
argv
passed to ubi
.--
to separate arguments from options (except for pg_dumpall
, which does not support this).argv
passed to ubi
.
--
(for non-pg_dumpall
) or must start with -d
(for pg_dumpall
)