Start and Stop an Application from the C3 AI Console
You can start, stop, and hibernate applications to optimize resource utilization in the C3 AI Console. Stopping an application preserves all data and configurations while freeing up compute resources. Hibernating an application temporarily reduces resource consumption, so the platform can reallocate resources to other applications within the environment or cluster as needed. You can easily stop and hibernate applications can be easily restarted through the C3 AI Console without data loss.
Applications can also be terminated, which removes the application from the environment, including all data and connections that were configured in the application. This should be done with caution, as data and configurations are not recoverable if terminated through this action.
Verify list of applications within an environment
Prior to creating or starting an application, verify environment and application details by running the following code snippet:
Env.forId('mycluster-myenv').apps()This code lists applications from the specified environment and configured parameters, such as rootPkg and serverVersion.
Drill into the environment and application details to verify the environment in which you are working is the desired one.
Create an application
Running the Env.StartAppSpec console command creates an application with the specified parameters, if the application instance does not already exist in the environment.
During the initial creation, you can specify multiple configurations and parameters, such as the rootPkg and rootPkgVersion, as well as serverVersion and other details. The only required parameter is the application name. See App for more information.
Run the following code example and complete the desired parameters as needed to create an application.
Env.forId('mycluster-myenv').startApp({name: 'myapp', rootPkg: 'mypackage', serverVersion: `myServerVersion`})If the serverVersion is not specified, the serverVersion of the environment is used by default. Likewise, if a rootPkg is not specified, the application is created with the same rootPkg as the environment.
Start an application
If an existing application is hibernated, run following code snippet to activate the application. You must specify rootPkg to start an application.
Env.forId('mycluster-myenv').startApp({name: 'myapp', rootPkg: 'mypackage'})View the App URL to verify the application is running: https://mydomain.mycluster/<myenv>/<myapp>/console/index.html
The App URL may result in a 503 error temporarily while the application deployment is underway. Wait for a few moments and refresh the page.
Start an environment
If an existing environment is in a hibernate state, use the following code snippet to activate the environment. You must be a Cluster Administrator to perform this action.
Starting an environment does not automatically restart the applications associated with that environment.
Cluster.startEnv({name: 'myenv'})Stop an application
Stop an application by running the following code snippet in the C3 AI console.
Env.forId('mycluster-myenv').stopApp(App.forId('mycluster-myenv-myapp'))Stop an environment
Stop an environment by running the following code snippet in the C3 AI console. You must be a Cluster Administrator to perform this action.
Stopping an environment also stops all applications that are part of that environment.
Cluster.stopEnv(Env.forId('myenv'))Terminate or destroy an application
You must be a Cluster Administrator to terminate or destroy an application. Prior to running the termination console command, verify that you are specifying the correct application.
There are a few recommended ways to do so, including the following:
Go to the App URL for the application you wish to terminate and run the following context-specific console command to verify the Application ID is accurate:
C3.$context.app.id. If the application ID is not what was expected, do not proceed with the termination action for that application.From the App URL, Environment URL, or Cluster URL, verify the application you wish to terminate was created by whom you expected by running the following console command:
App.forId('mycluster-myenv-myapp').meta.startedBy.email. If the email address is not the one expected, do not proceed with the termination action for that application.If you know the environment to which the application you wish to terminate belongs, run the following command to view the details of the applications within that environment to ensure you are targeting the correct application:
Env.forId('mycluster-myenv').apps(). If the targeted application is not listed, do not proceed with the termination action.
Destroy an application, including all data and connections, by running the following code snippet in the C3 AI console.
This action cannot be reverted. All data and configurations that are part of the application are destroyed with the application as a result of this action.
Do not destroy the default 'c3' application as this causes immediate and irrevocable damage to the environment.
Env.forId('mycluster-myenv').terminateApp(App.forId('mycluster-myenv-myapp'), true)Terminate an environment
Prior to running the termination console commands, verify that you are specifying the correct environment. There are a few recommended ways to do so, including the following:
Go to the Environment URL for the application you wish to terminate and run the following context-specific console command to verify the Environment ID is accurate:
C3.$context.app.id. If the ID is not what was expected, do not proceed with the termination action for that environment.From the Environment URL or Cluster URL, verify the environment you wish to terminate was created by whom you expected by running the following console command:
Env.forId('mycluster-myenv').meta.startedBy.email. If the email address is not the one expected, do not proceed with the termination action for that application.Alternatively, from the Environment URL or Cluster URL, verify the environment is the correct one you wish to terminate by running the following console command:
Env.forId('mycluster-myenv').apps(). If the environment details, including the related applications, do not match what is expected, do not proceed with the termination action for that environment.
Terminate an environment, including all data and connections, by running the following code snippet in the C3 console.
WARNING: This action cannot be reverted. All data and configurations that are part of the environment are destroyed with the environment, including all applications within the environment, as a result of this action.
You must be a Cluster Administrator to terminate an environment.
Cluster.inst().terminateEnv(Env.forId('mycluster-myenv'), true)