Moving from Convex
Up to version 1.8, BazarPro ran on Convex. From version 2.0 on, BazarPro has its own backend with a PostgreSQL database. A plain update isn’t enough for that: you export the data from Convex and load it into the new backend. Allow about half an hour, during which BazarPro is not available.
What is moved: all accounts with their passwords, bazaars, items with photos, sales and settlements, settings, logo and legal texts.
What is not moved: the sign-ins. All users sign in once more after the move – with their existing password. Best announce this beforehand.
Moving
Section titled “Moving”All commands run in the folder of your existing installation, where the docker-compose.selfhost.yml and the .env are.
-
Export the data from Convex. While the old installation is still running:
Terminal window docker compose -f docker-compose.selfhost.yml run --rm -T --entrypoint sh convex-init -c \'export CONVEX_SELF_HOSTED_ADMIN_KEY=$(cat /keys/admin_key) &&npx convex export --include-file-storage --path /tmp/export.zip >&2 && cat /tmp/export.zip' \> convex-export.zipThe file
convex-export.zipcontains all data and photos. Also copy it somewhere other than the server. -
Stop the old installation and keep its Compose file in case you need it:
Terminal window docker compose -f docker-compose.selfhost.yml downmv docker-compose.selfhost.yml docker-compose.convex.ymlThe Convex data stays in the Docker volume
bazarpro_convex_data. -
Download the new Compose file:
Terminal window curl -O https://raw.githubusercontent.com/BazarPro/core/main/docker-compose.selfhost.yml -
Extend the
.env. Compare it with the new template. New or changed are:POSTGRES_PASSWORD– a random password for the database, e.g. generated withopenssl rand -hex 24BAZARPRO_VERSION– at leastv2.0.0
All other entries stay as they are.
-
Load the export. The command starts the database, creates the tables and takes over the data from
convex-export.zip:Terminal window docker compose -f docker-compose.selfhost.yml run --rm \-v "$PWD/convex-export.zip:/import/export.zip:ro" \backend bazarpro-backend import /import/export.zipAt the end, a report shows the number of entries taken over per table. Under Probleme (problems) it lists entries that point to something deleted, e.g. roles in a deleted bazaar. They are skipped, which is usually fine.
The import only works into an empty database. If it aborts, nothing is taken over and you can simply repeat it after fixing the cause.
-
Start BazarPro:
Terminal window docker compose -f docker-compose.selfhost.yml up -d -
Check. Sign in, open a bazaar with photos and look under Admin › Settings whether name and logo are right.
-
Adjust sign-in with GitHub or Google – only if you use it. The callback URL has changed. Enter in the provider’s OAuth app:
- GitHub:
https://<DOMAIN>/api/auth/oauth/github/callback - Google:
https://<DOMAIN>/api/auth/oauth/google/callback
- GitHub:
Cleaning up
Section titled “Cleaning up”When everything has been running for a few days:
-
Delete DNS records: BazarPro no longer needs
convex.<DOMAIN>,convex-site.<DOMAIN>and, if you created it,convex-dashboard.<DOMAIN>. -
Delete the old data:
Terminal window docker volume rm bazarpro_convex_data bazarpro_convex_keysrm docker-compose.convex.ymlKeep
convex-export.zipas a backup for a while anyway. -
Set up the new backup: The old backup commands no longer work. How it works now is described under Backup.
-
Check your privacy policy: If it names Convex as a service provider, you can remove that. All data now lives in your own database.
Back to the old installation
Section titled “Back to the old installation”As long as the volume bazarpro_convex_data still exists, you can go back:
docker compose -f docker-compose.selfhost.yml downdocker compose -f docker-compose.convex.yml up -dSet BAZARPRO_VERSION in the .env back to your old version for that. Whatever was changed in the new backend since the move is missing in the old installation.