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

# Upgrade

> Safe upgrade procedure for Espresso sequencer nodes on the Decaf testnet. Covers image tags, backups, health checks, and rollback.

<Steps>
  <Step title="Review release notes & confirm target image">
    Open the Decaf **release** page and note the latest **Docker image tag** for the sequencer. For example, the current tag is:

    ```bash theme={null}
    ghcr.io/espressosystems/espresso-sequencer/sequencer:20251106-patch1
    ```

    Also check for any changes to **endpoints**, **genesis file**, or **staking rules**.
  </Step>

  <Step title="Backup data & keys">
    Back up your mounted directories (adjust paths if different):

    ```bash theme={null}
    sudo systemctl stop docker || true
    # or just stop the container:
    docker stop espresso-sequencer || true

    # back up sqlite store (non-DA) or any local data
    rsync -aH /opt/espresso/store/ /opt/espresso/backup/store-$(date +%F)/

    # back up key material
    rsync -aH /opt/espresso/keys/ /opt/espresso/backup/keys-$(date +%F)/
    ```

    If you operate a **DA node**, back up your **PostgreSQL** database per your DB’s backup procedure.
  </Step>

  <Step title="Pull new images">
    ```bash theme={null}
    export NEW_TAG="20251106-patch1"   # replace with the tag from release notes
    docker pull ghcr.io/espressosystems/espresso-sequencer/sequencer:${NEW_TAG}
    docker pull ghcr.io/espressosystems/espresso-sequencer/staking-cli:main
    ```
  </Step>

  <Step title="Update environment & restart">
    Confirm your environment is still valid for **Decaf** (notably, the **genesis file** and **endpoints**):

    ```bash theme={null}
    export ESPRESSO_SEQUENCER_GENESIS_FILE="/genesis/decaf.toml"
    export ESPRESSO_SEQUENCER_CONFIG_PEERS="https://cache.decaf.testnet.espresso.network"
    export ESPRESSO_SEQUENCER_ORCHESTRATOR_URL="https://orchestrator-UZAFTUIMZOT.decaf.testnet.espresso.network/"
    export ESPRESSO_SEQUENCER_CDN_ENDPOINT="cdn.decaf.testnet.espresso.network:1737"
    export ESPRESSO_STATE_RELAY_SERVER_URL="https://state-relay.decaf.testnet.espresso.network"
    ```

    Then restart the container using the **new tag**:

    ```bash theme={null}
    docker rm -f espresso-sequencer || true
    docker run -d --name espresso-sequencer --restart unless-stopped       -v /opt/espresso/store:/mount/sequencer/store       -v /opt/espresso/keys:/mount/sequencer/keys:ro       -e ESPRESSO_SEQUENCER_L1_PROVIDER -e ESPRESSO_SEQUENCER_L1_WS_PROVIDER       -e ESPRESSO_SEQUENCER_CONFIG_PEERS -e ESPRESSO_SEQUENCER_ORCHESTRATOR_URL       -e ESPRESSO_SEQUENCER_CDN_ENDPOINT -e ESPRESSO_STATE_RELAY_SERVER_URL       -e ESPRESSO_SEQUENCER_GENESIS_FILE       ghcr.io/espressosystems/espresso-sequencer/sequencer:${NEW_TAG}         sequencer -- http -- catchup -- status
    ```
  </Step>

  <Step title="Validate the upgrade">
    * Watch logs: `docker logs -f espresso-sequencer` and ensure the node **joins** and **syncs**.
    * Confirm **/status** and/or metrics are exposed on your configured API port.
    * Check **libp2p** connectivity (UDP port reachable, peers listed).
  </Step>

  <Step title="Rollback (if needed)">
    ```bash theme={null}
    export PREV_TAG="202510XX-some-previous"  # your last known good tag
    docker rm -f espresso-sequencer || true
    docker run -d --name espresso-sequencer       -v /opt/espresso/store:/mount/sequencer/store       -v /opt/espresso/keys:/mount/sequencer/keys:ro       ghcr.io/espressosystems/espresso-sequencer/sequencer:${PREV_TAG}         sequencer -- http -- catchup -- status
    ```

    Restore from your **store/** and **keys/** backups if corruption is suspected.
  </Step>
</Steps>

<Note>
  *Supported networks:* **Espresso Decaf testnet**.
</Note>
