Automating Octopus Installation

Last updated

Octopus Installers

Octopus comes in a MSI that can be deployed via group policy or other means.

The latest Octopus MSI can always be downloaded from the Octopus Deploy downloads page.

Permalinks to always get the latest MSIs are:

Automating the installation of Octopus Server is a three step process.

1. Install MSI on a Temporary Machine Interactively

In this step we install the MSI on a machine interactively so that we can complete the wizard to add a new instance.

Follow all the steps in the installation process, but in the final step copy the generated script into a new file. Do not click Install.

Save the script into a new file.

Here is an example of what the script may look like:

"[INSTALLLOCATION]\Octopus.Server.exe" create-instance --instance "<instance name>" --config "<new instance config path>"
"[INSTALLLOCATION]\Octopus.Server.exe" database --instance "<instance name>" --connectionString "<database connection string>" --create
"[INSTALLLOCATION]\Octopus.Server.exe" configure --instance "<instance name>" --upgradeCheck "True" --upgradeCheckWithStatistics "True" --usernamePasswordIsEnabled "True" --webForceSSL "False" --webListenPrefixes "<url to expose>" --commsListenPort "10943" --serverNodeName "<machine name>"
"[INSTALLLOCATION]\Octopus.Server.exe" service --instance "<instance name>" --stop
"[INSTALLLOCATION]\Octopus.Server.exe" admin --instance "<instance name>" --username "<admin username>" --email "<admin email>" --password "<admin password>"
"[INSTALLLOCATION]\Octopus.Server.exe" license --instance "<instance name>" --licenseBase64 "<a very long license string>"
"[INSTALLLOCATION]\Octopus.Server.exe" service --instance "<instance name>" --install --reconfigure --start --dependOn "MSSQLSERVER"

2. Install MSI in Server Silently

To install the MSI silently:

msiexec /i Octopus.<version>.msi /quiet RUNMANAGERONEXIT=no

By default, the Octopus files are installed underĀ %programfiles%. To change the installation directory, you can specify:

msiexec /i Octopus.<version>.msi /quiet RUNMANAGERONEXIT=no INSTALLLOCATION="<install path>"

3. Configuration

The MSI installer simply extracts files and adds some shortcuts and event log sources. The actual configuration of Octopus Server is done later, via the script you saved above.

To run the script start an admin shell prompt and execute the script, this should apply all the settings to the new instance.

Desired State Configuration

Octopus can also be installed via Desired State Configuration (DSC). Using the module from theĀ OctopusDSC GitHub repository.

The following PowerShell script will install a Octopus server listening on port 80:

Configuration SampleConfig
    Import-DscResource -Module OctopusDSC

    Node "localhost"
        cOctopusServer OctopusServer
            Ensure = "Present"
            State = "Started"

            # Server instance name. Leave it as 'OctopusServer' unless you have more than one instance
            Name = "OctopusServer"

            # The url that Octopus will listen on
            WebListenPrefix = "http://localhost:80"

            SqlDbConnectionString = "Server=(local)\SQLEXPRESS;Database=Octopus;Trusted_Connection=True;"

            # The admin user to create
            OctopusAdminUsername = "admin"
            OctopusAdminPassword = "<my secret password>"

            # optional parameters
            AllowUpgradeCheck = $true
            AllowCollectionOfAnonymousUsageStatistics = $true
            ForceSSL = $false
            ListenPort = 10943
            DownloadUrl = ""

# Execute the configuration above to create a mof file

# Run the configuration
Start-DscConfiguration -Path ".\SampleConfig" -Verbose -wait

# Test the configuration ran successfully

DSC can be applied in various ways, such as Group Policy, a DSC Pull Server, Azure Automation, or even via configuration management tools such as Chef or Puppet. A good resource to learn more about DSC is the Microsoft Virtual Academy training course.