Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Nov 05, 2018 @ 19:18
    Nicholas Westby
    0

    Transfer Content Between Umbraco Cloud Projects (NOT Environments)

    I have an old Umbraco Cloud project and I'm thinking of transferring content to a new Umbraco Cloud project from that old project (these projects will be in entirely different Umbraco Cloud accounts). I was thinking of using Umbraco Deploy to do this. Here is roughly what I'm thinking:

    • Clone the Umbraco Cloud repo from "Project A: Live" to "Project B: Dev".
    • Use Umbraco Deploy to restore content from "Project A: Live" to my local.
    • Use Umbraco Deploy to transfer my local content to "Project B: Dev".

    I have no idea if this is possible. Here are some of my concerns:

    • How do I let Umbraco Deploy know about both projects?
    • Can I push content from one project to another (empty) project?
    • Will I be able to do a second sync later on (months later)?
    • Will I be able to transfer the users from one project to another?

    Just wondering if anybody has tried this before, or if anybody knows some reasons this won't work, or has tips on how to accomplish it. Perhaps there are some complications I'm not thinking of that you could mention as well.

  • Paul Sterling 718 posts 1534 karma points MVP 9x admin c-trib
    Nov 05, 2018 @ 20:18
    Paul Sterling
    1

    Hi Nick -

    I believe you can configure the two projects in question to do this, but I doubt it's strictly supported as you outline it. Before you go too far down this road, have you looked at the Baseline feature? We use it across multiple projects to keep schema in-sync (a pre-req for a cross-project content deployment) and it may help simplify some of the complexity.

    Assuming your projects have an identical schema (see above) I think you will need to update each project's umbracoDeploy.config to tell Deploy about any source/destination environments. Then, and this is part I'm not sure about, you'll need to set the Umbraco.Deploy.ApiKey in web.config so the key matches in the source and destination environments. I'd for sure keep a backup of any keys you change ;-)

    With that, you should be able to restore from (or deploy to) a known environment.

    Full disclosure: I've never tried this and don't know if the Umbraco.Deploy.ApiKey is something you can actually change or if it has deeper connections within the overall function of deployments.

    Let us know if that puts you on the right track.

    -Paul

  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Nov 05, 2018 @ 22:31
    Nicholas Westby
    0

    Hi Paul,

    Some useful information, thanks. That should help me at least setup a test to see if this will work.

    I am aware of the Baseline feature, but I don't think it will work in this case, as the projects are located in different Umbraco Cloud accounts.

  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Nov 07, 2018 @ 00:54
    Nicholas Westby
    102

    I was able to do this. Here are some steps and other notes for anybody who is curious:

    • Restore Content to Local First, I restored all content from "Account A: Project A: Live" to my local.
    • Update Config Files I updated the Umbraco.Deploy.ApiKey app setting in my web.config and I updated the environment info in the ~/Config/UmbracoDeploy.config file.
    • Increase Timeouts I increased the timeout in the ~/Config/UmbracoDeploy.Settings.config file to 30 minutes (see code snippet below).
    • Deploy Files I deployed the files from the old Umbraco Cloud account/project to the new Umbraco Cloud account/project.
    • Upgrade Umbraco There was an Umbraco version mismatch (between the files and the database). For now, I just ran the upgrade on Umbraco Cloud, but that probably borked something, so when I do this for real I'll probably sync the Umbraco version before deploying the files.
    • Fix Media Items I kept running into an issue about media files not existing. Turns out the umbracoDeployDependency and umbracoDeploySignature tables had incorrect data for some reason. I got around this by saving all media nodes again (see code snippet below), and then by saving another media node that the automated process seemed to miss (the error message indicates the media node ID, which helps to locate it).
    • Transfer Local to Live I was finally able to queue a transfer that ran successfully (after a number of failed attempts). This was from my local to the "Account B: Project B: Live" environment.

    Thanks again, Paul, for your tips.

    Code snippet for UmbracoDeploy.Settings.config:

    <?xml version="1.0" encoding="utf-8"?>
    <settings xmlns="urn:umbracodeploy-settings">
      <deploy sessionTimeout="1800" sourceDeployTimeout="1800" httpClientTimeout="1800"/>
    </settings>
    

    Code snippet to resave all media nodes:

    var allMedia = Umbraco.TypedMediaAtRoot().SelectMany(x => x.DescendantsOrSelf())
        .Select(x => x.GetKey())
        // Need to process less than 2,000 at a time.
        .Take(1500)
        .ToArray();
    var mediaService = ApplicationContext.Services.MediaService;
    var mediaNodes = mediaService.GetByIds(allMedia);
    foreach (var item in mediaNodes)
    {
        mediaService.Save(item);
    }
    

    Summary: I was able to transfer the content from one Umbraco Cloud project on one account to a different Umbraco Cloud project on a different account.

  • Jez Reel R. Maghuyop 20 posts 62 karma points
    Dec 04, 2018 @ 08:08
    Jez Reel R. Maghuyop
    1

    Thanks for posting the solution, this is what I actually need for my upcoming project since I'll be using my own Account to do the development and then transfer it to my client once it is complete.

    You saved me from a lot of headaches :)

Please Sign in or register to post replies

Write your reply to:

Draft