A few questions on package deployment

Hi. I’m currently evaluating whether or not Octopus is going to meet our needs and have got a few questions before I really get stuck into playing with it and recommending we get the multiple-project version when you’re out of beta.

I’ve been over the conversations here, and all the online documentation, but it still feels like I’m missing a lot, so apologies if this is all answered somewhere else (or if the questions are just generally stupid!).

  1. Is it possible to specify that a package gets installed to a particular folder? Is there a variable I’m meant to be setting that gives it a path to put the packaged files into? Depending on the environment I’m installing to I really need to stick the files in particular folders for particular customers.

  2. The trial package contains a number of dlls and an exe, which I’d like to install as a windows service.

By default Octopus is running InstallUtil on the exe, but it fails because normally during our service installation we pop up a dialog asking for a name to install under etc. I can modify this installer behaviour (maybe to take command line parameters?!) but I’m not sure of the best way to do this and to then pass those parameters to the service installer. Any thoughts welcome.

The follow-up question there for after I’ve sorted that little issue, is what happens with upgrades of windows services? If I then do a new build of this project and deploy it to the same environment, does it uninstall the previous service, copy over the new one and then installutil the new one? Or does it replace the exe in-place without changing the installutil status? Or does it re-run installutil without uninstalling?

  1. I’d like to create a bunch of files from some templates (that I would include in my nuget package) and then stick them in a semi-complex directory structure with contents that depend on various things configured against the environment I’m deploying to.

Is the best way to do something like this to have all these files as templates in my package, and then use a powershell script to fill out those templates based on some variables I pass through to the powershell script? I’m a total powershell noob so have no idea if that is within its capabilities or not.

(I’m assuming here that Octopus is able to pass a whole load of variables to my powershell script, and that those variables are stored per-environment? In which case I figure I’d be able to write a powershell script that gets the job done.)

I think that’s it for now, though more will pop up as I go I’m sure. Any help gratefully appreciated!

Hi Neil,

Thanks for the questions,

  1. Not at the moment. Octopus was originally intended to be ‘opinionated’ and convention-based. I’m slowly changing that model, and it would certainly be possible to add support for changing the file path in a future release. I’ll add it to the backlog and think about the best way to support it for next sprint.

  2. I need to write some documentation about this, but in the Octopus UI, you can define a variable (e.g., MyUsername = Paul, MyPassword = Password01). Those variables will be passed to InstallUtil as parameters. Your Installer can then override Install() which takes a dictionary, and the parameters will be available for you to use (e.g., params[“MyPassword”]). You can then use the values to set properties on the installer class.

This MSDN page on InstallUtil helps:

http://msdn.microsoft.com/en-us/library/50614e95(v=VS.100).aspx

(See the example second from bottom with the /email parameter)

Octopus currently doesn’t perform an uninstall. Truth be told, I think using the PowerShell features of Octopus is a better way to approach this, and I will write some example scripts shortly showing how this should work.

  1. Yes, PowerShell would be the way to approach this, and it would certainly be capable of it. Your PowerShell scripts will get the variables defined in the Octopus UI, so you’ll be able to know which environment you are running in and any other settings you specify. A variable can be set on a per-environment or per-machine basis.

I hope that helps!

Paul

Thanks Paul! It seems Octopus can cope with all the complex stuff I was worried it would be a nightmare to figure out, but not the simple thing I assumed it did :wink:

As much as I personally don’t care which folder we stick things in, I know when I try to sell my boss on the idea of using Octopus he’ll say that not being able to choose an install path is a deal breaker.

I know you’ve got a lot of pressure on the backlog but any idea what kind of timescale it’d be before you can support that? I’m guessing we’re talking months rather than weeks?

Thanks very much for the quick replies!

Hi Niel,

Can I get back to you on the weekend with a time commitment for that? It’s not hard, it just needs a little UI work. I’ll be reprioritising my backlog this weekend so I can let you know.

Paul

Of course! That’s fantastic, thanks very much.

Just a quick clarification… you said earlier that “Your PowerShell scripts will get the variables defined in the Octopus UI, so you’ll be able to know which environment you are running in and any other settings you specify.”

Does Octopus automatically pass the environment to the powershell as a variable, or will I have to set those up for all my environments manually? It’d be nice to just automatically reference $OctopusParameters[“Environment”]. Similarly $OctopusParameters[“Machine”] would also come in very handy.

These two variables I see without having to configure them.

2011-09-28 21:24:33 DEBUG - [OctopusEnvironmentName] = 'Preview’
2011-09-28 21:24:33 DEBUG - [PackageRoot] = ‘C:\Octopus\Tentacle\Applications\MyPackage.2011.9.28.4903’

Thanks Nathan! Hadn’t spotted that till you pointed it out.