# Upgrade

Follow this guide to upgrade your current Supervisely instance.

### Step-by-step manual

#### Step 1. Update Supervisely CLI

Make sure you're using the latest Supervisely CLI:

```
sudo supervisely self-update
```

#### Step 2. Backup + Update + Deploy

One single command to handle them all:

```
sudo supervisely upgrade
```

To be sure you can always go back to any previous versions we make automatic backups every time you run the `sudo supervisely upgrade` command.

We back up configuration and database files only:

* Configuration folder: directory where you have your `docker-compose.yml` and `.env` files. We usually choose `/opt/supervisely` or `/supervisely`, but if you have installed Supervisely yourself, this folder can be somewhere else.
* Database folder: sometimes your upgrade requires database migration, so it's a good idea to back up the db before. Database files are stored in `${DATA_PATH}/db`. Default value is `/supervisely/data/db`.

#### Step 3. Check your new version

Wait a couple of minutes and open Supervisely. Everything should work fine, and you can start using the new functionality.

### Troubleshooting

**My agent changed its status to WAITING**: There are two possible reasons - either agent were disconnected during the update (in this case just wait a couple more minutes), or you forgot to set `SERVER_ADDRESS` in `.env`.

**Nothing works now. How do I go back?**: In case of any problems with the new release it's easy to go back to a previous version. Just replace your new configuration files with the previous ones from the backup, do the same with the database folder and hit `supervisely up -d` once again.

**Upgrade fails with `service "postgres" is not running`**: If the upgrade command exits with a `curl: (22) The requested URL returned error: 500` and the message `service "postgres" is not running`, start the Postgres service first and then re-run the upgrade:

```
sudo supervisely start postgres
sudo supervisely upgrade --skip-backup
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.supervisely.com/enterprise-edition/get-supervisely/upgrade.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
