Applications
The following operations are available through the CLI related to application management.
- Deploying an application
- Listing deployed applications
- Inspecting the application
- Application logs
- Application endpoints
- Removing an application
- Waiting for an application to start
Deploying an application
The CLI allows you to deploy applications from different sources (local files, url, catalog, or git repository ).
From Local Files
To deploy an application from a local file or directory use:
playground apps deploy <path_to_drawio_files>
Target environment: account/environment
STATUS INFO
SUCCESS application drawio deployed successfully
The application will be deployed in the active account/environment
. The active environment is the one in which we logged in or the selected one after logged in. To deploy an application to a different environment than the active one, include the --env
option in the command
playground apps deploy <path_to_drawio_files> --env <account/env>
Target environment: account/env
STATUS INFO
SUCCESS application drawio deployed successfully
From URL
Just like from local files, we can deploy an application that is published in a URL. To do this, you will need to use the following command:
playground apps deploy <applicationURL>
Target environment: account/environment
STATUS INFO
SUCCESS application drawio deployed successfully
From catalog
There is a catalog of applications ready to be deployed. Visit the documentation here. To deploy an application from catalog use:
playground apps deploy napptive/drawio:17.2.4
Target environment: account/environment
STATUS INFO
SUCCESS application drawio deployed successfully
From Git
There is the option to deploy go, nodejs, python or web applications from a Git repository using:
playground apps deploy <git_repository_URL>
There are several flags that will allow you to customize the deployment:
- Application Flags:
--env
: to indicate the account/environment in which the application will be deployed--name
: with the Application Name
- Private repositories flags:
--gitPAT
: with GitHub Personal Access Token, required for private repositories--gitUser
: GitHub Username, required for to download private repositories
- Deployment flags:
--envs
to add environment variables to the application.--execArgs
with the arguments required to execute the program. These args will be separated by spaces--ports
with a list of ports to expose--ingresses
with a list of ports to expose the application to internet--lang
with the application language. Allowed values: “go”, “static”, “python” or “nodejs”. If it is not filled, the playground will be tried to identify it--mainFile
the main file path. If it is not filled, the playground will be tried to find it
Listing deployed applications
Obtain a list of running applications in your current environment with:
playground apps
NAME STATUS
app1 RUNNING
app2 WARNING
To retrieve the list of applications that are deployed in all environments you have access to, use:
playground apps --all-environments
or use:
playground apps -A
ENV NAME STATUS
account2/env1 app1 RUNNING
account2/env1 app2 RUNNING
account1/env1 app3 RUNNING
The listing can be also restricted to a selected account with:
playground apps --account=<selected_account>
ENV NAME STATUS
<selected_account>/<env_name> app1 RUNNING
Inspecting the application
Information about an application can be obtained with the info command:
playground app info <application_name>
Target environment: <account_name>/<environment>
NAME STATUS
<application_name> RUNNING
COMPONENT STATUS SCOPES TRAITS
comp1 RUNNING napptive-ingress
COMPONENT INGRESSES
comp1 <ingress_name>-<your_environment_id>.apps.playground.napptive.dev
Application logs
To retrieve logs from an application use:
playground apps logs <appName>
[comp-1-864b6b49-f47l8] [comp-1] 2021-04-20T19:12:09.401703900Z 2021-04-20 19:12:09+00:00 Sample application log
...
This command will actively stream all the logs coming from the application, use CTRL+C
to stop receiving logs. A detailed guide on application logs is available describing how to obtain application and component logs.
Application endpoints
Applications may expose public endpoints, to navigate to those either request the information using:
playground app info <application_name>
...
COMPONENT INGRESSES
<component_name> <ingress_name>-<your_environment_id>.apps.playground.napptive.dev
And navigate to `
playground app open <application_name>
This will launch the default browser for each of the application endpoints.
Removing an application
The simplest way to remove an application is using the playground command with:
playground apps delete <application_name>
Waiting for an application to start
The CLI offers a method to wait for an application to start. This can be really useful when issuing several commands in a script, or just to wait before opening the application endpoints. The following command waits for the application status to become Ok.
playground apps wait <application_name>
For applications that take time in the internal booting process it is possible to wait for a specific entry in the log to contain a string.
playground apps wait <application_name> --logContains="<string to match>"