Executing deployment step in a different environment

Hi, is it possible to create a deployment process that can execute a step in an environment different than the one being deployed to?

For example, when I do my staging deployments I want a step to be ran on a production server.

Right now I do this by adding the production server to the staging environment and updating the role to differentiate it from the actual staging server of the same role. This happens prior to all staging deployments. This works but has resulted in issues with people forgetting to update the production deployment target. A better solution would be greatly appreciated, thanks!

Hi,

Thanks for getting in touch.

For example, when I do my staging deployments I want a step to be ran on a production server.

We think there’s some confusion going on here and we’ll attempt to clarify…

It may help to think about Deployment Targets, rather than physical servers, because that’s ultimately all that Octopus knows about. I.e. Octopus is deploying to a given Deployment Target that is scoped to a given environment/role.

A single server (a physical machine) can have multiple Deployment Targets installed on it, and those Deployment Targets can be registered with Octopus under different environment/role combinations to do the various things that you need.

In this case (to avoid confusion), you could install another Deployment Target on your production server and scope it to your staging environment (with the role that you need for this step). This helps you reason about your deployment process to your staging environment. E.g. Everything you need to deploy to a given environment should be isolated, so you have confidence that “when I deploy to environment X, it’s not going to cross boundaries and accidentally deploy to environment Y”.

Think of it this way: if you have work that needs to be deployed to your Staging environment, and part of that work just happens to live on a production server, then it’s not really a production-only server. It’s a server that serves multiple environments as part of your deployment process. So you can install multiple Deployment Targets on that server and let it serve those multiple environments accordingly. Then you won’t have to constantly modify the roles of your production target.

Hope this helps.

Cheers,
Mark

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