Skip to content

Instantly share code, notes, and snippets.

@hnrkndrssn
Last active August 7, 2017 04:19
Show Gist options
  • Select an option

  • Save hnrkndrssn/b0c3152cda9de3bb0f96 to your computer and use it in GitHub Desktop.

Select an option

Save hnrkndrssn/b0c3152cda9de3bb0f96 to your computer and use it in GitHub Desktop.

Revisions

  1. hnrkndrssn revised this gist Jan 10, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Step2AddNewPollingTentacleToOctopusServer.ps1
    Original file line number Diff line number Diff line change
    @@ -28,7 +28,7 @@ Write-Host "Add this value to the 'Tentacle.Communication.TrustedOctopusServers'
    $server = [ordered]@{
    "Thumbprint" = ""; # Your Octopus Server Thumbprint
    "CommunicationStyle" = 2;
    "Address" = "http://octopus.url:10943"; # Your Octopus Server URL and Communications port (10943 by default)
    "Address" = "https://octopus.url:10943"; # Your Octopus Server URL and Communications port (10943 by default)
    "Squid" = "";
    "SubscriptionId" = $tentacleEndpoint.Uri;
    }
  2. hnrkndrssn created this gist Jan 10, 2016.
    8 changes: 8 additions & 0 deletions Step1CreateNewPollingTentacle.ps1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    # Step 1 - Run this on the Tentacle server to create the new Tentacle
    $tentacleName = 'P1'
    $tentaclePort = 10933
    & "C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" create-instance --instance $tentacleName --config "C:\Octopus\$tentacleName\Tentacle-$tentacleName.config"
    & "C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" new-certificate --instance $tentacleName --if-blank
    & "C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" configure --instance $tentacleName --reset-trust
    & "C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" configure --instance $tentacleName --home "C:\Octopus\$tentacleName" --app "C:\Octopus\Applications\$tentacleName" --port $tentaclePort --noListen "True"
    & "C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" service --instance $tentacleName --install --start
    35 changes: 35 additions & 0 deletions Step2AddNewPollingTentacleToOctopusServer.ps1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    # Step 2 - Run this on your Octopus Server
    Add-Type -Path 'C:\Program Files\Octopus Deploy\Tentacle\Octopus.Client.dll'

    $apikey = 'API-XXXXXXXXXXXXXXXXXXXXXXXXX' # Get this from your profile
    $octopusURI = 'http://octopus.url' # Your Octopus Server address

    $tentacleThumbprint = "" # Your Tentacle thumbprint
    $environmentId = "Environments-1" # Get this from /api/environments
    $role = "tentacle-role" # The role of the machine
    $machineName = "YourTentacleName" # The name of the machine

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

    $tentacleEndpoint = New-Object Octopus.Client.Model.Endpoints.PollingTentacleEndpointResource
    $tentacleEndpoint.Thumbprint = $tentacleThumbprint
    $tentacleEndpoint.Uri = "poll://" + (([char[]]([char]'A'..[char]'Z') | sort {get-random})[0..20] -Join '') + "/"

    $tentacle = New-Object Octopus.Client.Model.MachineResource
    $tentacle.Endpoint = $tentacleEndpoint
    $tentacle.EnvironmentIds.Add($environmentId)
    $tentacle.Roles.Add($role)
    $tentacle.Name = $machineName

    $repository.Machines.Create($tentacle)

    Write-Host "Add this value to the 'Tentacle.Communication.TrustedOctopusServers' key in Tentacle-${machineName}.config"
    $server = [ordered]@{
    "Thumbprint" = ""; # Your Octopus Server Thumbprint
    "CommunicationStyle" = 2;
    "Address" = "http://octopus.url:10943"; # Your Octopus Server URL and Communications port (10943 by default)
    "Squid" = "";
    "SubscriptionId" = $tentacleEndpoint.Uri;
    }
    $server | ConvertTo-Json -Compress
    4 changes: 4 additions & 0 deletions Step3AddOctopusServerToListOfTrustedServer.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    - Open the Tentacle configuration file of your new Tentacle (specified when you registered the Tentacle in step 1)
    - Add the JSON output by step 2 above to the Tentacle.Communication.TrustedOctopusServers (within the [])
    - Save the config file
    - Restart the Tentacle service
    1 change: 1 addition & 0 deletions Step4HealthCheckEnvironmentWithNewPollingTentacle.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    - Perform a health check and if everything is right, the new polling Tentacle should report back successfully.