Deploying web frontend, service backend and SQL Server to VM via DSC?

I’ve got a new project in VS and I’m trying to “do the right thing” by deploying a web client, a web service and a database backend to a VM using DSC. I’m new to DSC, but my understanding is that I want to have DSC resources, i.e. a VM, an IIS instance, a SQL Server instance, and then make sure the latest version of my frontend, my backend and my database schema are all deployed. This seems like almost the smallest sample of what I’d actually want to do with DSC, but I’ll be damned if I can find anything even close to an end-to-end sample. Pointers? Thanks!

So, start with “The DSC Book,” one of our free ebooks (Resources menu).

And yes, each machine to which you will deploy a DSC configuration will need to have the appropriate resources to implement that config, but those can be deployed via a Pull server, or manually. “a VM” and “an IIS instance” is not a DSC resource; a DSC resource is a specific hunk of code that might create a VM or set up an IIS instance.

And check out the DSC Resource Kit with the experimental modules.

I think most of the experimental DSC resource modules come with end-to-end examples like xWebAdministration.

@Don, I have your book open in front of me. I heard Steven Murawski’s DNR interview and was inspired. I’m finding the book great on general principles and light on managing instances of specific resources.

However, isn’t a resource something that should exist and I’m just describing the properties I need so that the DSC manager can make the necessary changes, like creating a VM or installing IIS? Or do I have the mental model wrong?

@Dan, I’m working my way through the experimental resources, but each one of them is a whole new world. So far, no real end-to-end examples, e.g. deploying a database, deploying a web service, setting the web config settings of the service to point at the database, deploying the web client, etc.

Resources are PowerShell modules. They’re just special scripts.

A configuration defines settings. Those settings (e.g., web site name, port number, etc) are given to the resource. The resource checks them to make sure they’re correct, optionally fixing them if they’re not.

But resources have to come from someplace. Very few are “born” with PowerShell v4; most are add-ons. Therefore, part of your task is to get the resources onto the machine(s) where they will be needed, either manually (push) or automatically (pull). They do not “just should exist.” I think you have the mental model correct, unless you’re assuming that resources are just a native part of the universe. They are not.

I would not expect real-world, end-to-end examples. You’re working with a new technology that has not yet seen significant use. Further, everyone’s using it a bit differently. You’re going to have to experiment, and discover as you go. DSC isn’t a big copy-and-paste operation. It would be nice if you could share your example once you’ve worked it out, to benefit others like yourself in the future. Thus far, not many people have chosen to do so, or been perhaps have not been able to. I agree that such end-to-end examples would make things easier. Regardless, they for the most part do not exist, except for a few limited scenarios.

BTW, the reason the book is light on managing specific resources is that Microsoft has been releasing new batches of resources every few weeks, and those of us working on the book have these annoying jobs that keep us from working on the book full-time - which is what it would take to keep up. Even Microsoft’s own doc teams aren’t abel to keep up. So, once you come up with a good example, it’d be really super of you to contribute it to the book!

DSC depends on you having a strong existing PowerShell background. It’s fairly sensible if you do, and the resources tend to follow consistent patterns. If you don’t have strong PowerShell experience, DSC is impenetrable and likely will remain so for some time.

Thanks, Don. If I do make it work, I’ll certainly blog it and reformat it for your book if you like. And I don’t have a solid PS background, but such a thing has got to start somewhere. : )

In the meantime, I’m frustrated with the lack of Windows versions of tools like Puppet and Chef (both of which are very Linux-centric). DSC is the closest I’ve seen, but am happy to hear about alternatives.

Be a bit careful… that’s not an apples-to-apples comparison; it’s apples-to-apple pie.

DSC is apples. It’s a platform technology - it’s meant to accomplish a specific goal.

Chef and Puppet are apple pie. They CONTAIN a similar platform technology, but also provide the warm, flakey crust of management tools atop that platform. DSC lacks tooling at this stage, which can make it more challenging. But, unlike the apples in Chef and Puppet, DSC comes natively with Windows, now.

Chef can, in fact, provide tooling atop DSC - leveraging DSC where it’s appropriate, and its own apples where not. Steve Murawski actually works for Chef now, which should tell you how serious they are about that direction. Puppet has so far decided to stick with their own pie filling, so it doesn’t provide a good companion to DSC, but they’ve done a lot of their own work producing modules that provide specific configuration capabilities.

Microsoft will eventually, I imagine, provide some of the warm, flakey tooling you’re yearning for. Keep in mind that DSC isn’t even a year old, yet, and they needed to pick the apples before they could bake the whole pie.