Migrates a user's entire Nextcloud file tree into their Cozy instance. Runs as a standalone RabbitMQ consumer.
When a user triggers a migration from the Settings UI, the Cozy Stack creates a tracking document and publishes a message to RabbitMQ. This service picks it up and:
- Gets a short-lived token from the Cloudery
- Checks idempotency (skip if already running or completed)
- Validates there's enough disk quota on the Cozy side
- ACKs the message early (the tracking document takes over as source of truth)
- Walks the Nextcloud tree directory by directory, transferring each file through the Stack's proxy routes
- Updates the tracking document after each file so the user sees live progress
The service never talks to Nextcloud directly. All file operations go through the Cozy Stack, which handles WebDAV internally.
- A single file failure doesn't abort the migration — the error is recorded in the tracking document and the service moves on.
- If a file already exists in Cozy (409), it's skipped. This makes migrations resumable after a crash.
- Token expiration mid-migration triggers an automatic refresh from the Cloudery.
- If the consumer itself crashes mid-migration, the tracking document is left in
runningwith a stale heartbeat. The next message that arrives for the same migration id picks the work back up and skips files already in Cozy.
Copy .env.example to .env and fill in the values. See docs/configuration.md for details.
- Configuration — environment variables and setup
- Development — local dev, testing, project structure
- Local end-to-end testing — run the full flow against a real Nextcloud without a Cloudery
- Docker — building, running, and CI image publishing
- RabbitMQ contract — exchange, queue, message format
- Tracking document — CouchDB schema, status transitions, fields
- Operations — runbook: health signals, stuck migrations, DLQ inspection