Have been struggling to get Octopus to deploy a website to a sub-domain. Standard deploy as a stand-alone site on the same server works fine. So I have one project which deploys to the main site “CrewApp” and then I need to install another project as a sub-site so that we can use single sign-on form cookies this needs to be “CrewApp/ClassicWeb”
Sending and extracting the packages to a custom folder works fine. The only thing which I cannot get to work is to add the the application as a sub-site of CrewApp (if it does not yet exist)
Have tried the following approaches but all failed.
With “IIS web site and application pool” feature (like CrewApp) but that does not support installing as a sub-folder (tells me that I should use home directory feature the moment I enter a / character)
With “IIS6+ home directory” feature, but this does not work either
Tried with separate powershell template “IIS Virtual Directory - Create”, but that fails if the folder already exists (because of earlier deploy). So on second deploy this goes haywire. Do not seem to be able to do a conditional deploy step? Have tried it before and after the other nuget step but if any step fails the whole deployment fails it seems.
I’m a total newby to powershell scripting so was enjoying Octopus very much. However, how come that an apparently simple change (in IIS setup at least) causes so much trouble? Now I need to keep the initioal IIS setup for this subsite a manual step which does feel wrong.
Thanks for getting in touch. You’re right, this is a scenario some Customers use and it is supported by Octopus using a combination of the IIS web site and application pool, the IIS Virtual Directory - Create Script Template you mentioned, and IIS6+ home directory in separate steps.
From reading through your log files I think this combination failed because of the state the previous failure (and any manual changes to IIS) left the Tentacle machine in.
From the log file that I think should have worked ServerTasks-2694.log, I can see for Wingman The package has already been installed on this machine, so installation will be skipped.
And then for CrewApp The application or virtual directory 'CrewApp' does not exist
My recommendation would be to get the target IIS Server back into a known state and try again.
Ah I’ve come one step further. The issue seems to be that the create virtual directory creates an IIS virtual directory (i.e. a logical link) whereas I need it to be an IIS application. If I clrear the classicweb folder before deploying then the deploy succeeds but the website does not run. This is logical since a virtual directory is not using its own bin folder and global asax. However, after I turn the virtual directory into an application then consecutive deploys fail because the create VD task fails to notice that the application folder is already there with the right name.
So it now seems that I should use the task “IIS Create Application” instead of “IIS Create Virtual Directory”
Sounds like you’re on the right track. If CrewApp is an application, then yes, you need to create it as an IIS Application. Taking a sweeping guess at the specifics of your situation it sounds like you should be able to do something like:
IIS Web Site and Application Pool for the parent site
IIS Create Application for the sub-application
IIS6+ Home Directory to deploy the sub-application package