How To Back-Up Your Umbraco 7 Data Using uSync and Files

Over the last few articles, I’ve discussed how to use uSiteBuilder in order to use classes to define your document types in How To Build An Umbraco 7 Document Types In Visual Studio – USiteBuilder Explained.

Using uSiteBuilder can have some performance issues on really big websites, so in some circumstances, you may want to consider other alternatives.  In today’s guide, we’re going to cover USync. A free Nuget package that will allow you back-up your Umbraco settings to your webroot.  Using uSync we store things like document types, data types, templates and media file definitions.

Installing uSync

umbraco_usync

In NUget package manager, type in uSync and you should be presented with the list of options above.  I’m installing the uSync back office so I can export and import using uSync within the Umbraco backend.

After you have installed uSync if you open up Umbraco CMS and go to the ‘Developer’ section from the left-hand menu, as seen below:

umbraco_usync_backoffice

From here make sure you have ‘Automatic’ set if you want and from here you can do an import from an existing site, or, an export to save your data to disk.  After hitting export for example, in your webroot you should see a folder called ‘uSync’.  Under here you will see a list of folders for the various data-types that have been saved.

umbraco_usync_folder_layout

So for example, a document type definition would look like this:

<?xml version="1.0" encoding="utf-8"?>
<DocumentType>
<Info>
<Key>fbc6755a-af49-40bf-93ec-2335a20ffd40</Key>
<Name>Content Page</Name>
<Alias>ContentPage</Alias>
<Icon>.sprTreeFolder</Icon>
<Thumbnail>folder.png</Thumbnail>
<Description></Description>
<AllowAtRoot>True</AllowAtRoot>
<IsListView>False</IsListView>
<Master Key="5102c960-09bb-4b08-9c3d-0577d934d878">Custom</Master>
<Compositions>
<Composition Key="5102c960-09bb-4b08-9c3d-0577d934d878">Custom</Composition>
</Compositions>
<DefaultTemplate>ContentPage</DefaultTemplate>
</Info>
<Structure>
<DocumentType Key="fbc6755a-af49-40bf-93ec-2335a20ffd40">ContentPage</DocumentType>
<DocumentType Key="5102c960-09bb-4b08-9c3d-0577d934d878">Custom</DocumentType>
<DocumentType Key="5757beec-d6db-412d-93cb-0d3f7594d53c">umbHomePage</DocumentType>
<DocumentType Key="b4dd2970-53c5-4afe-b7f5-1db520f52ab5">umbMaster</DocumentType>
<DocumentType Key="3c5fdee8-53ba-4873-9b04-9ce36f856283">umbNewsItem</DocumentType>
<DocumentType Key="550ab217-8472-4ced-8960-fedc1d8babee">umbNewsOverview</DocumentType>
<DocumentType Key="bad739cf-7b2f-4e50-bed0-72a1bc56e2a8">umbTextPage</DocumentType>
</Structure>
<GenericProperties />
<Tabs />
</DocumentType>

Using this file you could then simply copy this config onto your production server that had uSync installed and the page type would automatically install on application start-up.  All the events are fired from Jumoo.uSync.BackOffice.Events.

Event Handling

uSync also has events that you can hook into. When uSync imports files you can configure it to do other stuff.

Conclusion

In today’s guide we have covered what uSync is and how it can be used to export and import your database changes to your Umbraco webroot. uSync is a great little utility to back-up Syncing Umbraco database config to disk and back. uSync combined with a file transfer app like Sugarsync or dropbox means you can update one Umbraco install and have all the other automatically update as well, all without doing a code deploy.

There are pros and con’s to this approach.  On one hand the back-up and sync feature is really good. uSync however is not a plug-in to enable code first.  Document types cannot be defined in code, using uSync cannot help enable out of the box strongly-typed data models.

Jon D Jones

Software Architect, Programmer and Technologist Jon Jones is founder and CEO of London-based tech firm Digital Prompt. He has been working in the field for nearly a decade, specializing in new technologies and technical solution research in the web business. A passionate blogger by heart , speaker & consultant from England.. always on the hunt for the next challenge

More Posts

1 reply

Trackbacks & Pingbacks

  1. […] my last tutorial ‘How To Back-Up Your Umbraco 7 Data Using uSync and Files‘ I talked about how you can back-up and sync your Umbraco document types and templates using […]

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *