How to deploy current releases to the new added servers

Hi,

We’ve 2 web servers which are connected to physical Load Balancer. We created 2 new web servers and wanted to add them so we can migrate all websites. How could we redeploy currently deployed releases (on old servers) to a new server so we can keep the consistency? Is it and how possible to add them, something like “failover node” and just replicate deployments to them automatically?

Hi,

Thanks for getting in touch!

Looking at the the description you have provided it looks like our automatic deployment trigger feature is what you are looking for.

To give you a quick overview, what this will let you do is automatically deploy the latest release of a project to a given environment and/or role. So, for example, you can configure it to deploy the latest release of your Web Application to any server tagged web-server in environment Production. That way if you bring a server online in that role and environment we will automatically deploy the current version of your application that is released to production.

I hope that all makes sense and is what you are looking for, please let me know if I have missed something!

Regards,
Alex

Hi Alex,

Thank you for your reply. I’ll try to be simplimize this: So, as we want to decommission current web servers (they are on 2012) we create a new 2016 servers. Now, as we have more then 300 projects in Octopus, it will be long journey to go to each project and clicking “Redeploy” so we can bring them to a new server . What would be the best way to migrate them (latest deployments) to new servers?

Hi @bdjurkic,

Sorry for letting this fall through the cracks!

Hopefully you have successfully completed the migration by now, but if not I believe that automatic deployments is the best path forwards. What I would suggest is to configure an auto-deploy trigger for each project based on a role tag, then on the new 2016 server when you are configuring your Tentacle add the required tags which will trigger the latest successful deployment to be deployed to the new server.

I hope this all makes sense, please let me know if there is anything else I can assist with!

Regards,
Alex

Hey @Alex.Rolley,

Thanks for asking. I sorted this out with you guys. It’s not the best way but it’s doing a great job.
I paste a solution (already exists on your GitHub) so if someone else need the same or similar solution, this is quiet useful:

# Octopus Variables 
$apikey = '***' # Get from your profile
$octopusURI = 'http*****.com' # Your server address

# Get all projects  
$dashboard = .\Octo.exe list-projects --APIkey $apikey --server $octopusURL | Select-Object -Skip 6 
$projects = $dashboard.Substring(3) -replace "\(ID.*\)",'' #| Out-File projects.txt

# You can find this dll from your Octopus Server/Tentacle installation directory or from
# https://www.nuget.org/packages/Octopus.Client/
Add-Type -Path 'Octopus.Client.dll' 

$triggerEnvironment = "DEV" # Set this to whatever environment should auto deploy
$triggerRole = "Webservers-internal" # Set this to the deployment target role that should auto deploy

$endpoint = New-Object Octopus.Client.OctopusServerEndpoint $octopusURI,$apikey 
$repository = New-Object Octopus.Client.OctopusRepository $endpoint

$environment = $repository.Environments.FindByName($triggerEnvironment)

$triggerFilter = New-Object Octopus.Client.Model.Triggers.MachineFilterResource
$triggerFilter.EnvironmentIds.Add($environment.Id)
$triggerFilter.Roles.Add($triggerRole)
$triggerFilter.EventGroups.Add("MachineAvailableForDeployment")

$triggerAction = New-Object Octopus.Client.Model.Triggers.AutoDeployActionResource
$triggerAction.ShouldRedeployWhenMachineHasBeenDeployedTo = $false

$projects = $repository.Projects.GetAll()

foreach ($project in $projects) {
    $repository.ProjectTriggers.CreateOrModify($project, "Automatically deploy to $triggerRole", 
 $triggerFilter, $triggerAction)
 }

The thing, that is missing here and I couldn’t find a solution, is to deploy only on the projects which have target role “Webservers-internal” … As this code will add a trigger to all the projects in Octopus

Kind Regards,
Branko