Skip to content

v1 to v2 migration script - #1260

Draft
lmarini wants to merge 9 commits into
mainfrom
cursor/v1-to-v2-migration
Draft

lmarini wants to merge 9 commits into
mainfrom
cursor/v1-to-v2-migration

Conversation

@lmarini

@lmarini lmarini commented Nov 23, 2026

Copy link
Copy Markdown
Member

Migration script to migrate a v1 instance to v2.

lmarini and others added 9 commits November 20, 2026 13:54
Add scripts/v1_to_v2_migration with two migration paths: one through the
v1 and v2 REST APIs (users, spaces as groups, listeners, datasets,
folders, files, metadata, tags, thumbnails, comment sidecars) and one
that reads v1 MongoDB/GridFS and writes v2 MongoDB/MinIO directly. Both
are resumable through a checkpoint file.

Supporting changes found while running the migration:
- Map Elasticsearch metadata as "flattened" so metadata keys with
  inconsistent value types no longer fail indexing.
- Let admin mode list dataset folders, matching the sibling routes.
- docker-compose: Mongo 6 with port 27017 exposed, and no Traefik
  request body limit on the backend router.
- Ignore migration output and the default checkpoint file.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Write password and API-key files with mode 0600, expire and revoke
migration keys, skip datasets instead of uploading as admin, and bind
Mongo to localhost.

Co-authored-by: Cursor <cursoragent@cursor.com>
…them.

The v2 dataset id was stored as soon as the dataset was created, so a crashed run treated it as finished and --force created a second dataset. Track phase progress and mark the dataset complete only after its children succeed, reusing the existing v2 id on resume.

Co-authored-by: Cursor <cursoragent@cursor.com>
A pagination error used to stop the loop and migrate only the datasets already fetched, with no signal that the inventory was incomplete. Retry transient server errors, then raise so the run cannot continue on a truncated dataset list.

Co-authored-by: Cursor <cursoragent@cursor.com>
The inventory command only lists v1 datasets, but it constructed a full migrator and required CLOWDER2_BASE_URL plus a v2 login. Skip the v2 client unless the command actually writes to v2.

Co-authored-by: Cursor <cursoragent@cursor.com>
api_clients imports httpx whenever the migration runs, but the package was listed only in the dev group, so a production install could not run the API path.

Co-authored-by: Cursor <cursoragent@cursor.com>
sync_users minted a password for every candidate and always saved generated-owner-passwords.json, including when MIGRATION_DRY_RUN was set and no users were created.

Co-authored-by: Cursor <cursoragent@cursor.com>
_stream_file_to_minio read the whole object into memory before upload, so a large file could exhaust the migration host. Pass the GridFS stream through and let MinIO read it in parts.

Co-authored-by: Cursor <cursoragent@cursor.com>
failures.json and migration-checkpoint.json were written with the process umask, so on a shared host they were more readable than the credential files stored beside them.

Co-authored-by: Cursor <cursoragent@cursor.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant