Starting with the CLI

In this section you will learn how to use the playground CLI for the most common tasks. For advance usage of the CLI, check our extended CLI documentation.

Install Playground-CLI

Prerequisites:

  • Command curl installed.
  • Command su or sudo if the installation is performed by a user other than root.

Execute

curl -O https://storage.googleapis.com/artifacts.playground.napptive.dev/installer.sh && bash installer.sh
...

playground installed into /usr/local/bin/ successfully.

***************************************************
* Playground installed successfully!  👌          *
*                                                 *
* By proceeding, you are accepting the NAPPTIVE   *
* terms and conditions                            *
* https://napptive.com/terms-and-conditions       *
*                                                 *
* You can visit our documentation page            *
* for more information https://docs.napptive.com/ *
* ENJOY!!!    👋                                  *
***************************************************

The playground CLI will be installed in /usr/local/bin directory, and will be found automatically in the PATH and ready to use.

Manual installations are also possible following the installation documentation . Alternatively, we also provide a containerized playground CLI if you prefer not to install the tool locally.

Login process

To use the playground CLI you need to first log in with your existing account. Create your account first if you have not done so. To log in with the CLI execute:

playground login

That will trigger the login process opening the default browser. If you are working in an environment without support for visual browsers, we recommend to check the process to create a Personal Access Token and use that method to login with the CLI. Once the web authorization succeeds, your terminal will show:

Logged as <username> on <account>/default environment using <provider> credentials.

Now you are ready to interact with your account and environments with the CLI.

Deploy an application

With all the tools ready, let’s deploy an application. To do this we will leverage the catalog of existing applications, select one, and deploy it into the default environment. Follow the steps to get your first application up and running.

  1. Deploy an application

    To confirm that you have logged in successfully, you may use any playground command. For example:

     playground env info
    
     ...
     Server version: v1.21.12-eks-a64ea69 OAM: v3.0
     CREATION_TIME                           CREATED_BY
     2022-07-05 18:13:43.468965 +0000 UTC    username
    
     ACCOUNT    ENV        CPU     RAM       STORAGE
     account    env        0/1     0/4000    0/1000
    
     DESCRIPTION
     environment description 
    

    The catalog provides a collection of applications that are ready to be deployed. Check the catalog documentation to learn how you can create and upload your own applications. For the purpose of this example, let’s deploy Drawio which is a simple tool to create diagrams online. First, list the available applications to select the version to be deployed.

     playground catalog list
    
     ...
     APP_ID                                 NAME
     ...
     napptive/drawio:17.2.4                 Drawio
     ...
    

    Next, copy the name of the app and its version and deploy it with:

     playground catalog deploy napptive/drawio:17.2.4
    
     ...
     Target environment: account/environment
     STATUS     INFO
     SUCCESS    application deployed
    

    To obtain a list running applications in your current environment use:

     playground apps
    
     Target environment: account/environment
     NAME      STATUS
     drawio    RUNNING
    

    The deployment of the application may take a few seconds depending on the number of components, image size, etc., until the status becomes OK

    Optionally, you can wait for the application to start with:

     playground apps wait drawio 
    

    If the application is not running after a few minutes, check more information about how to deploy your custom OAM application and/or our FAQ to diagnose the issue.

  2. To access the web using the CLI, use:

     playground apps open drawio
    

    To obtain more details about the applications, use the command below:

     playground apps info drawio
    
     ...
     Target environment: <account_name>/<environment>
     NAME      STATUS
     drawio    RUNNING
    
     COMPONENT    STATUS     SCOPES    TRAITS
     drawio       RUNNING              napptive-ingress
    
     COMPONENT    INGRESSES
     drawio       <ingress_name>-<your_environment_id>.apps.playground.napptive.dev   
    

    The INGRESSES contain the URLS associated with the application.

Cleanup

To remove all the components and make space for other applications if needed, use:

playground apps delete drawio
...
Current environment: account/environment
STATUS     INFO
SUCCESS    application drawio has been removed

What’s next