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

# Upgrade Guide

> How to upgrade Libredesk to the latest version

<Warning>
  Always take a backup of the Postgres database before upgrading Libredesk.
</Warning>

<Accordion title="How to back up the database">
  Dump the database to a file with `pg_dump`. This works for both Docker and non-Docker setups, since Docker exposes Postgres on `localhost:5432`. Replace the user and database name (`libredesk`) if you changed them in your config.

  ```bash theme={null}
  pg_dump -h localhost -U libredesk libredesk > libredesk_backup.sql
  ```
</Accordion>

## Upgrade Methods

<Tabs>
  <Tab title="Binary">
    <Steps>
      <Step title="Stop Libredesk">
        Stop the running libredesk binary process.
      </Step>

      <Step title="Download latest release">
        Download the [latest release](https://github.com/abhinavxd/libredesk/releases) and extract the libredesk binary to overwrite the previous version.
      </Step>

      <Step title="Upgrade database">
        ```bash theme={null}
        ./libredesk --upgrade
        ```

        Upgrades are idempotent and running them multiple times have no side effects.
      </Step>

      <Step title="Start Libredesk">
        ```bash theme={null}
        ./libredesk
        ```
      </Step>
    </Steps>
  </Tab>

  <Tab title="Docker">
    <Steps>
      <Step title="Stop the application">
        ```bash theme={null}
        docker compose down app
        ```
      </Step>

      <Step title="Pull latest image">
        ```bash theme={null}
        docker compose pull
        ```
      </Step>

      <Step title="Start the application">
        ```bash theme={null}
        docker compose up app -d
        ```
      </Step>
    </Steps>
  </Tab>
</Tabs>
