Environment Actions

UI & CLI

Most of the actions performed on environments are available both through the UI and the CLI, as well as through a Public API.

📘

CLI

For installation instructions, please refer to the dedicated [CLI section](Bunnyshell CLI).

In order to use the CLI tool in scripts, you can leverage the JSON output format, by running the command with the -o json flag.

The available actions are only presented with the UI and CLI, as the Public API has its own dedicated documentation, the API Reference.

 

Deploying an environment

UI Deployment

  1. Start by selecting the environment you wish to deploy.
  2. Click the Deploy button.

Alternately, you can Deploy the Environment directly from the Environments listing.

🚧

Note

If the environment has never been deployed before, you will be asked to select the Kubernetes cluster you want to deploy your environment.

  1. Select the Kubernetes cluster where you want to deploy the environment and click Deploy Environment.

Congratulations! Bunnyshell deployed the environment and now your application is live and testable by everybody within your team.

CLI Deployment

In order to trigger the deployment of an environment, you need to run the environments deploy command. It requires the --id parameter.

$ bns environments deploy --id gbDLLp7DK2

EventID        | K7GzwLyND3
EnvironmentID  | gbDLLp7DK2
OrganizationID | 78B4Ob1J5P
Status         | in_progress
Type           | env_deploy
CreatedAt      | 2022-11-01 17:36:52 +0000 +0000
UpdatedAt      | 2022-11-01 17:36:52 +0000 +0000
$ bunnyshell-cli environments deploy --id 19xZn8BxbK -o json

{
  "createdAt": "2022-11-01T17:42:03Z",
  "environment": "19xZn8BxbK",
  "id": "dLbK0gXJvn",
  "organization": "78B4Ob1J5P",
  "status": "in_progress",
  "type": "env_deploy",
  "updatedAt": "2022-11-01T17:42:03Z"
}

The deploy action returns an Event, which must be cheched, using the events show command, which requires the EventID returned by the deploy action.

$ bns events show --id K7GzwLyND3

EventID        | K7GzwLyND3
EnvironmentID  | gbDLLp7DK2
OrganizationID | 78B4Ob1J5P
Status         | in_progress
Type           | env_deploy
CreatedAt      | 2022-11-01 17:36:52 +0000 +0000
UpdatedAt      | 2022-11-01 17:36:52 +0000 +0000
$ bunnyshell-cli events show --id dLbK0gXJvn -o json

{
  "createdAt": "2022-11-01T17:42:03Z",
  "environment": "19xZn8BxbK",
  "id": "dLbK0gXJvn",
  "organization": "78B4Ob1J5P",
  "status": "in_progress",
  "type": "env_deploy",
  "updatedAt": "2022-11-01T17:42:03Z"
}

👍

Pro Tip

You can run the command with the --monitor flag, so the command will wait for the deployment to finish. This saves you the trouble of having to check periodically if the deployment finished or not.

 

📘

Consider reading about Deployment Strategies as well.

 

Cloning an environment

With Bunnyshell, you can clone any existing environment. This will copy the environment definition, variables and settings.

Cloning an environment allows you to:

  • Quickly create a new development or staging environment.
  • Create an up-to-date environment to demo sale your product without interfering with development or other demos.
  • Create an ephemeral environment to validate a feature or a bug fix that needs to reflect the original Environment.

👍

Pro Tip

Cloning environments makes a great way to use Environment templates. Just create a primary environment which will act as your template, and then on-demand or programatically clone it to create working copies, then deploy the cloned environments.

UI Cloning

For starters, access the environment you want to clone:

  1. Click the Actions menu.
  2. Click the Clone button.
  3. Type a name for your new environment.
  4. Click Clone environment.

CLI Cloning

In order to clone an environment, you must make use of the environments clone command.
--id and --name are mandatory parameters, specifying the ID of the source environment, and the name of the target environment, respectively.

$ bns environments clone --id 8AEJQ1oXW7 --name "My clonened env"

EnvironmentID   | gbDLLp7DK2
ProjectID       | DEKr5YlrPp
Name            | My clonened env
Namespace       | xyzert
Type            | primary
Components      | 3
OperationStatus | ready
$ bunnyshell-cli environments clone --id 8AEJQ1oXW7 --name "My clonened env json" -o json

{
  "id": "19xZn8BxbK",
  "name": "My clonened env json",
  "namespace": "xowy4i",
  "operationStatus": "ready",
  "project": "DEKr5YlrPp",
  "totalComponents": 3,
  "type": "primary"
}

 

Stopping an environment

UI Stopping

  1. Select the running environment.
  2. Click the Actions menu.
  3. Click the Stop button.

Alternately, you can Stop the Environment directly from the Environments listing.

CLI Stopping

