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

# Updating Midaz

> Update your Midaz environment safely with local Docker upgrades and Helm-based rollouts to keep your installation secure and current.

Keeping Midaz up to date means you work with the latest features, security patches, and improvements. Regular updates also keep Midaz compatible with other components and help prevent issues caused by outdated dependencies.

Below are the steps to update Midaz in your local environment and using Helm.

<Note>
  From Midaz 3.x onwards, dedicated migration-runner images (`midaz-ledger-migrations`, `midaz-tracer-migrations`) apply the schema migrations **before** the app rollout. The apps no longer migrate at startup. Local `make up` and the official Helm chart wire this up automatically. See [Database migrations](/en/products/midaz/database-migrations) for details.
</Note>

## Updating Midaz locally

***

If you're running Midaz locally for development or testing, follow these steps to update your environment:

### 1. Stop the running containers

Shut down all running services before making updates. This ensures a clean restart with the latest updates.

To stop the containers via the terminal, follow these steps:

<Steps>
  <Step>
    Open your terminal and navigate to the `midaz` directory.
  </Step>

  <Step>
    Run the stop command:

    <CodeGroup>
      ```Shell Shell theme={null}
      make down
      ```
    </CodeGroup>
  </Step>
</Steps>

### 2. (Optional) Clean up unused Docker resources

Cleaning up unused resources frees disk space, removes stale Docker cache layers, and prevents conflicts from outdated images, containers, and volumes.

To remove unused images and containers:

<CodeGroup>
  ```Shell Shell theme={null}
  docker system prune --all
  ```
</CodeGroup>

To remove unused Docker volumes:

<CodeGroup>
  ```Shell Shell theme={null}
  docker volume prune
  ```
</CodeGroup>

### 3. Update your local codebase

Fetch the latest changes from the repository to ensure you're working with the most recent version:

<CodeGroup>
  ```Shell Shell theme={null}
  git pull origin main
  ```
</CodeGroup>

### 4. Rebuild and restart Midaz

Rebuild necessary Docker images and relaunch the application locally with the latest updates:

<CodeGroup>
  ```Shell Shell theme={null}
  make up
  ```
</CodeGroup>

## Updating Midaz with Helm

***

For deployments using Helm, use the following commands based on your needs.

### Fresh installation

Perform a fresh installation when you set up Midaz for the first time or when you need a clean deployment.

#### Install Midaz Helm with a custom values file

Use this method if you have specific configuration requirements defined in `values.yaml`:

<CodeGroup>
  ```Shell Shell theme={null}
  helm install midaz oci://registry-1.docker.io/lerianstudio/midaz-helm \
    --values values.yaml --version <version> -n midaz --create-namespace
  ```
</CodeGroup>

#### Install Midaz Helm with default values

Use this method to install Midaz using the default Helm chart values:

<CodeGroup>
  ```Shell Shell theme={null}
  helm install midaz oci://registry-1.docker.io/lerianstudio/midaz-helm \
    --version <version> -n midaz --create-namespace
  ```
</CodeGroup>

### Updating an existing deployment

If you already deployed Midaz, use these commands to upgrade to a new version while preserving configurations.

#### Updating Midaz Helm with a custom values file

Ensure that custom configurations remain intact while applying the update:

<CodeGroup>
  ```Shell Shell theme={null}
  helm upgrade midaz oci://registry-1.docker.io/lerianstudio/midaz-helm \
    --values values.yaml --version <new-version> -n midaz --create-namespace
  ```
</CodeGroup>

#### Updating Midaz Helm with default values

Use this command if you do not need to apply custom configurations:

<CodeGroup>
  ```Shell Shell theme={null}
  helm upgrade midaz oci://registry-1.docker.io/lerianstudio/midaz-helm \
    --version <new-version> -n midaz --create-namespace
  ```
</CodeGroup>

## Managing the Helm release

***

Use these commands to check and manage your Midaz Helm deployment.

### List installed releases

List all Helm releases in the `midaz` namespace, along with their status and version:

<CodeGroup>
  ```Shell Shell theme={null}
  helm ls -n midaz
  ```
</CodeGroup>

### Delete the Midaz Helm release

If you need to completely remove Midaz from your cluster, run:

<CodeGroup>
  ```Shell Shell theme={null}
  helm delete midaz -n midaz
  ```
</CodeGroup>

<CodeGroup>
  ```Shell Shell theme={null}
  helm delete midaz -n midaz
  ```
</CodeGroup>
