-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes to how NR APM configuration is setup
- Loading branch information
1 parent
63770cd
commit 117ffab
Showing
7 changed files
with
90 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 1 addition & 18 deletions
19
servercore2022iisnet48/setup/apm/assets/entrypoint/init/0200_SetupNrApm.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1 @@ | ||
$envVar = [System.Environment]::GetEnvironmentVariable("NEW_RELIC_LICENSE_KEY"); | ||
|
||
if (![string]::IsNullOrEmpty($envVar)) { | ||
$configPath = "C:\ProgramData\New Relic\.NET Agent\newrelic.config"; | ||
if (Test-Path $configPath) { | ||
[xml]$config = Get-Content $configPath; | ||
$config.configuration.SetAttribute("agentEnabled", "true"); | ||
$config.configuration.service.SetAttribute("licenseKey", $envVar); | ||
$config.Save($configPath); | ||
SbsWriteHost "New Relic agent has been enabled."; | ||
} | ||
else { | ||
SbsWriteHost "Config file not found at $configPath"; | ||
} | ||
} | ||
else { | ||
SbsWriteHost "NEW_RELIC_LICENSE_KEY environment variable is not set or empty."; | ||
} | ||
. "c:\entrypoint\refreshenv\SetupNrApm.ps1"; |
22 changes: 22 additions & 0 deletions
22
servercore2022iisnet48/setup/apm/assets/entrypoint/refreshenv/SetupNrApm.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
$NEW_RELIC_LICENSE_KEY = [System.Environment]::GetEnvironmentVariable("NEW_RELIC_LICENSE_KEY"); | ||
|
||
# We need to use these templates to overcome the configmap can only be readonly in K8S :/ | ||
$configTemplatePath = "C:\ProgramData\New Relic\.NET Agent\newrelic.config.template\newrelic.config"; | ||
$configPath = "C:\ProgramData\New Relic\.NET Agent\newrelic.config"; | ||
|
||
if (Test-Path $configTemplatePath) { | ||
Copy-Item -Path $configTemplatePath -Destination $configPath -Force | ||
if (![string]::IsNullOrEmpty($NEW_RELIC_LICENSE_KEY)) { | ||
[xml]$config = Get-Content $configPath; | ||
$config.configuration.SetAttribute("agentEnabled", "true"); | ||
$config.configuration.service.SetAttribute("licenseKey", $NEW_RELIC_LICENSE_KEY); | ||
$config.Save($configPath); | ||
SbsWriteHost "New Relic agent has been enabled through NEW_RELIC_LICENSE_KEY environment."; | ||
} | ||
else { | ||
SbsWriteHost "NEW_RELIC_LICENSE_KEY environment variable is not set or empty, APM might not be enabled."; | ||
} | ||
} | ||
else { | ||
SbsWriteHost "Missing template $configTemplatePath" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
services: | ||
mssql: | ||
stop_grace_period: 40s | ||
build: | ||
context: . | ||
args: | ||
IMG_SERVERCORE2022: ${IMG_SERVERCORE2022} | ||
IMG_SQLSERVER2022AS: ${IMG_SQLSERVER2022AS} | ||
IMG_SQLSERVER2022BASE: ${IMG_SQLSERVER2022BASE} | ||
IMG_SQLSERVER2022K8S: ${IMG_SQLSERVER2022K8S} | ||
MSSQLINSTALL_ISO_URL: ${MSSQLINSTALL_ISO_URL} | ||
MSSQLINSTALL_CU_URL: ${MSSQLINSTALL_CU_URL} | ||
MSSQLINSTALL_CUFIX_URL: ${MSSQLINSTALL_CUFIX_URL} | ||
TEMP: ${BUILD_TEMP} | ||
image: ${IMG_SQLSERVER2022BASE} | ||
networks: | ||
container_default: | ||
ipv4_address: 172.18.8.8 | ||
environment: | ||
- MSSQL_ADMIN_PWD_PROTECT=testpassword | ||
- MSSQL_SERVERNAME=k8s | ||
- SBS_ENTRYPOINTERRORACTION=Stop | ||
- SBS_DEBUG=True | ||
networks: | ||
container_default: | ||
external: true |