Altostra CLI Introduction

Yev Krupetsky

October 15 2020 · 4 min read

SHARE ON

Altostra CLI Introduction

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.

The Altostra CLI has three primary functions. First and foremost, to be the main tool developers use while working on projects. Then, to serve the automation needs for processes such as CI/CD and scripting. To complete the Altostra experience, provide management capabilities of projects, deployments, environments and policies right in the terminal.

Setting Up

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

The Altostra CLI is available as an NPM package:

$ npm install -g @altostra/cli

Logging in

The CLI requires access to your Altostra account for many of the operations you will use it for. So, let's login first:

$ alto login

The login process is straightforward. It opens a login page in a browser—if you have logged in to the Altostra Web Console already, you'll be logged in automatically.

Look around

Let's now do some common operations to get familiar with the Altostra CLI.

What can you do

Let's first see what the CLI has to offer:

$ alto --help

For brevity, I'm omitting the output of the command. Go ahead and run it in your terminal to see the full list of commands. You can also read the CLI documentation.

You can quickly access the Altostra docs by running:

$ alto docs

What do we have

Let's see what environments we have set up on our account:

$ alto environments

┌───────────────┬─────────────────────────────────────────────────────────────────────────────────┐
│     name      │                                   description                                   │
├───────────────┼─────────────────────────────────────────────────────────────────────────────────┤
│ 'Production''Altostra PRODUCTION'                               │
│     'QA''For testing against PRODUCTION APIs'                      │
│     'Dev''The "Lab" environment where we test Altostra'                  │
│    'Demo''For demo deployments when showcasing Altostra'                 │
│   'Daylong''For daily development - deployments in this environment expire after a day.'  │
│  'Weeklong''For weekly development - deployments in this environment expire after a week.' │
└───────────────┴─────────────────────────────────────────────────────────────────────────────────┘

These are the environments available to our developers for use when deploying. No need for cloud account names and numbers—we like simplicity.

How about the deployments for our website project:

$ alto deployments

┌────────┬─────────────────────────┬──────────────┬───────────┬────────────┐
│  Name  │         Updated         │ Environment  │   Image   │   Status   │
├────────┼─────────────────────────┼──────────────┼───────────┼────────────┤
│ 'prod''7/1/2020, 11:06:52 PM''Production''v0.1.8''Deployed' │
│ 'dev''7/6/2020, 2:46:55 PM''Dev''v0.1.20''Deployed' │
└────────┴─────────────────────────┴──────────────┴───────────┴────────────┘

We can see the deployments, or "instances", of our website project in two different environments, the time of update and version deployed.

What if you want to create a new project from a template? Let's list the publicly available templates:

$ alto templates

Publicly available templates:
 * static-website
 * simple-crud-service-nodejs
 * scalable-webhook-nodejs
 * hello-world-nodejs

Starting fresh

Let's now demonstrate a simple workflow using the Altostra CLI to deploy a static website. We already know that there's a template for it called static-website, so let use it:

# create the project
$ alto new my-website --template static-website
$ cd my-website

# push a deployable image
$ alto push v1.0

# deploy to the Daylong enviroment
# where deployments are automatically removed after a day
$ alto deploy blog:v1.0 --env Daylong

# show the details for the "blog" deployment including its status
$ alto deployments blog

# upload the website content files
$ alto sync -a --public

We create, deploy the infrastructure, and upload the website content files for a new project with just a few simple commands.

Automation and CI/CD

To use the Altostra CLI in automation scripts and pipelines, you must first generate an authentication token, which you then use in your scripts.

Then, after you've run your unit tests and build steps, create an Altostra image using the alto push command.

You can then deploy that image to an integration test environment using the alto deploy command and run your integration tests there.

The image is the same for deployments to any environment and differs only in the configuration. After the CI stage is complete and the CD stage begins, you can use the alto deploy command again to deploy the same image you tested during the CI stage to the production environment.

In Conclusion

The CLI is your companion when it comes to wielding the power of Altostra, and we want it to help you in your everyday development, automation and configuration work.

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 https://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.