> ## Documentation Index
> Fetch the complete documentation index at: https://www.qovery.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# qovery environment

> Environment management commands

## Overview

Manage environments and their lifecycle within your Qovery project.

## Commands

### List Environments

List all environments in current project:

```bash theme={null}
qovery environment list
```

| Flag             | Description       |
| ---------------- | ----------------- |
| `--organization` | Organization Name |
| `--project`      | Project Name      |
| `--json`         | JSON output       |

### Deploy Environment

Deploy all services in an environment:

```bash theme={null}
qovery environment deploy --environment "env-name"
```

Deploy with specific services or versions:

```bash theme={null}
qovery environment deploy \
  --environment "env-name" \
  --applications "app1:commit_id,app2:commit_id" \
  --watch
```

| Flag                     | Description                                                                                                                                                                                          |
| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--organization`         | Organization Name                                                                                                                                                                                    |
| `--project`              | Project Name                                                                                                                                                                                         |
| `--environment`          | Environment Name                                                                                                                                                                                     |
| `--services`             | Services to deploy (JSON Format: [https://api-doc.qovery.com/#tag/Environment-Actions/operation/deployAllServices](https://api-doc.qovery.com/#tag/Environment-Actions/operation/deployAllServices)) |
| `--applications`         | Applications to deploy e.g. `app1:commit_id,app2:commit_id`. Omit commit id to use the same commit.                                                                                                  |
| `--containers`           | Containers to deploy e.g. `container1:image_tag,container2:image_tag`. Omit image tag to use the same tag.                                                                                           |
| `--lifecycles`           | Lifecycle jobs to deploy e.g. `job1:image_tag\|git_commit_id,job2:...`. Omit version to use the same.                                                                                                |
| `--cronjobs`             | Cronjobs to deploy e.g. `cronjob1:git_commit_id,cronjob2:git_commit_id`. Omit commit id to use the same.                                                                                             |
| `--helms`                | Helm charts to deploy e.g. `helm1:chart_version\|git_commit_id,helm2:...`. Omit version to use the same.                                                                                             |
| `--watch` / `-w`         | Watch environment status until it's ready or an error occurs                                                                                                                                         |
| `--skip-paused-services` | Skip paused services: paused services won't be started / deployed                                                                                                                                    |

### Stop Environment

Stop all services in an environment:

```bash theme={null}
qovery environment stop --environment "env-name"
```

| Flag             | Description                                                  |
| ---------------- | ------------------------------------------------------------ |
| `--organization` | Organization Name                                            |
| `--project`      | Project Name                                                 |
| `--environment`  | Environment Name                                             |
| `--watch` / `-w` | Watch environment status until it's ready or an error occurs |

### Cancel Environment Deployment

Cancel an ongoing environment deployment:

```bash theme={null}
qovery environment cancel --environment "env-name"
```

| Flag             | Description                                                  |
| ---------------- | ------------------------------------------------------------ |
| `--organization` | Organization Name                                            |
| `--project`      | Project Name                                                 |
| `--environment`  | Environment Name                                             |
| `--force` / `-f` | Force cancel                                                 |
| `--watch` / `-w` | Watch environment status until it's ready or an error occurs |

### Delete Environment

Delete an environment:

```bash theme={null}
qovery environment delete --environment "env-name"
```

| Flag             | Description                                                  |
| ---------------- | ------------------------------------------------------------ |
| `--organization` | Organization Name                                            |
| `--project`      | Project Name                                                 |
| `--environment`  | Environment Name                                             |
| `--watch` / `-w` | Watch environment status until it's ready or an error occurs |

### Update Environment

Update an environment's name or type:

```bash theme={null}
qovery environment update \
  --environment "env-name" \
  --name "new-name"
```

| Flag                    | Description                                                  |
| ----------------------- | ------------------------------------------------------------ |
| `--organization` / `-o` | Organization Name                                            |
| `--project` / `-p`      | Project Name                                                 |
| `--environment` / `-e`  | Environment Name                                             |
| `--name`                | New Environment Name                                         |
| `--type`                | Change Environment Type (`DEVELOPMENT\|STAGING\|PRODUCTION`) |

### Clone Environment

Clone an existing environment:

```bash theme={null}
qovery environment clone \
  --environment "production" \
  --new-environment-name "staging-clone"
```

| Flag                            | Description                                                                                |
| ------------------------------- | ------------------------------------------------------------------------------------------ |
| `--organization` / `-o`         | Organization Name                                                                          |
| `--project` / `-p`              | Project Name                                                                               |
| `--environment` / `-e`          | Environment Name to clone                                                                  |
| `--new-environment-name` / `-n` | New Environment Name (required)                                                            |
| `--cluster` / `-c`              | Cluster Name where to clone the environment                                                |
| `--environment-type` / `-t`     | Environment type for the new environment (`DEVELOPMENT\|STAGING\|PRODUCTION`)              |
| `--apply-deployment-rule`       | Enable applying deployment rules on the new environment instead of having a pristine clone |
| `--target-project`              | Target Project Name                                                                        |

## Examples

### Deploy Environment

```bash theme={null}
# Set context
qovery context set

# Deploy all services and watch
qovery environment deploy \
  --environment "my-env" \
  --watch

# Deploy specific applications with specific commits
qovery environment deploy \
  --environment "my-env" \
  --applications "api:abc1234,frontend:def5678" \
  --watch
```

### Cancel a Deployment

```bash theme={null}
# Cancel current deployment
qovery environment cancel --environment "my-env"

# Force cancel and watch
qovery environment cancel \
  --environment "my-env" \
  --force \
  --watch
```

### Clone Production to Staging

```bash theme={null}
# Clone environment
qovery environment clone \
  --environment "production" \
  --new-environment-name "staging-test" \
  --environment-type STAGING

# Clone to a different project and cluster
qovery environment clone \
  --environment "production" \
  --new-environment-name "staging-test" \
  --target-project "other-project" \
  --cluster "staging-cluster"

# Deploy cloned environment
qovery environment deploy --environment "staging-test"
```

### Update Environment

```bash theme={null}
# Rename an environment
qovery environment update \
  --environment "old-name" \
  --name "new-name"

# Change environment type
qovery environment update \
  --environment "my-env" \
  --type PRODUCTION
```

## Related Commands

* [`qovery application`](/cli/commands/application) - Manage applications
* [`qovery database`](/cli/commands/database) - Manage databases
* [`qovery status`](/cli/commands/status) - Check environment status
