General upgrading steps
No matter how you choose to install the software, you will need to upgrade it from time to time. Follow these steps to upgrade your installation:
Download the latest release of Saleor and make sure it's connected to the same database that your existing installation was using.
Stop the Celery workers to make sure they don't process any tasks while the database is being upgraded.
Run the following command to upgrade the database schema:
docker compose run --rm api python3 manage.py migrate
Or, if you don't use Docker:
python3 manage.py migrate
Upgrade the web workers and Celery workers to run the new version of the code.
Start the Celery workers again.
For instructions specific to upgrading between particular versions, see the upgrade guides.
Upgrading with zero-downtime
For general knowledge of how zero-downtime migrations work, please check writing zero-downtime migrations.
Zero-downtime migrations can only be achieved by upgrading Saleor minor version by minor version, that means, to upgrade Saleor from version 3.11 to 3.13, you need first upgrade your workers to version 3.12, then proceed with upgrading to version 3.13. By upgrading from version 3.11 directly to 3.13 you will not follow zero-downtime policy.
The exact steps needed to be done:
Upgrade your current minor version to the newest patch of Saleor of that version, to do so follow general steps.
Upgrade your current minor version of Saleor to the next one. Again, remember to follow the steps stated in general steps.
Troubleshooting: Migration with Celery task fails
It's safe to rerun failed migration tasks in case of an error. To do that, you can for example start a task from the Django shell:
python manage.py shell
And inside the shell import the task and schedule it, e.g.:
from saleor.order.migrations.tasks import task
Troubleshooting: Adding a new index fails
Adding the index concurrently to the database can fail. The recommended recovery method in such a scenario will be:
- Drop indexes that were added in failed migration, if they exist in the database as concurrent index building can result in adding the index that will be marked as
INVALID. To check if the index is marked as
INVALIDyou can use
psql \dcommand, e.g. to check indexes of Order you can run
- Rerun the migration.
- Run again command
psql \d tableto check if indexes are added correctly. The index will be considered correct if is not