---
title: 'Update guide'
---

# Keeping your instance synced

Keeping your instance up-to-date with the latest features and bug fixes can enhance your instance's functionality and ensure it stays current. When updates are released, you have the option to adopt them using either one of the guides. Below is a automatic and an manual guide on updating your instance.

## Automatic update

You can also setup a scheduled workflow to automatically update your instance. This will allow you to keep your instance up to date without manual intervention.

To do this, you will need to follow the guide below...

<Warning>
  This upgrade method will only work if your repository is a fork!
</Warning>

<Steps>
  <Steps.Step>
    If you have not already, click [here](https://github.com/p-stream/p-stream/fork) to fork the P-Stream Github repository.
  </Steps.Step>
  <Steps.Step>
    Paste the below file into your repository's root `/.github/workflows` directory

    ```yaml
    # File: .github/workflows/sync.yml
    name: Sync fork

    permissions:
      contents: write

    on:
      schedule:
        - cron: "0 0 * * *"
      workflow_dispatch:

    jobs:
      sync:
        name: Sync fork
        runs-on: ubuntu-latest
        if: ${{ github.event.repository.fork }}

        steps:
          - name: Checkout code
            uses: actions/checkout@v4

          - name: Sync fork
            run: gh repo sync ${{ github.repository }}
            env:
              GH_TOKEN: ${{ github.token }}

          - uses: gautamkrishnar/keepalive-workflow@v1
    ```

  </Steps.Step>
  <Steps.Step>
    Commit and push the changes to your repository.
  </Steps.Step>
</Steps>

Your instance should now be automatically updated to the latest version.

## Manual update

You can manually update by executing the following commands in the root directory of the repository you have created, you would have to do this every time a push occurs to stay up-to-date:

```bash
git remote add P-Stream https://github.com/p-stream/p-stream.git
git fetch P-Stream
# Change `dev` to `master` if you want a stable experience
git merge P-Stream/dev --allow-unrelated-histories
git push -f # Force push to your origin main branch
```

# Upgrade version

## From `3.X` to `4.X`

You will need the latest version of the proxy worker. Redeploy a new worker using [our self-hosting guide](../proxy/deploy.md).

After you have the new worker, you will need to [get the new P-Stream deployment files](https://github.com/p-stream/p-stream/releases/latest). **You CANNOT use the non-PWA version**. To upgrade safely without any complications, you need to update with `P-Stream.pwa.zip`, Not the non-PWA version.

In the future, you will **ALWAYS** need to go with the PWA option. You cannot downgrade to non-PWA version without facing many caching complications.
