Klevr Product Documentation logo

uSync Deployment Process

🧠 Umbraco uSync – Training Guide (Klevr Context)

1. What uSync Is (Core Concept)

uSync is a synchronisation layer between the Umbraco SQL database and files on disk.

  • Changes made in Umbraco → saved to SQL DB
  • uSync captures those changes and writes them to XML files
  • These XML files can then be:
    • Source controlled
    • Packaged and moved between environments

👉 uSync essentially serialises database configuration + content into files, enabling environment portability.

2. uSync Content vs Settings

uSync splits everything into two logical buckets:

⚙️ Settings

  • Structural/configuration elements
  • Examples:
    • Document types
    • Data types
    • Templates (definitions only)
    • Properties / controls
    • Typically product-driven changes

📄 Content

  • Actual instance data
  • Examples:
    • Pages
    • Media items (references)
    • Property values

🧠 Key Insight

  • Settings define the structure
  • Content fills the structure

3. Relationship Between uSync Files and Database

Think of it like this:

User change → SQL Database → uSync → XML Files

  • uSync writes to disk on save
  • Files and DB can become out of sync

Example scenarios:

  • Import ZIP → overwrites files → DB no longer aligned
  • Product deploy → overwrites files → DB out of sync

👉 uSync provides:

  • Report → shows differences
  • Import → Files → DB
  • Export → DB → Files

4. Product Releases & uSync Interaction

What happens during a release?

  1. Product deploys new features
  2. uSync settings (and default content) files on disk are overwritten with new settings
  3. DB is now missing those new settings

Required step:

👉 Run uSync Import Settings

  • Pulls new product settings into DB
  • Ensures Umbraco understands new features

May impact content consistency. Best practice (but with understanding consequences and timing of your own content deployments): run (Clean) Export after import to re-sync all files - remember this will remove "delete page" instructions, so if you have pages to be removed, keep this in mind.

5. Migrating Between Environments Using uSync

Standard flow

Source environment (e.g. Dev):

  1. Export uSync files (or Klevr export ZIP)

Target environment (e.g. Test/Prod):

  1. Import files

  2. Run uSync Import

Key behaviours

  • ID mapping handled automatically (GUID-based)
  • Files mirror site hierarchy
  • Partial imports possible (by editing the contents of the zip file before importing, and keeping in mind your current state, not doing a clean import if you only ahave partial files, etc)

👉 Best practice:

  • Use full import for initial setup
  • Use incremental imports for updates (import settings for product updates, import content for your own releases)
  • Use "Report" to understand the differences between the current set of files and DB state.

6. Clean Import vs Clean Export

🧹 Clean Export (DB → Files)

  • Deletes ALL existing uSync files
  • Recreates files from DB state

✅ Behaviour:

  • Removes:
    • orphaned files
    • conflicting instructions
  • Produces:
    • only current state
Removes delete instructions

🧼 Clean Import on Klevr page: (Zip -> Files)

  • Deletes all existing uSync files first
  • Then imports ZIP

✅ Purpose:

  • Removes stale instructions not overwritten by import
  • Ensures clean baseline

🧠 Mental Model

Operation
Direction
Purpose
usync Export
DB → Files
Sync files with DB
usync Clean Export
DB → Files
deletes all files, then Sync files with DB
usync Import
Files → DB
Apply changes from files to DB
Klevr Clean Import
Zip -> Files
delete all existing files, replace with zip files
Klevr Import
Zip -> Files
Append / Override files from zip, leave other files in tact

7. Delete Instruction Files (“Empty Files”)

What are they?

When something is deleted in Umbraco:

  • uSync creates an delete marker file
  • This file tells other environments to also delete it

Example:

<Page name="Home" Change="Delete" />

✅ Behaviour:

  • On import → deletes the item in target system
  • Preserves delete intent across environments

Lifecycle

ActionResult
Delete itemRemove instruction file created
Import elsewhereItem deleted from DB, based on remove file above
Clean ExportRemove instruction files deleted from current environment

If you:

  1. Delete content
  2. Run Clean Export
  3. Deploy elsewhere

The deletion will NOT happen (instruction lost)

Check your content to see you have matching number of pages, and if necessary, delete all content and re-import.

8. Klevr Export (Extended uSync)

uSync does NOT cover everything, so Klevr extends it.

Standard uSync misses:

  • Template files (.cshtml contents)
  • Media file binaries
  • Page permissions
  • Redirects

✅ Klevr Export includes:

  • ✅ All uSync XML files
  • ✅ Template contents (optional, you can select templates you have changed)
  • ✅ customtheme.css
  • ✅ Media files
  • ✅ Page permissions
  • ✅ Redirects

If you take a "backup" export and include ALL templates, then do a product upgrade (which may include changes to standard product templates) then re-import your backup, you will override the product templates iwth old ones, losing critical product updates. To avoid this, be selective with the templates you export. Only export your own custom templates, and product templates you have changed. For product templates you have changed, it is best to compare and re-apply the changes in case these were updated in the product release, instead of just overriding them with old versions.

9. Klevr “Apply Post uSync Changes”

After import:

Problem:

  • uSync creates pages ✅
  • BUT does NOT apply permissions ❌
  • Does not apply redirects

Solution:

👉 Run Apply Post uSync Changes

This will:

  • Reads permission file from export
  • Applies permissions to all pages (specifically new pages htat just got created with usync import)

10. End-to-End Flow (Klevr + uSync)

🚀 Migration Workflow

1
Source environment
  • Clean Export (optional, depends on if you have "delete instructions, then don't do a clean export)
  • Klevr Export (ZIP)
2
Target environment
  • Clean Import - helps remove unnecessary target files
  • Upload ZIP
  • Run uSync Report to check and understand changes being imported.
  • Run uSync Import (usually content would be enough, but reporting will let you know)
3
Post-step
  • Apply Post uSync Changes

🔁 Product Upgrade Flow

1
Deploy product
2
uSync files are overwritten
3
Run uSync Import (Settings)
4
Optionally run a Clean Export

Depending on your current state of development and deployment, optionally do a Clean Export to ensure the files and DB are perfectly in sync.

11. Key Risks & Best Practices

⚠️ Risks

  • Losing delete instructions (Clean Export)
  • Out-of-sync DB/files
  • Environment version mismatch
  • Missing templates/media if not using Klevr export

✅ Best Practices

  • Always align versions across environments
  • Run Import after product deploy
  • Use Clean Import for reset scenarios
  • Use Klevr Export for full fidelity

✅ Summary (Simple Mental Model)

  • uSync = bridge between DB and XML
  • Settings = structure | Content = data
  • Import = Files → DB
  • Export = DB → Files
  • Clean = reset before sync
  • Delete files = instructions for removal
  • Klevr = fills uSync gaps

Last updated on