9f05d62338
Use HCP Consul and HCP Vault for the Consul and Vault clusters used in E2E testing. This has the following benefits: * Without the need to support mTLS bootstrapping for Consul and Vault, we can simplify the mTLS configuration by leaning on Terraform instead of janky bash shell scripting. * Vault bootstrapping is no longer required, so we can eliminate even more janky shell scripting * Our E2E exercises HCP, which is important to us as an organization * With the reduction in configurability, we can simplify the Terraform configuration and drop the complicated `provision.sh`/`provision.ps1` scripts we were using previously. We can template Nomad configuration files and upload them with the `file` provisioner. * Packer builds for Linux and Windows become much simpler. tl;dr way less janky shell scripting!
47 lines
1.3 KiB
PowerShell
Executable file
47 lines
1.3 KiB
PowerShell
Executable file
Set-StrictMode -Version latest
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
# Force TLS1.2
|
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
|
|
|
Set-Location C:\opt
|
|
|
|
Try {
|
|
$releases = "https://releases.hashicorp.com"
|
|
$version = "1.2.6"
|
|
$url = "${releases}/nomad/${version}/nomad_${version}_windows_amd64.zip"
|
|
|
|
New-Item -ItemType Directory -Force -Path C:\opt\nomad
|
|
New-Item -ItemType Directory -Force -Path C:\etc\nomad.d
|
|
|
|
# TODO: check sha!
|
|
Write-Output "Downloading Nomad from: $url"
|
|
Invoke-WebRequest -Uri $url -Outfile nomad.zip -ErrorAction Stop
|
|
Expand-Archive .\nomad.zip .\ -ErrorAction Stop
|
|
Move-Item nomad.exe C:\opt\nomad.exe -Force -ErrorAction Stop
|
|
C:\opt\nomad.exe version
|
|
rm nomad.zip
|
|
|
|
New-NetFirewallRule `
|
|
-DisplayName 'Nomad HTTP Inbound' `
|
|
-Profile @('Public', 'Domain', 'Private') `
|
|
-Direction Inbound `
|
|
-Action Allow `
|
|
-Protocol TCP `
|
|
-LocalPort @('4646')
|
|
|
|
New-Service `
|
|
-Name "Nomad" `
|
|
-BinaryPathName "C:\opt\nomad.exe agent -config C:\etc\nomad.d" `
|
|
-StartupType "Automatic" `
|
|
-ErrorAction Ignore
|
|
|
|
} Catch {
|
|
Write-Output "Failed to install Nomad."
|
|
Write-Output $_
|
|
$host.SetShouldExit(-1)
|
|
throw
|
|
}
|
|
|
|
Write-Output "Installed Nomad."
|