How can I deploy multiple projects to the same deployment targets?

how-to
(Mark Harrison) #1

I have two totally different, un-related ASP.NET web applications.

I’ve created these in Octopus as two separate Projects; WebsiteProject1 and WebsiteProject2.

I have one deployment target in each of my environments:

  • Development
  • Testing
  • Production

This applies to all of my projects in Octopus.

So for example in the Testing environment, I have a machine called TestingMachine which is dedicated to all my projects which are deployed to this environment.

TestingMachine will, therefore, host Testing releases of both WebsiteProject1 and WebsiteProject2.

I have been able to set up an Octopus tentacle for WebsiteProject1. What about WebsiteProject2?

How do I also set up Octopus to allow the WebsiteProject2 to be deployed to TestingMachine?

(Mark Harrison) #2

This can be achieved using target roles in Octopus.

Roles are a way of tagging your deployment targets with the types of software you will be deploying. This ensures that you deploy the right pieces of software to the right deployment targets.

So in the example above, we can add 2 target roles of webserver-project-1 and webserver-project-2 to the TestingMachine as seen here:

Then, you can add the appropriate webserver-project-1 role to the WebsiteProject1 deployment steps that you wish to be deployed to the role, as shown here:

You can then repeat the above steps for the target role webserver-project-2 in the appropriate deployment steps in WebsiteProject2 .

Generally, we find adding more specific target role names (over generic names such as web-server) to your deployment targets and deployment steps results in better deployments in the future and helps to avoid the chance of deploying the wrong software to a deployment target by mistake.

This will allow you to deploy different, un-related projects to the same deployment targets!