Author Archives: Jason

.NET Deployment Strategies: The good, the bad, and the ugly

Damian Brady did this excellent talk at NDC London a while ago. It’s a bloody excellent talk in general, and it obliquely mentions some little classifieds company from Sydney who do some things with Continuous Deployment and Teh Cloud and stuff. I thoroughly recommend this. All of it.

.NET Deployment Strategies: the Good, the Bad, and the Ugly – Damian Brady from NDC Conferences on Vimeo.

Introducing xScheduledTaskDSC

So I was hunting round on the web the other day, trying to find a DSC resource which can create and manage Scheduled Tasks on Windows Server 2012. Unfortunately, my searching came up blank. There seemed to be no way of easily managing Scheduled Tasks and Jobs using Desired State Configuration.

So I wrote one.

ScheduledTaskDSC is a public project on GitHub. At the moment, it contains one resource, xScheduledTaskDSC, which can create simple Task Scheduler items, detect and correct configuration drift* and remove unwanted tasks.

At the moment, it’s just good enough for my use case (which is creating simple tasks on transient cloud instances via Octopus Deploy), but I want to expand it significantly to support more scenarios, and maybe add resources for Actions and Triggers, allowing for more complex task creation and management, as well as finishing off some Pester tests on it. But that’s for the future.

For now, feel free to take a look, have a play around with it, suggest or write improvements and send me pull requests. All PRs are considered. Have at it, kids.

 

* drift correction is limited at the time of writing. It detects a subset of drift, and will simply kill broken tasks and recreate them with correct parameters. I’m currently working on more subtle drift correction.

Note: 7 Feb 2016: Carbon includes a Scheduled Task DSC resource, however you need to pass in a chunk of XML. I have been a bit vocal about XML in the past, but Carbon may well do the job for you if you have an XML chunk from, say, schtasks.exe. 

Chickens not Cattle and definitely not Pets. Or maybe Bees

A few weeks ago I was ruminating on Twitter about the “Cattle not Pets” metaphor for Cloud instances.

I started a vague blog draft on the topic, got a little sidetracked and never fully completed the thought. But it’s something that’s itched at me for some time now. Cattle do in fact get fairly individualised treatment, except on the largest of scales. So they’re not a great metaphor. But I didn’t really have a perfect replacement So when I wandered into the office this morning and checked Twitter, I was gratified to see that Jeffrey Snover had tweeted out an article ruminating on basically the same topic, and which did a lot of the agricultural thinking for me.

Continue reading →

Stop Thinking About Servers

Every so often I get a request, from one or more of our developers, for Remote Desktop access to the servers running their code – be it for troubleshooting, configuration or some other arcane purpose.

My answer is almost uniformly “no”.

WAT

“But surely,” says the cat “you’re a super-futuristic DevOps shop spoken of in breathless terms by national IT publications? Don’t you trust your developers??”

Of course we do. But…

Continue reading →

Blog Update 12/11/15

Sorry I haven’t been posting a lot lately. I’ve been moving house – well, moving two houses – and things have been rather hectic. Hopefully I’ll be properly set up soon and can get on to regular content creation, including some screencast material.

Upcoming talks from Me:

Sydney DevOps Meetup Nov 19th 2015What DevOps Means To Domain. Well, it’s what DevOps means at Domain as well as what DevOps means to Domain. I’ll run through how we Define the DevOps Ethos and some of the results we’ve produced.

This is a short-form talk and will be kind-of ad-hoc, with an Ask-Me-Anything at the end

PowerShell Australia Meetup 26th Nov 2015Unit Testing PowerShell with Pester. A rapid introduction to using Pester to automagically test your PowerShell code, and why you should be doing this, NOW.

This one will be accompanied by Ben Hodge talking about DSC, Kirk Brady telling us why we should be using git and how to do that, and then me blathering about Pester for probably far too long once everyone is tired. Beer and Pizza are, I believe, sponsored.

 

My favourite Cmdlet of the moment: Get-IAMAccountAlias

In common with many AWS Users at large organisations, I work across a number of AWS Accounts. We silo our “sandbox” experimental environments from our gold production environment by putting them in different accounts. We silo different parts of the business into separate accounts. I also have my own personal account registered in Powershell using AWS Stored Credentials, and we just opened two new accounts for a new business unit we’re about to onboard and migrate.

So I have a lot of accounts to work with. So it can be useful to know which one you’re authenticating to at any given time. And that’s why my favourite Cmdlet this week is

Get-IAMAccountAlias

All our accounts have easy to remember aliases, and I use them when I store credentials using Set-AWSCredentials. If I happen to forget which powershell session is running against what acccount, I just hit up Get-IAMAccountAlias, and doubt is dispelled (and, occasionally, I save myself from provisioning or deleting resources in the wrong account).

If you have multiple AWS accounts, you need to know about this one.

Reliable File Downloads with BITS

Every so often, one of my favourite cycle training video vendors releases a new video or two. These videos are generally multi-gigabyte files and downloading them through a browser, especially over a possibly-flaky wireless network, can be an exercise in frustration. Browser crashes happen, network blips happen, sometimes you even exit the browser session without thinking and terminate a nearly-complete download. That’s why I generally use BITS to download them, in PowerShell. How? Pretty simple, really. Just use the Start-BITSTransfer cmdlet, specifying source and destination, and you’re away.

