diff --git a/.github/workflows/azure-site-extension.yml b/.github/workflows/azure-site-extension.yml new file mode 100644 index 0000000000..4036e56fe3 --- /dev/null +++ b/.github/workflows/azure-site-extension.yml @@ -0,0 +1,71 @@ +name: Azure Site Extension + +on: + workflow_dispatch: + +env: + SPEC_FILE_TEMPLATE: 'NewRelic.Azure.WebSites.Extension.NodeAgent.nuspec' + +jobs: + create_extension_bundle: + runs-on: windows-latest + + strategy: + matrix: + node-version: ['lts/*'] + arch: [ x64 ] + + steps: + - uses: actions/checkout@v4 + + - name: Setup dotnet '6.0.x' + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '6.0.x' + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + architecture: ${{ matrix.arch }} + + - name: Find agent version + run: | + $env:npm_agent_version = npm view newrelic version + echo "AGENT_VERSION=$env:npm_agent_version" | Out-File -FilePath $env:GITHUB_ENV -Append + + - name: Set package filename + run: | + echo "PACKAGE_FILENAME=NewRelic.Azure.WebSites.Extension.NodeAgent-${{env.AGENT_VERSION}}" | Out-File -FilePath $env:GITHUB_ENV -Append + + - name: Verify environment vars # because we can't access GH env vars until the next step + run: | + echo "Agent version: ${{ env.AGENT_VERSION }}" + echo "Package filename: ${{ env.PACKAGE_FILENAME }}" + + - name: Install agent + working-directory: cloud-tooling/azure-site-extension/Content + run: | + npm i --prefix . newrelic@${{ env.AGENT_VERSION }} + echo "Agent installed" + + - name: Configure package files + working-directory: cloud-tooling/azure-site-extension + run: | + (Get-Content ${{ env.SPEC_FILE_TEMPLATE }}).Replace('{VERSION}', "${{ env.AGENT_VERSION }}") | Set-Content ${{ env.PACKAGE_FILENAME }}.nuspec + + - name: Create bundle + working-directory: cloud-tooling/azure-site-extension + run: nuget pack "${{ env.PACKAGE_FILENAME }}.nuspec" + + # This step is for us to check what's going to be published + - name: Archive package for verification + uses: actions/upload-artifact@v4 + with: + name: azure-site-extension-test-${{ env.PACKAGE_FILENAME }} + path: cloud-tooling/azure-site-extension/${{ env.PACKAGE_FILENAME }}.nupkg + + - name: Publish site extension + working-directory: cloud-tooling/azure-site-extension + run: | + dotnet nuget push "${{ env.PACKAGE_FILENAME }}.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source ${{ secrets.NUGET_SOURCE }} diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md index 488aa64e2a..b4327dc219 100644 --- a/THIRD_PARTY_NOTICES.md +++ b/THIRD_PARTY_NOTICES.md @@ -1076,7 +1076,7 @@ SOFTWARE. ### @aws-sdk/client-s3 -This product includes source derived from [@aws-sdk/client-s3](https://github.com/aws/aws-sdk-js-v3) ([v3.632.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.632.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.632.0/LICENSE): +This product includes source derived from [@aws-sdk/client-s3](https://github.com/aws/aws-sdk-js-v3) ([v3.637.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.637.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.637.0/LICENSE): ``` Apache License @@ -1285,7 +1285,7 @@ This product includes source derived from [@aws-sdk/client-s3](https://github.co ### @aws-sdk/s3-request-presigner -This product includes source derived from [@aws-sdk/s3-request-presigner](https://github.com/aws/aws-sdk-js-v3) ([v3.632.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.632.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.632.0/LICENSE): +This product includes source derived from [@aws-sdk/s3-request-presigner](https://github.com/aws/aws-sdk-js-v3) ([v3.637.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.637.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.637.0/LICENSE): ``` Apache License @@ -2656,7 +2656,7 @@ SOFTWARE. ### async -This product includes source derived from [async](https://github.com/caolan/async) ([v3.2.5](https://github.com/caolan/async/tree/v3.2.5)), distributed under the [MIT License](https://github.com/caolan/async/blob/v3.2.5/LICENSE): +This product includes source derived from [async](https://github.com/caolan/async) ([v3.2.6](https://github.com/caolan/async/tree/v3.2.6)), distributed under the [MIT License](https://github.com/caolan/async/blob/v3.2.6/LICENSE): ``` Copyright (c) 2010-2018 Caolan McMahon @@ -2683,7 +2683,7 @@ THE SOFTWARE. ### aws-sdk -This product includes source derived from [aws-sdk](https://github.com/aws/aws-sdk-js) ([v2.1677.0](https://github.com/aws/aws-sdk-js/tree/v2.1677.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js/blob/v2.1677.0/LICENSE.txt): +This product includes source derived from [aws-sdk](https://github.com/aws/aws-sdk-js) ([v2.1687.0](https://github.com/aws/aws-sdk-js/tree/v2.1687.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js/blob/v2.1687.0/LICENSE.txt): ``` diff --git a/cloud-tooling/azure-site-extension/.gitignore b/cloud-tooling/azure-site-extension/.gitignore new file mode 100644 index 0000000000..5bdf479bc9 --- /dev/null +++ b/cloud-tooling/azure-site-extension/.gitignore @@ -0,0 +1 @@ +NewRelic.Azure.WebSites.Extension.NodeAgent.*.nupkg diff --git a/cloud-tooling/azure-site-extension/Content/README.md b/cloud-tooling/azure-site-extension/Content/README.md new file mode 100644 index 0000000000..1d0b1b4327 --- /dev/null +++ b/cloud-tooling/azure-site-extension/Content/README.md @@ -0,0 +1,52 @@ +# Azure Node Agent Site Extension + +This project creates an Azure site extension that automatically installs the New Relic Node Agent. This extension is designed for Node applications running on Azure Windows compute resources. The site extensions follow [semantic versioning conventions](https://semver.org/). You can expect to find artifacts in [Nuget](https://www.nuget.org/). + +## Installation + +Applying the site extension will install the New Relic Node agent. + +From the Azure Home page, do the following: +- Click the App Services tile +- Click the name of the target application in the displayed list +- On the options listed on the left, scroll down to "Extensions" located under the Development Tools category +- Click on + Add at the top of the page +- From the extension drop down, select New Relic Node Agent. +- Check the box for accepting the legal terms +- Click Add on the bottom of the page. This will begin installation of the extension. + +Once installed, the extension creates the following artifacts: + +- Folder: `C:\home\SiteExtensions\NewRelic.Azure.Websites.Extension.NodeAgent` +- XDT: `applicationHost.xdt` that will add the necessary `NODE_OPTIONS` environment variable on application startup +- The New Relic Node agent and dependencies will be installed into `C:\home\site\wwwroot\node_modules` + +If the extension fails to install, a log file is created at `C:\home\SiteExtensions\NewRelic.Azure.Websites.Extension.NodeAgent\install.log`. + +If the New Relic agent has been installed successfully and logging has been enabled, the agent will append its logs to a file at `C:\home\site\wwwroot\newrelic_agent.log`. + +### Compatibility note: + +For applications running on Win 32, full Code Level Metrics support (file path, line, column) is not available, and profiling will fall back to function name only. + +## Configuration +The New Relic Node agent is configured with the `newrelic.js` file, or via environment variables. [See our documentation for more detailed configuration](https://docs.newrelic.com/docs/apm/agents/nodejs-agent/installation-configuration/nodejs-agent-configuration/). + +Once the site extension is installed, you'll need to manually enter one configuration item before restarting your application. + - On the options listed on the left, scroll down to "Environment variables" located under the "Settings" category and add the following: + - `NEW_RELIC_LICENSE_KEY` - Your New Relic license key value + +The Node agent automatically adds the `NODE_OPTIONS` environment variable with a value of `-r newrelic` which starts the agent. + - Note: Any previously `NODE_OPTIONS` will be removed and reset with `-r newrelic`. + +## Extension Source Files +Below is a description of the files that make up the extension. This can be helpful for future maintenance on the extension or for the creation of another Site Extension. + + - `README.md` - This file + - `NewRelic.Azure.WebSites.Extension.NodeAgent.nuspec` - Contains the metadata about the target extension: Name, authors, copyright, etc. Nuspec Format + - `Content/applicationHost.xdt` - XDT transformation to add the necessary agent startup environment variable to the app config when the app starts up + - `Content/install.cmd` - Simple batch file that wraps a call to the Powershell `install.ps1` script + - `Content/install.ps1` - Powershell script that moves/installs the agent bundle to the proper location on the host + - `Content/uninstall.cmd` - Simple batch file that will remove the Node installation artifacts when the extension is removed + +Note: We recommend installing or removing this Azure site extension while your web application is stopped. diff --git a/cloud-tooling/azure-site-extension/Content/applicationHost.xdt b/cloud-tooling/azure-site-extension/Content/applicationHost.xdt new file mode 100644 index 0000000000..2ac781f5df --- /dev/null +++ b/cloud-tooling/azure-site-extension/Content/applicationHost.xdt @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/cloud-tooling/azure-site-extension/Content/scmApplicationHost.xdt b/cloud-tooling/azure-site-extension/Content/scmApplicationHost.xdt new file mode 100644 index 0000000000..6ac1b18678 --- /dev/null +++ b/cloud-tooling/azure-site-extension/Content/scmApplicationHost.xdt @@ -0,0 +1,5 @@ + + + + diff --git a/cloud-tooling/azure-site-extension/NewRelic.Azure.WebSites.Extension.NodeAgent.nuspec b/cloud-tooling/azure-site-extension/NewRelic.Azure.WebSites.Extension.NodeAgent.nuspec new file mode 100644 index 0000000000..d2d5d91f08 --- /dev/null +++ b/cloud-tooling/azure-site-extension/NewRelic.Azure.WebSites.Extension.NodeAgent.nuspec @@ -0,0 +1,24 @@ + + + + NewRelic.Azure.WebSites.Extension.NodeAgent + {VERSION} + New Relic Node Agent {VERSION} + New Relic + Apache-2.0 + https://github.com/newrelic/node-newrelic + true + This extension adds the New Relic Node Agent to your Azure WebSite. + https://newrelic.com/static-assets/images/icons/avatar-newrelic.png + images\icon.png + New Relic, Inc., 2024 + AzureSiteExtension + + + + + + + + + diff --git a/cloud-tooling/azure-site-extension/icon.png b/cloud-tooling/azure-site-extension/icon.png new file mode 100644 index 0000000000..ec5bab479f Binary files /dev/null and b/cloud-tooling/azure-site-extension/icon.png differ diff --git a/third_party_manifest.json b/third_party_manifest.json index d36962c491..e4ee1bedaf 100644 --- a/third_party_manifest.json +++ b/third_party_manifest.json @@ -1,5 +1,5 @@ { - "lastUpdated": "Mon Aug 19 2024 14:49:27 GMT-0400 (Eastern Daylight Time)", + "lastUpdated": "Fri Aug 30 2024 14:16:44 GMT-0500 (Central Daylight Time)", "projectName": "New Relic Node Agent", "projectUrl": "https://github.com/newrelic/node-newrelic", "includeOptDeps": true, @@ -226,28 +226,28 @@ } }, "devDependencies": { - "@aws-sdk/client-s3@3.632.0": { + "@aws-sdk/client-s3@3.637.0": { "name": "@aws-sdk/client-s3", - "version": "3.632.0", + "version": "3.637.0", "range": "^3.556.0", "licenses": "Apache-2.0", "repoUrl": "https://github.com/aws/aws-sdk-js-v3", - "versionedRepoUrl": "https://github.com/aws/aws-sdk-js-v3/tree/v3.632.0", + "versionedRepoUrl": "https://github.com/aws/aws-sdk-js-v3/tree/v3.637.0", "licenseFile": "node_modules/@aws-sdk/client-s3/LICENSE", - "licenseUrl": "https://github.com/aws/aws-sdk-js-v3/blob/v3.632.0/LICENSE", + "licenseUrl": "https://github.com/aws/aws-sdk-js-v3/blob/v3.637.0/LICENSE", "licenseTextSource": "file", "publisher": "AWS SDK for JavaScript Team", "url": "https://aws.amazon.com/javascript/" }, - "@aws-sdk/s3-request-presigner@3.632.0": { + "@aws-sdk/s3-request-presigner@3.637.0": { "name": "@aws-sdk/s3-request-presigner", - "version": "3.632.0", + "version": "3.637.0", "range": "^3.556.0", "licenses": "Apache-2.0", "repoUrl": "https://github.com/aws/aws-sdk-js-v3", - "versionedRepoUrl": "https://github.com/aws/aws-sdk-js-v3/tree/v3.632.0", + "versionedRepoUrl": "https://github.com/aws/aws-sdk-js-v3/tree/v3.637.0", "licenseFile": "node_modules/@aws-sdk/s3-request-presigner/LICENSE", - "licenseUrl": "https://github.com/aws/aws-sdk-js-v3/blob/v3.632.0/LICENSE", + "licenseUrl": "https://github.com/aws/aws-sdk-js-v3/blob/v3.637.0/LICENSE", "licenseTextSource": "file", "publisher": "AWS SDK for JavaScript Team", "url": "https://aws.amazon.com/javascript/" @@ -364,27 +364,27 @@ "licenseTextSource": "file", "publisher": "Evgeny Poberezkin" }, - "async@3.2.5": { + "async@3.2.6": { "name": "async", - "version": "3.2.5", + "version": "3.2.6", "range": "^3.2.4", "licenses": "MIT", "repoUrl": "https://github.com/caolan/async", - "versionedRepoUrl": "https://github.com/caolan/async/tree/v3.2.5", + "versionedRepoUrl": "https://github.com/caolan/async/tree/v3.2.6", "licenseFile": "node_modules/async/LICENSE", - "licenseUrl": "https://github.com/caolan/async/blob/v3.2.5/LICENSE", + "licenseUrl": "https://github.com/caolan/async/blob/v3.2.6/LICENSE", "licenseTextSource": "file", "publisher": "Caolan McMahon" }, - "aws-sdk@2.1677.0": { + "aws-sdk@2.1687.0": { "name": "aws-sdk", - "version": "2.1677.0", + "version": "2.1687.0", "range": "^2.1604.0", "licenses": "Apache-2.0", "repoUrl": "https://github.com/aws/aws-sdk-js", - "versionedRepoUrl": "https://github.com/aws/aws-sdk-js/tree/v2.1677.0", + "versionedRepoUrl": "https://github.com/aws/aws-sdk-js/tree/v2.1687.0", "licenseFile": "node_modules/aws-sdk/LICENSE.txt", - "licenseUrl": "https://github.com/aws/aws-sdk-js/blob/v2.1677.0/LICENSE.txt", + "licenseUrl": "https://github.com/aws/aws-sdk-js/blob/v2.1687.0/LICENSE.txt", "licenseTextSource": "file", "publisher": "Amazon Web Services", "url": "https://aws.amazon.com/"