How do roles work with deployment targets (servers)?

(Bob Walker) #1

When you create a deployment target in Octopus Deploy it has to be assigned to at least one role. What does a “role” mean? How do they work in Octopus Deploy?

(Bob Walker) #2

You need to be able to tell Octopus Deploy where to deploy code. However, you cannot use machine name, as that will (most likely) be different for each environment. Roles allow you to define the server you want to deploy. In this image below, the deployment will occur on any server with the role OctoFx-Web.

When a deployment occurs Octopus will find all the servers with that role in that specific environment. In this case, when I deploy to Dev it will find two servers.

The role name itself is very important. If at all possible, do not use generic role names such as IIS-Server or App-Server in your deployment process. We recommend [App]-[Component] such as OctoFx-Web and OctoFx-RateService. This will give you more control and flexibility. If your process is deploying to IIS-Server and you want to have a separate server for that specific app then you’d have create a unique role and then go into the deployment process and update it.

A deployment target can be assigned to 1 to N roles.

However, don’t include the environment name in the role, such as OctoFx-Web-Prod. That will lead to unnecessary steps added into your process and more maintenance than necessary.

(jsidoti) #3

In your scenario you have 2 servers in the Development environment, both having the OctoFX-Web Role.

Can you elaborate a bit as to how you would be able to have one Tenant deploy to d-octofx-web-01 while another Tenant would deploy to d-octofx-web-02?

When looking at ‘Preview and customize’ just before deployment, it shows me all the deployment targets that fit the Role targeted by the deployment step, even though the Tenant I’ve chosen to deploy to is only associated with one of the two available deployment targets with that Role in the Environment.