Stopping an environment is achieved by running the environments stop command. The --id parameter is mandatory.

$ bns environments stop --id gbDLLp7DK2

EventID        | z4GywaYbRZ
EnvironmentID  | gbDLLp7DK2
OrganizationID | 78B4Ob1J5P
Status         | in_progress
Type           | env_stop_manual
CreatedAt      | 2022-11-01 17:49:33 +0000 +0000
UpdatedAt      | 2022-11-01 17:49:33 +0000 +0000
$ bunnyshell-cli environments stop --id 19xZn8BxbK -o json

{
  "createdAt": "2022-11-01T17:48:02Z",
  "environment": "19xZn8BxbK",
  "id": "8VG3mjAbOm",
  "organization": "78B4Ob1J5P",
  "status": "in_progress",
  "type": "env_stop_manual",
  "updatedAt": "2022-11-01T17:48:02Z"
}

Similarly with deploying, the stop command will create an asynchronous job, and return the Event ID. You should run the events show command, optionally with the --monitor flag.

bns events show --id z4GywaYbRZ
bns events show --id 8VG3mjAbOm -o json

Please see the CLI Deployment section for concrete examples.

 

Starting an environment

UI Starting

  1. Select the stopped environment.
  2. Click the Actions menu.
  3. Click the Start button.

Alternately, you can Start the Environment directly from the Environments listing.

CLI Starting

Starting an environment is achieved by running the environments start command. The --id parameter is mandatory.

$ bns environments start --id gbDLLp7DK2

EventID        | zXb6ednNMq
EnvironmentID  | gbDLLp7DK2
OrganizationID | 78B4Ob1J5P
Status         | in_progress
Type           | env_start_manual
CreatedAt      | 2022-11-01 17:53:37 +0000 +0000
UpdatedAt      | 2022-11-01 17:53:37 +0000 +0000
$ bunnyshell-cli environments start --id 19xZn8BxbK -o json

{
  "createdAt": "2022-11-01T17:53:45Z",
  "environment": "19xZn8BxbK",
  "id": "5EGoQ2Xbw0",
  "organization": "78B4Ob1J5P",
  "status": "in_progress",
  "type": "env_start_manual",
  "updatedAt": "2022-11-01T17:53:45Z"
}

Similarly with deploying, the start command will create an asynchronous job, and return the Event ID. You should run the events show command, optionally with the --monitor flag.

bns events show --id zXb6ednNMq
bns events show --id 5EGoQ2Xbw0 -o json

Please see the CLI Deployment section for concrete examples.

 

Deleting an environment

Ready to Delete an environment in Bunnyshell? Before continuing, make sure you've selected/targeted the right environment.

❗️

Note

Please note that this is an irreversible operation. By deleting your environment, all your running applications and data within the environment are deleted.

UI Deleting

  1. Click the Actions menu.
  2. Click the Delete button.
  3. When asked to confirm your action, click on Delete.

CLI Deleting

Deleting an environment is achieved by running the environments delete command. The --id parameter is mandatory.

$ bns environments delete --id gbDLLp7DK2

EventID        | 4xGEm1VGAz
EnvironmentID  | gbDLLp7DK2
OrganizationID | 78B4Ob1J5P
Status         | in_progress
Type           | env_delete
CreatedAt      | 2022-11-01 17:57:35 +0000 +0000
UpdatedAt      | 2022-11-01 17:57:35 +0000 +0000
$ bunnyshell-cli environments delete --id 19xZn8BxbK -o json

{
  "createdAt": "2022-11-01T17:58:20Z",
  "environment": "19xZn8BxbK",
  "id": "ygJgpWPGVP",
  "organization": "78B4Ob1J5P",
  "status": "in_progress",
  "type": "env_delete",
  "updatedAt": "2022-11-01T17:58:20Z"
}

Similarly with deploying, the delete command will create an asynchronous job, and return the Event ID. You should run the events show command, optionally with the --monitor flag.

bns events show --id 4xGEm1VGAz
bns events show --id ygJgpWPGVP -o json

Please see the CLI Deployment section for concrete examples.

 

Force-Deleting an environment

There are cases when an Environment cannot be deleted for various reasons from Bunnyshell, such as its Kubernetes cluster is disconnected or does not exist anymore, but the Environment still needs to be removed from Bunnyshell.

❗️

Important note

This action can be performed only from the UI, and will not delete any associated resources, so cleaning up resources is solely the user's responsibility.

Given an Environment that has failed deletion, and is stuck in Bunnyshell:

3454

Once the Environment's deletion has failed, the Force Delete option also appears in the actions menu.

3454

This will inform the user that only the Bunnyshell entity will be deleted, and no resource cleanup will be made.

3454