Announcing Altostra CLI v5.2

Altostra CLI 5.2 introduces a new set of commands that bring full management functionality straight into the terminal for a better development experience and maximum control.
Yev Krupetsky

November 18 2020 · 4 min read

SHARE ON

Announcing Altostra CLI v5.2

Altostra is a developer-first platform, and as such, it's important to us to provide developers with a CLI to carry out whatever task they need to, right from their terminal.

In our previous post about the Altostra CLI, we saw how to use the basic commands to create projects and deploy them to your cloud accounts. Today we'll look at the latest changes we've introduced to the CLI and see how to use them for scripting and more advanced operations.

Setting up

Before installing the Altostra CLI, make sure you have Node.js installed.

The Altostra CLI is available as an NPM package. Once you have it installed, go ahead and log in.

$ npm install -g @altostra/cli
$ alto login

Interactive and non-interactive modes

As developers who spend much of our time in the terminal (hello from vim 👋), we know the importance of an enjoyable experience for the interactive user and the flexibility for automation and scripting. We have redesigned the CLI to support two modes: interactive mode to use in the terminal and non-interactive for use in scripts and automation.

In interactive mode—the default mode—there are colors, extra information, and the CLI will ask you questions and present you with options for specific parameters.

In non-interactive mode, which you turn on by using either the --text option or the --json option, all decorations are removed, all parameters must be provided to the commands, and the output can be either plain text or JSON.

What's new

First and foremost, we've improved the output to be much clearer. For example, the output of alto instnaces now looks more compact and with titles:

$ alto instances

Name  Updated                Environment   Image       Status
prod  7/27/2020, 2:18:38 PM  Production    v2.11.2     Deployed
yev   8/18/2020, 1:03:44 PM  Dev           v2.11.3     Deployed
dan   8/9/2020, 5:22:37 PM   Dev           v2.11.3     Deployed

When you omit certain information, like the instance name, the CLI will present you with the available instances. In non-interactive mode, however, you must provide the name.

$ alto instance history
? Select an instance:
  prod
❯ yev
  dan

...

History of instance yev:

 User   Data                    Image          Status
 yossi  11/12/2020, 2:18:38 PM  v2.11.3        Deployed
 yev    11/10/2020, 1:43:01 PM  v2.11.2        Deployed
 yev    11/10/2020, 1:28:22 PM  NOT_AVAILABLE  Failed

You can now use the options --text and --json to trigger the non-interactive mode. So the command as above looks like this:

$ alto instance history yev --text

yossi	2020-11-12T11:18:38.000Z	v2.11.3	Deployed
yev	2020-11-10T10:43:01.000Z	v2.11.2	Deployed
yev	2020-11-10T10:28:22.000Z	NOT_AVAILABLE	Failed

...

$ alto instance history yev --json | jq

[
  {
    "deployer": "yossi",
    "deployed": "2020-11-12T11:18:38.000Z",
    "tag": "v2.11.3",
    "status": "Deployed"
  },
  {
    "deployer": "yev",
    "deployed": "2020-11-10T10:43:01.000Z",
    "tag": "v2.11.2",
    "status": "Deployed"
  },
  {
    "deployer": "yev",
    "deployed": "2020-11-10T10:28:22.000Z",
    "tag": "NOT_AVAILABLE",
    "status": "Failed"
  }
]

New commands

We have extended the Altostra CLI with a new set of commands that enable more control over your Altostra account. You can now manage environments, parameters, policies, projects, images, instances, deployment history, and more. Furthermore, you also list the currently running tasks and completed tasks for your entire account.

# manage cloud environments
$ alto environments list
$ alto environments get
$ alto environments parameters

# manage projects
$ alto projects list
$ alto projects get
$ alto projects images
$ alto projects instances
$ alto projects update
$ alto projects delete

# manage deployed instances for the current project
$ alto instances list
$ alto instances get
$ alto instances history
$ alto instances config
$ alto instances delete

# list all currently running task on your account
$ alto tasks

# list all previousely completed tasks on your account
$ alto activity-log

# manage a local api-key used for CLI authentication in scripts
$ alto api-key

Most commands now allow you to omit parameters in interactive mode. You can then select a value from a list of available values.

# show the deployment history for an instance
$ alto instance history
? Select an instance: (Use arrow keys)
❯ prod
  yev
  dan

# deploy a new instance to an environment
$ alto deploy yossi:v2.2 --env
? Select the environment to deploy to (Use arrow keys)
❯ Dev
  Production
  Daylong
  Demo
  Playground

We continue expanding this functionality to all commands.

Scripting

For scripting, we like to use the --json option together with the jq tool. You can also use the --text option if you prefer to parse the output that way.

Here's a simple example:

# get the latest status of the first project instance
$ alto instance --json | \
    jq -r '.[] | "\(.name) is \(.status) to \(.environment) from \(.tag)"'

prod is Deployed to Production from v2.11.2
yev is Deployed to Dev from v2.11.3
dan is Deployed to Dev from v2.11.3

Summary

The new CLI commands extend the ability to operate your account from the terminal and from scripts. The values selection in interactive mode provides a smoother experience, while the text and JSON outputs in non-interactive mode enable you to write better scripts for automation.

We'll continue adding more features and commands. Meanwhile, if you feel that something is missing or can be improved, let us know so we can make your development experience even better.

To learn more, visit us at altostra.com, read our blog and our documentation.

Happy clouding!

By submitting this form, you are accepting our Terms of Service and our Privacy Policy

Thanks for subscribing!

Ready to Get Started?

Request a Demo

Copyright © 2020 Altostra. All rights reserved.