Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows Installer Script - Add support for offline installs #4471

Merged
merged 4 commits into from
Mar 15, 2024

Conversation

bryan-splunk
Copy link
Contributor

Description: Added support for offline installs to the Windows Installer Script. Its common for windows servers in the DMZ to have outbound access blocked which prevents the current script from working. The current script does support an offline MSI but it does NOT support an offline .net auto instrumentation file. This change adds that capability.

Link to Splunk idea: There is no idea for this, but this is something we see in field sales all the time. Support tosses this issue back to the SAs/SEs so I lets just fix the root cause.

Testing: Ran the script multiple times with various options in my Home Lab using Win Server 2012R2 with powershell 5.1. I believe it needs more testing, but my home lab resources are limited. Hopefully the QA team can put it through the paces.

Documentation: Added Param documentation to the script file to support the Get-Help command. Other comments are in line.

How To Use This Script

The original collector installer script allows you to use a local downloaded file for the Otel Collector MSI by using the parameter msi_path. However, if you enable the with_dotnet_instrumentation to install the .net auto instrumentation, that part of the installer script does not support manually downloading files and for many server environments this section will fail. You then end up with a partially installed set of collector and instrumentation. The script changes are designed to support fully offline installs of both the collector and the .net auto instrumentation when using the combination of these new params and the previously existing msi_path.

New Params:

  • dotnet_psm1_path: (OPTIONAL) Specify a local path to a Splunk OpenTelemetry .NET Auto Instrumentation Powershell Module file (.psm1) instead of downloading the package. This module will be used to install the .NET auto instrumentation files. The most current PSM1 file can be downloaded at https://github.com/signalfx/splunk-otel-dotnet/releases
  • dotnet_auto_zip_path: (OPTIONAL) Specify a local path to a Splunk OpenTelemetry .NET Auto Instrumentation zip package that will be installed by the dotnet psm1 module instead of downloading the package. The most current zip file can be downloaded at https://github.com/signalfx/splunk-otel-dotnet/releases
  • force_skip_verify_access_token: (OPTIONAL) Forces the skipping the verification check of the Splunk Observability Access Token regardless of what is in the env variable VERIFY_ACCESS_TOKEN. This is helpful on new installs where access might be an issue or the token isn't created yet.

Example Command Line:

Please note my example has the "." to call the script and depending on your setup you may need to use a different setup. This command also requires Administrator permissions to be sure to open a powershell window as administrator. For ease of use, I also copy all the binaries and this new script into the same folder. In the example below I also using the option force_skip_verify_access_token as its common for new servers in a DMZ to all outbound traffic blocked. Blocked traffic result in the access_token verification process failing and then the installer will error out and stop. This options allows you to skip that check and continue with the install. However data will not flow into Splunk Observability until the proper ports are open.

  • .\splunk-otel-collector.ps1 -access_token "x-MyFakeToken" -msi_path "C:\myOtel\splunk-otel-collector-0.96.1-amd64.msi" -dotnet_psm1_path "C:\myOtel\Splunk.OTel.DotNet.psm1" -dotnet_auto_zip_path "C:\myOtel\splunk-opentelemetry-dotnet-windows.zip" -with_dotnet_instrumentation $true -force_skip_verify_access_token $true -realm ="US1"

Known Issues:

The original collector installer script allows you to use a local downloaded file for the Otel Collector MSI by using the parameter msi_path. However, if you enable the with_dotnet_instrumentation to install the .net auto instrumentation, that part of the installer script does not support manually downloading files and for many server environments this section will fail. You then end up with a partially installed set of collector and instrumentation. The changes are designed to support fully offline installs of both the collector and the .net auto instrumentation when using the combination of these new params and the previously existing msi_path.

New Params:

dotnet_psm1_path: (OPTIONAL) Specify a local path to a Splunk OpenTelemetry .NET Auto Instrumentation Powershell Module file (.psm1) instead of downloading the package. This module will be used to install the .NET auto instrumentation files.

dotnet_auto_zip_path: (OPTIONAL) Specify a local path to a Splunk OpenTelemetry .NET Auto Instrumentation zip package that will be installed by the dotnet psm1 module instead of downloading the package.

force_skip_verify_access_token: (OPTIONAL) Forces the skipping the verification check of the Splunk Observability Access Token regardless of what is in the env variable VERIFY_ACCESS_TOKEN. This is helpful on new installs where access might be an issue or the token isn't created yet.
@bryan-splunk bryan-splunk requested review from a team as code owners March 14, 2024 18:01
Copy link
Contributor

github-actions bot commented Mar 14, 2024

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@bryan-splunk
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

srv-gh-o11y-gdi-cla added a commit to splunk/cla-agreement that referenced this pull request Mar 14, 2024
Copy link
Contributor

@pjanotti pjanotti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this change @bryan-splunk!

Some minor stuff to change before we can merge it.

internal/buildscripts/packaging/installer/install.ps1 Outdated Show resolved Hide resolved
internal/buildscripts/packaging/installer/install.ps1 Outdated Show resolved Hide resolved
} else {
$dotnet_autoinstr_path = $dotnet_psm1_path
echo "Using Local PSM1 file and ArgumentList values: $dotnet_psm1_path -ArgumentList $dotnet_auto_zip_path"
Import-Module $dotnet_autoinstr_path -ArgumentList $dotnet_auto_zip_path
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think -ArgumentList is needed here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it with the -ArgumentList and the values were successfully passed to the PSM1 file. I didn't try without it. I found this method of passing arguments in this StackOverflow article.
https://stackoverflow.com/questions/36897511/powershell-module-pass-a-parameter-while-importing-module

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't matter in this case because the module doesn't have module level parameters.

bryan-splunk and others added 3 commits March 14, 2024 16:55
fixed spacing

Co-authored-by: Paulo Janotti <pjanotti@splunk.com>
removed double quotes on variable

Co-authored-by: Paulo Janotti <pjanotti@splunk.com>
# If the variable dotnet_auto_zip_path is an empty string, then the Installer will download the .NET Instrumentation from the default repository.
@pjanotti pjanotti merged commit e471ac3 into signalfx:main Mar 15, 2024
24 of 25 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants