Creating a windows service only if new, allowing service configuration to remain

Hi Team,

I have a similar question to a previous unsolved one, but with a proposed solution that would require new functionality by the Octopus team.

We have a requirement to optionally run our service in a local user account, in order for our application to have access to the local users files.
When using our own installer we solved this problem by not reinstalling a service if it was already there,
but now we would like to reproduce this solution with octopus deploy

The installer naturally doesn’t have access to the local users password, so what we did for a brand new install is just install as a local service .
But if the user requires local file access, they can manually (or through our application) change the service to run as the local user.

If somehow, the octopus service deployment can reuse the existing service setup, any updates would not require the users password.

I notice that octopus deploy installs the service every release to use the executable in a new release directory.

perhaps if symbolic links were used such that the service path could remain constant the service could then be restarted rather than recreated leaving any configuration unchanged

This would be a very good feature for octopus deploy to be able to do, allowing service configuration to optionally be sticky (if needed)

If this is not practical, i think we will have to somehow do the service setup by our application.
I will attempt to do the symbolic link approach and manually install/update the service

Thanks for your help!

Hi @anthony.cole,

Thanks for getting in touch! I don’t think this is something that we have any plans to change. We are fairly opinionated about how we treat deployments and having Octopus as the source of truth is a fairly big part of that opinion. However, that’s not to say you don’t have options here.

Our built-in step as you have seen does a reinstall of the service during each deployment. Whilst we don’t have an option to change this from the step, I am able to provide you with the code that Octopus is running during the installation of the service, as it is all available open source on GitHub.

The idea we had was that you could use a package deployment step with custom scripts enabled, then use the code I linked to as a template to install the service. You can add your own custom logic or edit it how you like from there.

Sorry we don’t have a great built-in option for you here but hopefully the above option allows you to configure this to better suite your needs.

Let me know how you go with this or if you have any further questions or thoughts.

Best regards,

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.