Hi Kenny
So basically we deploy out to servers behind a load balancer. We refer to the boxes serving the requests as a “loop” though I’ve heard the term rotation used, but we basically
- Take a box out the loop
- Deploy to it
- Run post-deploy tests on it
- Put the box back in the loop
Yesterday I was writing a “loop monitor dashboard” which saves us having to log in to a cumbersome massive load balancer UI. Basically to show us at a quick glance per-application which servers are in/out of the loop.
That bit was easy but then I wanted to enhance it with a “why”. If Octopus Deploy has taken a box out the loop to deploy to it, that’s a different thing than someone having manually taken it out (maybe because there’s a problem or they’re doing some specific maintenance/testing on it).
So yeah - for my loop monitor dashboard, if a box is out, I wanted to display a “Currenty deploying to this box” section.
I did do it though!
So what I did was to access the Deployments API with a filter of taskState=Executing
/api/deployments?taskState=Executing
I then followed the /Task URL for each deployment in progress appending /Details to it:
/api/tasks/ServerTasks-47406/details
In here it gives me the boxes it’s currently deploying to.
So I take that JSON and parse it out, finding only “Running” statuses and wrote all that out into my own custom API that gives me a JSON object like
{
“machineName”: “WEBSERVER123”,
“deployments”: [
{ “description”: “Deploying MY APP to TEST1” },
{ “timeStarted”: “2016-08-25T16:00:56” }
]
}
I then consume that in my dashboard and it’s all good. I can now show real-time deployments against each box out of the loop.
So it’s a bit intensive, having to make a request then following all the task links, but it works and the dashboard isn’t something that’s open all the time - just something we can load and look at when we need to.
Cheers
Ben