Octopus Deploy overriding Topshelf-specified Account Information

In your docs it says that Octopus has no problem deploying Topshelf Windows Services.
However, it seems to be overriding the user account the service runs under. In my code, I specified “local service” but Octopus is specifying “Local system” and its deployed as under the “local system” account.
There also seems to be no way to not specify an account in Octopus when deploying windows services.

There are other problems I am having starting the service but I have no idea yet where the cause lies.
Attached is my output log if it helps.

ServerTasks-3834.log.txt (8 KB)

Hi Mark

Assuming you’ve selected the windows service feature, you should have a drop down that allows you to specify local service or a custom account for your service. The dropdown will be under the “Windows Service : Startup” section.

As for it starting, have you made sure the service name in your Octopus Config matches the service name in your Topshelf code ? That would definitely stop it from starting if they don’t match.

Regards

Damian

Hi, Damian. So if I select “Custom account” and leave it blank, it should not override my topshelf settings?

As for it not starting, that is not Octopus related. It is a mess relating to me trying to be cool and bootstrap a generic host (like Nservicebus.Host does) and failing spectacularly.

Hi Mark

No I don’t think that will work (although you’re welcome to try) because we’ll try to bind a blank username and password to it.

You wanted local service though didn’t you ? That’s an option for you in Octopus.

My take on this is that the code shouldn’t be the source of truth as to what account it runs under, that’s more of an operations / infrastructure decision and so Octopus is a good place to specify it.

Your other option if you want to do something much more custom though, is ignore the “windows service” feature and write your own post deploy powershell where you can install and start the service any way you like.

Does that help ?

Damian

Yes, that makes sense. Thank you!

I see it seems you guys don’t just override the credentials but also the Service name , Display name and Description.
I don’t have a problem with this except I was mislead by your documentation where it says “This means that deploying a Topshelf enabled application as a Windows Service is easy using the Octopus service deploy feature. The only caveat is the value you specify in the Service Name parameter must match the Service Name specified in your Topshelf configuration code (in Program.cs) or the service will not start”

Yet I would consider the fact that you override the Service Name, Display Name, Credentials, and Description caveats also.