Start-BITSTransfer http://www.myawesomevideosite.com/files/somebigfile $home\Downloads\somebigfile.zip

Running that will start your download, fire up a progress bar and some time later, you’ll have a usable file in your downloads folder. Of course, doing it this way will take over your PowerShell session for the duration of the download. Which is rubbish. Who wants to clutter up their desktop session with PowerShell windows? That’s why I do it asyncronously

Start-BITSTransfer -source http://www.myawesomevideosite.com/files/somebigfile -destination $home\Downloads\somebigfile.zip -asyncronous

Which is great. I can carry on using my PowerShell session in the foreground, or even close it, without interrupting the download process. I can even fire up another download next to the first one and just let them run in the background.

But how do I check on how the download is going?

I can use Get-BITSTransfer in any PowerShell session, and the BITS service will report the status of any currently running BITS jobs, like so

C:\> Get-BitsTransfer | Format-List

JobId               : d3c1a9a0-68f0-4831-939b-95ab0122476c
DisplayName         : BITS Transfer
TransferType        : Download
JobState            : Transferring
OwnerAccount        : DOMAIN\jason.brown
Priority            : Foreground
TransferPolicy      : Always
FilesTransferred    : 0
FilesTotal          : 1
BytesTransferred    : 208207360
BytesTotal          : 2430734370
CreationTime        : 27/10/2015 12:56:17 PM
ModificationTime    : 27/10/2015 1:09:08 PM
MinimumRetryDelay   :
NoProgressTimeout   :
TransientErrorCount : 1
ProxyUsage          : SystemDefault
ProxyList           :
ProxyBypassList     :

JobId               : 1d0a4b78-7b9c-4977-9b32-b962c754e8f6
DisplayName         : BITS Transfer
TransferType        : Download
JobState            : Transferring
OwnerAccount        : DOMAIN\jason.brown
Priority            : Foreground
TransferPolicy      : Always
FilesTransferred    : 0
FilesTotal          : 1
BytesTransferred    : 15883778
BytesTotal          : 2394848910
CreationTime        : 27/10/2015 1:08:02 PM
ModificationTime    : 27/10/2015 1:09:08 PM
MinimumRetryDelay   :
NoProgressTimeout   :
TransientErrorCount : 1
ProxyUsage          : SystemDefault
ProxyList           :
ProxyBypassList     :

You could even pick out the BytesTransferred and BytesTotal properties and do some quick math on them to see the percentage of download complete. There’s a whole load of stuff you can do with BITS to make your downloads complete more reliably.

Once you see your downloads are done, use the Complete-BitsTransfer cmdlet to save the file from its temporary location to your target.

Get-BitsTransfer | Complete-BitsTransfer

I’d recommend checking out the Get-Help and Get-Command output for these cmdlets to find out more if you want to get more advanced, or I might do a future blog post with some more advanced stuff like changing priorities, or downloading a list of files from a CSV or database. You can even use this system to do reliable uploads. It’s really a very handy set of cmdlets.

 

Rightsizing Your AWS Cloud Infrastructure: A Rumination

I am currently engaged in a mid-to-long-term project to rightsize the Cloud infrastructure at work. During our rapid change phase, shifting from a co-located infrastructure to public cloud, our primary priority was to get things done and minimise disruption while shifting services into the cloud quickly. Consider the things that cloud infrastructure should be

  • Cheap
  • Fast
  • Scalable
  • Resilient
  • Reliable*

During our migration phase, we weren’t too bothered about cheap. We wanted everything else, but the price ticket was… flexible, within limits. Now, some months later, we’re considering a number of our core services to be stable and mature, and therefore they’re prime candidates for aggressive cost optimisation. Cost optimisation in this case can imply a few different actions. Continue reading →

October 19th Blog Update

I’ve put out some more Pester content, this time over at the Domain Tech Blog, on how we continuously test our PowerShell code using Pester and OctopusDeploy.

If you’re reading this blog post, then obviously you know that the Domain Name has changed. Formerly on devops.fixt.co, we’re now on d.evops.co – which is a cooler name, if anything.

The Sydney PowerShell User Group is having our first meeting, at Domain’s Office, 55 Pyrmont Street, in late November. RSVP via Meetup.com. I’ll be talking about Pester, m’colleague Kirk will likely be talking about git and why ops guys need it, and Ben Hodge will be talking about DSC.

I’ll be speaking on Domain’s experiences with DevOps at the Sydney DevOps meetup. TBC, but I think November

I’m currently moving house, so my tweets and posts might be a bit sporadic. Of course, when aren’t they? More will follow once I have a little downtime.

 

Devops.fixt.co is MOVING

This blog is moving, imminently. Yes, Short notice, but that’s how the Devops world works. We move fast and we’re not afraid to break shit.

From now on, this blog will be on http://d.evops.co/

If you subscribe to this blog, update your feed reader. The new owners of fixt.co have kindly agreed to put in a redirect for a while, so existing links should get here, but that may not last for ever. Do look out for these guys, they’re doing innovative things in their space.