Copied to clipboard

Flag this post as spam?

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


  • Wouter van Vugt @ PGGM 5 posts 106 karma points
    Sep 29, 2016 @ 08:18
    Wouter van Vugt @ PGGM
    0

    Provisioning new Umbraco environments using scripting

    Hi,

    we are looking for an approach to scripting new Umbraco environments in a DTAP street. We apply DTAP in our enterprise and have noticed no real solution to creating Umbraco environments using fully automated steps.

    First of all, I have noticed that the installation steps in the Web.Install namespace are internal. Although you can replicate these steps in your own install code, this would be unsupportable and has proven to be a bit unstable (forgot to refresh an XML cache, views not loading, and future steps that we have no knowledge of create issues)

    Replicating the database across environments is also a bit of a no-go. Everything from encryption of passwords which possibly use machine keys, to the registration of server names in the servers table block you from creating a simple database copy.

    Is there a supported approach to provisioning new Umbraco environments in an automated fashion? Hope there is!

    Regards,

    Wouter

  • Kevin Jump 2312 posts 14698 karma points MVP 7x c-trib
    Sep 29, 2016 @ 08:58
    Kevin Jump
    0

    Hi

    Chauffeur is a command line for umbraco allows you to do some scripting of things like install which will provision the DB (although i am not sure it works on all db types)

    even if you don't use it - it might be worth looking at the code to see how it does the provisioning.

    https://github.com/aaronpowell/Chauffeur/blob/master/Chauffeur/Deliverables/InstallDeliverable.cs

    in terms of more complex things beyond hte basic setup you need something to get the datatypes etc. over then you could look at Courier or uSync (disclaimer: i wrote that!) which even had a Chauffeur deliverable so you can in theory run that stuff on the command line to.

  • Wouter van Vugt @ PGGM 5 posts 106 karma points
    Sep 29, 2016 @ 09:05
    Wouter van Vugt @ PGGM
    0

    Hi Kevin,

    first of all thank you for your reply. I just reviewed the code of Chauffeur and it is doing sort of the same thing I have tried. There are quite a few extra steps that you have to know about (from checking the source code install steps) and replicate. One thing that is already bothersome with the approach is that if you try and do anything extra beyond provisioning the database, you have to set up an ApplicationContext, for which you have to mimic an HTTP Application in a console app. The code below does exactly this and looks similar to some of the calls in Chauffeur.

    The main issue with all of this is that it is unsupportable given the fact that you cannot be sure whether you are doing all steps necessary. Of course you might end up in a working scenario, but any new version of Umbraco is going to mess this up. We have no desire to keep on looking at the source code to mimic installations, but would rather see that Umbraco itself provides a stable and supported approach to scripting environments. My guess is that it doesn't and will not.

    Thanks for the link!

    Regards, Wouter

    var application = new TestUmbracoApplication();
    application.Start();
    var ctx = ApplicationContext.Current;
    DatabaseSchemaHelper helper = new DatabaseSchemaHelper(
        ctx.DatabaseContext.Database,
        ctx.ProfilingLogger.Logger,
        ctx.DatabaseContext.SqlSyntax);
    helper.CreateDatabaseSchema(ApplicationContext.Current);
    
    IUser userById = ctx.Services.UserService.GetUserById(0);
    MembershipUser adminMember = MembershipProviderExtensions.GetUsersMembershipProvider().GetUser(0, true);
    
    adminMember.ChangePassword("default", args[1]);
    DistributedCache.Instance.RefreshAll(DistributedCache.PageCacheRefresherGuid);
    
  • Kevin Jump 2312 posts 14698 karma points MVP 7x c-trib
    Sep 29, 2016 @ 09:23
    Kevin Jump
    0

    Hi

    I know! but i actually think this is something that the core team are looking at - there have been several changes in recent versions of umbraco to remove the dependency on the HttpContext from several places, and making the whole BootLoader stuff a lot simpler.

    I think (from talks i've seen and people i've spoken to) that the core team are working towards this more, and things like Umbraco Deploy (which will be the successor to Courier) is going to make this type of thing simpler. hopefully

  • Wouter van Vugt @ PGGM 5 posts 106 karma points
    Sep 29, 2016 @ 09:28
    Wouter van Vugt @ PGGM
    100

    For now I have solved it I think. Use nuget.exe to set up a new deployment of Umbraco, and then use an HTTP request to the http://

    Thanks!

Please Sign in or register to post replies

Write your reply to:

Draft