diff --git a/docs/error-codes.md b/docs/error-codes.md index a37d3daea..e693b6a36 100644 --- a/docs/error-codes.md +++ b/docs/error-codes.md @@ -3,47 +3,54 @@ The following page list all the various error codes the newrelic-cli(install) can return, Please note, some error code values may be generated by other downstream processes. For example, an error code value of 1 may be generated through various executions. It can be generated because an On-Host Integration noticed the infra structure agent is not installed. But that value could also be generated when starting up the infrastructure agent un-successfully. -| Error Code | Recipe | Error Message | -|------------|---------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| 1 | infrastructure-agent-installer | The infrastructure agent was not detected but is required in order to install an On-Host Integration | -| 2 | infrastructure-agent-installer | An OHI is failing when validating the provided input can connect to a 3rd party software. This can be an nginx apache status route, or a user login/password permission for a database | -| 2 | mongodb-open-source-integration | Cannot connect to the server | -| 3 | apm | No processes found to monitor | -| 3 | mongodb-open-source-integration | Cannot connect to the server using the provided username/password and hostname/port | -| 5 | dotnet-agent-installer | IIS is not installed | -| 6 | dotnet-agent-installer | ASP.NET is not installed | -| 7 | dotnet-agent-installer | Insufficient permissions | -| 9 | elasticsearch-open-source-integration | The ElasticSearch config file cannot be found | -| 10 | | For linux, `grep` is not installed and required to install | -| 11 | elasticsearch-open-source-integration | SSL is set to true, but CA bundle directory cannot be found | -| 11 | mongodb-open-source-integration | SSL is set to true, but client certificate file cannot be found | -| 11 | | For linux, `sed` is not installed and required to install | -| 12 | | For linux, `awk` is not installed and required to install | -| 12 | elasticsearch-open-source-integration | SSL is set to true, but CA bundle file cannot be found | -| 13 | mongodb-open-source-integration | SSL is set to true, but CA file cannot be found | -| 13 | | For linux, `cat` is not installed and required to install | -| 14 | | For linux, `tee` is not installed and required to install | -| 15 | | For linux, `touch` is not installed and required to install | -| 16 | | For darwin, `brew` is not installed and required to install | -| 17 | | For linux and darwin, `curl` is not installed and required to install | -| 18 | | Attempt to install within a docker container. The user should instead run the install on the host, not in the container | -| 19 | | Attempt to install within a Microsoft Subsystem Linux container. This is not supported | -| 20 | | For linux, systemctl is not available on the host (either nor present or not running) | -| 21 | | There is no newrelic infrastructure agent available for the host | -| 22 | | Recipe dependency not met | -| 23 | | User declined to accept recipe terms | -| 24 | | There was an unknown issue trying to download a required component for installation | -| 25 | | There was a web issue trying to download a required component for installation | -| 26 | | There was a file issue trying to download a required component for installation | -| 32 | | Infrastructure agent status endpoint not available | -| 33 | | Infrastructure agent status check not healthy | -| 41 | | For linux, `date` is not installed and required to install | -| 42 | | For linux, `sha256sum` is not installed and required to install | -| 43 | | For linux, `base64` is not installed and required to install | -| 44 | | For linux, `head` is not installed and required to install | -| 45 | | No running Kubernetes clusters detected | -| 46 | mongodb-open-source-integration | Mongo shell is not installed and required to install | -| 130 | | Installation was cancelled either using Ctrl+C or by selecting not to continue the installation | -| 131 | | Installation is unsupported on the operating system - e.g. Logs is currently not supported on ARM architecture | -| 132 | | Signal a DETECTED technology, but the instrumentation cannot be installed through the recipe. | -| 16** | dotnet-agent-installer | Agent install failure code | +| Error Code | Recipe | Error Message | +|------------|---------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 1 | infrastructure-agent-installer | The infrastructure agent was not detected but is required in order to install an On-Host Integration | +| 2 | infrastructure-agent-installer | An OHI is failing when validating the provided input can connect to a 3rd party software. This can be an nginx apache status route, or a user login/password permission for a database | +| 2 | mongodb-open-source-integration | Cannot connect to the server | +| 3 | | Install must be run under sudo or root | +| 3 | apm | No processes found to monitor | +| 3 | mongodb-open-source-integration | Cannot connect to the server using the provided username/password and hostname/port | +| 5 | dotnet-agent-installer | IIS is not installed | +| 6 | dotnet-agent-installer | ASP.NET is not installed | +| 7 | dotnet-agent-installer | Insufficient permissions | +| 9 | elasticsearch-open-source-integration | The ElasticSearch config file cannot be found | +| 10 | | For linux, `grep` is not installed and required to install | +| 10 | kubernetes-open-source-integration | `kubectl` not found, so this is not a host that can manage Kubernetes | +| 11 | elasticsearch-open-source-integration | SSL is set to true, but CA bundle directory cannot be found | +| 11 | mongodb-open-source-integration | SSL is set to true, but client certificate file cannot be found | +| 11 | | For linux, `sed` is not installed and required to install | +| 12 | | For linux, `awk` is not installed and required to install | +| 12 | elasticsearch-open-source-integration | SSL is set to true, but CA bundle file cannot be found | +| 13 | mongodb-open-source-integration | SSL is set to true, but CA file cannot be found | +| 13 | | For linux, `cat` is not installed and required to install | +| 14 | | For linux, `tee` is not installed and required to install | +| 15 | | For linux, `touch` is not installed and required to install | +| 16 | | For darwin, `brew` is not installed and required to install | +| 17 | | For linux and darwin, `curl` is not installed and required to install | +| 18 | | Attempt to install within a docker container. The user should instead run the install on the host, not in the container | +| 18 | agent-control | mktemp is required to run the newrelic install. Please install coreutils and re-run the installation. | +| 19 | | Attempt to install within a Microsoft Subsystem Linux container. This is not supported | +| 20 | | For linux, systemctl is not available on the host (either nor present or not running) | +| 21 | | There is no newrelic infrastructure agent available for the host | +| 22 | | Recipe dependency not met | +| 23 | | User declined to accept recipe terms | +| 24 | | There was an unknown issue trying to download a required component for installation | +| 25 | | There was a web issue trying to download a required component for installation | +| 26 | | There was a file issue trying to download a required component for installation | +| 31 | agent-control | New Relic Agent Control has not started after installing. Refer our documentation for installing manually : https://docs-preview.newrelic.com/docs/new-relic-agent-control | +| 32 | | Infrastructure agent status endpoint not available | +| 33 | | Infrastructure agent status check not healthy | +| 41 | | For linux, `date` is not installed and required to install | +| 42 | | For linux, `sha256sum` is not installed and required to install | +| 43 | | For linux, `base64` is not installed and required to install | +| 44 | | For linux, `head` is not installed and required to install | +| 45 | | No running Kubernetes clusters detected | +| 46 | mongodb-open-source-integration | Mongo shell is not installed and required to install | +| 99 | agent-control | Error getting system identity auth token | +| 100 | agent-control | Failed to create a New Relic System Identity L2 / Legacy System Identity for Fleet Control authentication. Please verify your User Key and ensure your Account Organization has the necessary permissions. | +| 130 | | Installation was cancelled either using Ctrl+C or by selecting not to continue the installation | +| 131 | | Installation is unsupported on the operating system - e.g. Logs is currently not supported on ARM architecture | +| 131 | infrastructure-agent-installer | For Windows, Powershell is required. Please start Powershell in Administrator, and re-run the newrelic-cli command. | +| 132 | | Signal a DETECTED technology, but the instrumentation cannot be installed through the recipe. | +| 16** | dotnet-agent-installer | Agent install failure code | diff --git a/recipes/newrelic/infrastructure/agent-control/debian.yml b/recipes/newrelic/infrastructure/agent-control/debian.yml index 248de106a..380ed354c 100644 --- a/recipes/newrelic/infrastructure/agent-control/debian.yml +++ b/recipes/newrelic/infrastructure/agent-control/debian.yml @@ -367,7 +367,7 @@ install: fi fi vars: - NEW_RELIC_AGENT_VERSION: "0.33.0" + NEW_RELIC_AGENT_VERSION: "0.34.0" silent: true # If configured to do so, migrate the newrelic-infra configuration for usage with New Relic Agent Control diff --git a/recipes/newrelic/infrastructure/agent-control/rhel.yml b/recipes/newrelic/infrastructure/agent-control/rhel.yml index 3047aef25..3f3a46a98 100644 --- a/recipes/newrelic/infrastructure/agent-control/rhel.yml +++ b/recipes/newrelic/infrastructure/agent-control/rhel.yml @@ -310,7 +310,7 @@ install: DISTRO_VERSION: sh: | rpm -E %{rhel} - NEW_RELIC_AGENT_VERSION: "0.33.0" + NEW_RELIC_AGENT_VERSION: "0.34.0" silent: true # If configured to do so, migrate the newrelic-infra configuration for usage with New Relic Agent Control diff --git a/recipes/newrelic/infrastructure/agent-control/suse.yml b/recipes/newrelic/infrastructure/agent-control/suse.yml index 127de141d..2f60a5503 100644 --- a/recipes/newrelic/infrastructure/agent-control/suse.yml +++ b/recipes/newrelic/infrastructure/agent-control/suse.yml @@ -257,7 +257,7 @@ install: vars: SLES_VERSION: sh: awk -F= '/VERSION_ID/ {print $2}' /etc/os-release - NEW_RELIC_AGENT_VERSION: "0.33.0" + NEW_RELIC_AGENT_VERSION: "0.34.0" silent: true # If configured to do so, migrate the newrelic-infra configuration for usage with New Relic Agent Control diff --git a/recipes/newrelic/infrastructure/debian.yml b/recipes/newrelic/infrastructure/debian.yml index 2b54b8ff5..b47a0a514 100644 --- a/recipes/newrelic/infrastructure/debian.yml +++ b/recipes/newrelic/infrastructure/debian.yml @@ -228,7 +228,11 @@ install: add_gpg_key: cmds: - | - curl -s {{.NEW_RELIC_DOWNLOAD_URL}}infrastructure_agent/keys/newrelic_apt_key_current.gpg | apt-key add - + # Remove the key from the legacy keyring if it exists + sudo rm -f /etc/apt/trusted.gpg.d/newrelic-infra.gpg 2>/dev/null + sudo rm -f /etc/apt/trusted.gpg 2>/dev/null + # Add the key to the correct directory + curl -s {{.NEW_RELIC_DOWNLOAD_URL}}infrastructure_agent/keys/newrelic_apt_key_current.gpg | sudo gpg --dearmor --batch --yes -o /etc/apt/trusted.gpg.d/newrelic-infra.gpg silent: true add_nr_source: diff --git a/recipes/newrelic/infrastructure/ubuntu.yml b/recipes/newrelic/infrastructure/ubuntu.yml index f281f3ffb..4193b9c95 100644 --- a/recipes/newrelic/infrastructure/ubuntu.yml +++ b/recipes/newrelic/infrastructure/ubuntu.yml @@ -210,7 +210,11 @@ install: add_gpg_key: cmds: - | - curl -s {{.NEW_RELIC_DOWNLOAD_URL}}infrastructure_agent/keys/newrelic_apt_key_current.gpg | apt-key add - + # Remove the key from the legacy keyring if it exists + sudo rm -f /etc/apt/trusted.gpg.d/newrelic-infra.gpg 2>/dev/null + sudo rm -f /etc/apt/trusted.gpg 2>/dev/null + # Add the key to the correct directory + curl -s {{.NEW_RELIC_DOWNLOAD_URL}}infrastructure_agent/keys/newrelic_apt_key_current.gpg | sudo gpg --dearmor --batch --yes -o /etc/apt/trusted.gpg.d/newrelic-infra.gpg silent: true add_nr_source: diff --git a/recipes/newrelic/infrastructure/windows.yml b/recipes/newrelic/infrastructure/windows.yml index 0ab9ed1a1..16524b32f 100644 --- a/recipes/newrelic/infrastructure/windows.yml +++ b/recipes/newrelic/infrastructure/windows.yml @@ -104,7 +104,8 @@ install: $uninstallIds = New-Object System.Collections.ArrayList foreach ($key in $allKeys) { - $keyData = Get-Item -Path HKLM:\$key + $escapedKey = $key -replace '\[', '`[' -replace '\]', '`]' + $keyData = Get-Item -Path "HKLM:\$escapedKey" $name = $keyData.GetValue("DisplayName") if ($name -and $name -match $Match) { $keyId = Split-Path $key -Leaf @@ -131,8 +132,7 @@ install: } } catch { - Write-Host -ForegroundColor Red "We detected you may be running an anti-virus software preventing our installation to continue. Please check your anti-virus software to allow Powershell execution while running this installation." - exit 131; + throw $_.Exception } ' diff --git a/test/definitions/ohi/linux/cassandra-debian.json b/test/definitions/ohi/linux/cassandra-debian.json index d25d92343..d805ac409 100644 --- a/test/definitions/ohi/linux/cassandra-debian.json +++ b/test/definitions/ohi/linux/cassandra-debian.json @@ -18,7 +18,7 @@ "services": [{ "id": "cassandra1", "destinations": ["host1"], - "source_repository": "https://github.com/newrelic/open-install-library.git", + "source_repository": "-b fix/cassandra-debian https://github.com/newrelic/open-install-library.git", "deploy_script_path": "test/deploy/linux/cassandra/install/debian/roles", "port": 9042, "params":{ diff --git a/test/definitions/ohi/linux/consul-debian.json b/test/definitions/ohi/linux/consul-debian.json index a92d72525..96877657e 100644 --- a/test/definitions/ohi/linux/consul-debian.json +++ b/test/definitions/ohi/linux/consul-debian.json @@ -18,7 +18,7 @@ "services": [{ "id": "haproxy1", "destinations": ["host1"], - "source_repository": "https://github.com/newrelic/open-install-library.git", + "source_repository": "-b fix/debian-tests https://github.com/newrelic/open-install-library.git", "deploy_script_path": "test/deploy/linux/consul/install/debian/roles", "port": 8500, "params":{ diff --git a/test/deploy/linux/cassandra/install/debian/roles/prepare/tasks/installCassandra.yml b/test/deploy/linux/cassandra/install/debian/roles/prepare/tasks/installCassandra.yml index 24b445d24..7800a191d 100644 --- a/test/deploy/linux/cassandra/install/debian/roles/prepare/tasks/installCassandra.yml +++ b/test/deploy/linux/cassandra/install/debian/roles/prepare/tasks/installCassandra.yml @@ -14,4 +14,4 @@ ansible.builtin.apt: name: cassandra update_cache: yes - become: true + become: true \ No newline at end of file diff --git a/test/deploy/linux/cassandra/install/debian/roles/prepare/tasks/installDependencies.yml b/test/deploy/linux/cassandra/install/debian/roles/prepare/tasks/installDependencies.yml index c1222f4fd..312250b0b 100644 --- a/test/deploy/linux/cassandra/install/debian/roles/prepare/tasks/installDependencies.yml +++ b/test/deploy/linux/cassandra/install/debian/roles/prepare/tasks/installDependencies.yml @@ -11,6 +11,7 @@ - dirmngr - gnupg - software-properties-common - - wget + - openjdk-11-jdk update_cache: true become: true + diff --git a/test/deploy/linux/consul/install/debian/roles/configure/tasks/main.yml b/test/deploy/linux/consul/install/debian/roles/configure/tasks/main.yml index 19c2c5338..20c83d747 100644 --- a/test/deploy/linux/consul/install/debian/roles/configure/tasks/main.yml +++ b/test/deploy/linux/consul/install/debian/roles/configure/tasks/main.yml @@ -19,13 +19,28 @@ state: latest become: yes -- name: Add official HashiCorp GPG Key - shell: curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add - - become: true +- name: Download HashiCorp GPG key + shell: | + curl -fsSL https://apt.releases.hashicorp.com/gpg -o /tmp/hashicorp.asc + args: + creates: /tmp/hashicorp.asc + become: yes -- name: Add official HashiCorp Linux Repository - shell: apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" - become: true +- name: Add HashiCorp GPG key to APT keyring + shell: | + gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg /tmp/hashicorp.asc + args: + creates: /usr/share/keyrings/hashicorp-archive-keyring.gpg + become: yes + +- name: Add HashiCorp APT repository + vars: + compatible_version: bookworm + apt_repository: + repo: "deb [arch=amd64 signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com {{ compatible_version }} main" + state: present + filename: hashicorp + become: yes - block: - name: Create consul config directory diff --git a/test/deploy/linux/docker/install/roles/prepare/tasks/main.yml b/test/deploy/linux/docker/install/roles/prepare/tasks/main.yml index 8ac07af5e..cb0015b23 100644 --- a/test/deploy/linux/docker/install/roles/prepare/tasks/main.yml +++ b/test/deploy/linux/docker/install/roles/prepare/tasks/main.yml @@ -67,3 +67,39 @@ when: ansible_pkg_mgr == 'apt' become: yes + +######################################## +# Amazon Linux 2023 support for Docker installation +######################################## +- block: + # Update the system packages + - name: Update all system packages + dnf: + name: "*" + state: latest + + # Install Docker + - name: Install Docker + dnf: + name: docker + state: present + + # Start and enable Docker service + - name: Start and enable Docker service + systemd: + name: docker + state: started + enabled: yes + + # Add the ec2-user to the docker group + - name: Add ec2-user to the docker group + user: + name: ec2-user + groups: docker + append: yes + + - debug: + msg: "Docker installation completed successfully." + + when: ansible_distribution == 'Amazon' and ansible_distribution_version == '2023' + become: yes \ No newline at end of file diff --git a/test/deploy/linux/java/javaGradleApp/.gitignore b/test/deploy/linux/java/javaGradleApp/.gitignore new file mode 100644 index 000000000..b63da4551 --- /dev/null +++ b/test/deploy/linux/java/javaGradleApp/.gitignore @@ -0,0 +1,42 @@ +.gradle +build/ +!gradle/wrapper/gradle-wrapper.jar +!**/src/main/**/build/ +!**/src/test/**/build/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/test/deploy/linux/java/javaGradleApp/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/test/deploy/linux/java/javaGradleApp/.gradle/buildOutputCleanup/buildOutputCleanup.lock new file mode 100644 index 000000000..c6ebc2ef7 Binary files /dev/null and b/test/deploy/linux/java/javaGradleApp/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/test/deploy/linux/java/javaGradleApp/.gradle/buildOutputCleanup/cache.properties b/test/deploy/linux/java/javaGradleApp/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 000000000..e946246a5 --- /dev/null +++ b/test/deploy/linux/java/javaGradleApp/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Wed Feb 26 16:02:18 IST 2025 +gradle.version=8.4 diff --git a/test/deploy/linux/java/javaGradleApp/.gradle/vcs-1/gc.properties b/test/deploy/linux/java/javaGradleApp/.gradle/vcs-1/gc.properties new file mode 100644 index 000000000..e69de29bb diff --git a/test/deploy/linux/java/javaGradleApp/build.gradle b/test/deploy/linux/java/javaGradleApp/build.gradle index 37beca870..8f059a40b 100644 --- a/test/deploy/linux/java/javaGradleApp/build.gradle +++ b/test/deploy/linux/java/javaGradleApp/build.gradle @@ -24,7 +24,7 @@ tasks.register('curlSelf') { } } tasks.named('war') { - archiveFileName = 'javaGradleApp.war' + archiveFileName = 'javaGradleApp.war' } test { useJUnitPlatform() diff --git a/test/deploy/linux/java/javaGradleApp/gradle/wrapper/gradle-wrapper.properties b/test/deploy/linux/java/javaGradleApp/gradle/wrapper/gradle-wrapper.properties index bad928c7a..6c03eb252 100644 --- a/test/deploy/linux/java/javaGradleApp/gradle/wrapper/gradle-wrapper.properties +++ b/test/deploy/linux/java/javaGradleApp/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Feb 26 16:04:01 IST 2025 +#Tue Mar 11 14:08:24 IST 2025 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists +zipStorePath=wrapper/dists \ No newline at end of file diff --git a/test/deploy/linux/java/javaGradleApp/src/main/java/org/example/Main.java b/test/deploy/linux/java/javaGradleApp/src/main/java/org/example/Main.java index 407f157bc..0c1e8ee8e 100644 --- a/test/deploy/linux/java/javaGradleApp/src/main/java/org/example/Main.java +++ b/test/deploy/linux/java/javaGradleApp/src/main/java/org/example/Main.java @@ -2,6 +2,6 @@ public class Main { public static void main(String[] args) { - System.out.println("Hello world!"); + System.out.println("Hello, World!"); } } \ No newline at end of file diff --git a/test/deploy/linux/nodejs/docker-flow/roles/configure/tasks/main.yml b/test/deploy/linux/nodejs/docker-flow/roles/configure/tasks/main.yml new file mode 100644 index 000000000..435c094c1 --- /dev/null +++ b/test/deploy/linux/nodejs/docker-flow/roles/configure/tasks/main.yml @@ -0,0 +1,13 @@ +--- +- debug: + msg: Install Node.js, Create Dockerfile, and setup Node.js application +# import the nodeJs sample application tasks +- import_tasks: ../../../../nodejs/redhat/roles/configure/tasks/main.yml + +#copy Docker file to remote +- name: Copy node application to remote + ansible.builtin.copy: + src: ../../../../templates/Dockerfile + dest: /home/ec2-user/myNodeApp/Dockerfile + mode: '0777' + become: true \ No newline at end of file diff --git a/test/deploy/linux/nodejs/redhat/roles/configure/tasks/main.yml b/test/deploy/linux/nodejs/redhat/roles/configure/tasks/main.yml index 09dfe76ef..fa63ce3c0 100644 --- a/test/deploy/linux/nodejs/redhat/roles/configure/tasks/main.yml +++ b/test/deploy/linux/nodejs/redhat/roles/configure/tasks/main.yml @@ -1,53 +1,51 @@ --- - debug: - msg: Install Nodejs and docker - -- name: update yum packages - shell: yum update -y + msg: Install Node.js and setup Node.js application + +#copy node appllication to remote +- name: Copy node application to remote + ansible.builtin.copy: + src: ../../../../templates/myNodeApp + dest: /home/ec2-user + mode: '0777' become: true -- name: install docker - shell: yum install docker +# Install Node.js using NodeSource +- name: Install Node.js using NodeSource + become: yes + shell: curl -sL https://rpm.nodesource.com/setup_18.x | bash - + args: + executable: /bin/bash + +- name: Install Node.js + become: yes + yum: + name: nodejs + state: present + +- name: Verify Node.js installation + command: node -v + register: node_version + become_user: "{{ ansible_user }}" + +- name: Print Node.js version + debug: + msg: "Node.js version installed: {{ node_version.stdout }}" + +# Ensure the correct permissions for the myNodeApp directory +- name: Ensure the correct permissions for the myNodeApp directory + file: + path: /home/ec2-user/myNodeApp + state: directory + owner: ec2-user + group: ec2-user + mode: '0755' become: true -- name: RHEL - Start docker service - shell: "service docker start" - -# - name: RHEL - Granting permissions to docker from ec2-user -# shell: "usermod -a -G docker ec2-user" - -# - name: Install Node.js -# shell: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash -# become: true - -# - name: load nvm -# shell: source ~/.bashrc - -# - name: install node.js 20.5.1 -# shell: nvm install 20.5.1 - -# - name: set node.js version 20.5.1 as default -# shell: nvm alias default 20.5.1 - -# - name: Create node.js app directory -# file: -# path: /home/ec2-user/myNodeApp -# state: directory - -# - name: Copy files to myNodeApp directory -# synchronize: -# src: "{{ item }}" -# dest: /home/ec2-user/myNodeApp -# mode: push -# with_fileglob: -# - "../../../../templates/*" -# become: true - -# - name: create package.json -# shell: cd /home/ec2-user/myNodeApp && npm init -y -# become: true - -# - name: install express -# shell: cd /home/ec2-user/myNodeApp && npm install express -# become: true - +# install npm dependencies +- name: Install npm dependencies + shell: npm install + args: + chdir: "/home/{{ ansible_user }}/myNodeApp" + become: yes + become_user: "{{ ansible_user }}" \ No newline at end of file diff --git a/test/deploy/linux/nodejs/templates/Dockerfile b/test/deploy/linux/nodejs/templates/Dockerfile index 4b82e63a6..e156320bd 100644 --- a/test/deploy/linux/nodejs/templates/Dockerfile +++ b/test/deploy/linux/nodejs/templates/Dockerfile @@ -1,19 +1,26 @@ # Dockerfile - -FROM node +#base image +FROM node:18 # Create app directory -WORKDIR /usr/src/app +WORKDIR /app # Install app dependencies -COPY package*.json ./ -RUN npm install +COPY . /app # Bundle app source -COPY . . +RUN npm install # Expose the port the app runs on -EXPOSE 3030 +EXPOSE 3000 # Command to run the application -CMD [ "node", "index.js" ] \ No newline at end of file +CMD ["node", "app.js"] + + + + + + + + \ No newline at end of file diff --git a/test/deploy/linux/nodejs/templates/index.js b/test/deploy/linux/nodejs/templates/index.js deleted file mode 100644 index e2a95923c..000000000 --- a/test/deploy/linux/nodejs/templates/index.js +++ /dev/null @@ -1,18 +0,0 @@ -// index.js - -// Load the New Relic agent before anything else -require('newrelic'); - -const express = require('express'); -const app = express(); -const PORT = process.env.PORT || 3030; - -// Simple route for testing -app.get('/', (req, res) => { - res.send('Hello World! This is my Node.js app instrumented with New Relic.'); -}); - -// Start the server -app.listen(PORT, () => { - console.log(`Server is running on http://localhost:${PORT}`); -}); \ No newline at end of file diff --git a/test/deploy/linux/nodejs/templates/myNodeApp/app.js b/test/deploy/linux/nodejs/templates/myNodeApp/app.js new file mode 100644 index 000000000..84dcd5bdb --- /dev/null +++ b/test/deploy/linux/nodejs/templates/myNodeApp/app.js @@ -0,0 +1 @@ +console.log('Hello, World!'); \ No newline at end of file diff --git a/test/deploy/linux/nodejs/templates/myNodeApp/package.json b/test/deploy/linux/nodejs/templates/myNodeApp/package.json new file mode 100644 index 000000000..c08606caf --- /dev/null +++ b/test/deploy/linux/nodejs/templates/myNodeApp/package.json @@ -0,0 +1,12 @@ +{ + "name": "myNodeApp", + "version": "1.0.0", + "description": "A sample Node.js application", + "main": "app.js", + "scripts": { + "start": "node app.js" + }, + "dependencies": { + "express": "^4.17.1" + } + } \ No newline at end of file diff --git a/test/deploy/linux/tomcat/systemd/shScript/gradle/install/linux/roles/prepare/tasks/installGradle.yml b/test/deploy/linux/tomcat/systemd/shScript/gradle/install/linux/roles/prepare/tasks/installGradle.yml index d28e2eed9..189436797 100644 --- a/test/deploy/linux/tomcat/systemd/shScript/gradle/install/linux/roles/prepare/tasks/installGradle.yml +++ b/test/deploy/linux/tomcat/systemd/shScript/gradle/install/linux/roles/prepare/tasks/installGradle.yml @@ -2,7 +2,7 @@ - name: Set facts for Gradle version set_fact: - gradle_version: 8.12.1 + gradle_version: 8.13 - name: Create Gradle directory file: diff --git a/test/manual/definitions/apm/node/node-js-docker.json b/test/manual/definitions/apm/node/node-js-docker.json index 5e0fde746..fbf648b9d 100644 --- a/test/manual/definitions/apm/node/node-js-docker.json +++ b/test/manual/definitions/apm/node/node-js-docker.json @@ -11,19 +11,24 @@ "provider": "aws", "type": "ec2", "size": "t2.medium", - "ami_name": "amzn2-ami-hvm-2.0.????????.?-x86_64-gp2", + "ami_name": "al2023-ami-2023.?.????????.?-kernel-?.?-x86_64", "user_name": "ec2-user" } ], "services": [ + { + "id": "docker", + "source_repository": "https://github.com/newrelic/open-install-library.git", + "deploy_script_path": "test/deploy/linux/docker/install/roles", + "port": 9999, + "destinations": ["node-js-docker"] + }, { "id": "nodejs", "source_repository": "https://github.com/newrelic/open-install-library.git", - "deploy_script_path": "test/deploy/linux/nodejs/redhat/roles", - "port": 8080, - "destinations": [ - "node-js-docker" - ] + "deploy_script_path": "test/deploy/linux/nodejs/docker-flow/roles", + "port": 80, + "destinations": ["node-js-docker"] } ] } \ No newline at end of file diff --git a/test/manual/definitions/apm/node/node-linux2.json b/test/manual/definitions/apm/node/node-linux2.json index 2d6fb97b6..1b0df38c6 100644 --- a/test/manual/definitions/apm/node/node-linux2.json +++ b/test/manual/definitions/apm/node/node-linux2.json @@ -1,39 +1,27 @@ { "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" }, - "resources": [ - { - "id": "nodelinux2", - "provider": "aws", - "type": "ec2", - "size": "t3.micro", - "ami_name": "newrelic-install-linux-node-pm2" - } + { + "id": "node-js", + "provider": "aws", + "type": "ec2", + "size": "t2.medium", + "ami_name": "al2023-ami-2023.?.????????.?-kernel-?.?-x86_64", + "user_name": "ec2-user" + } ], - "services": [ - { - "id": "nodetron", - "source_repository": "https://github.com/newrelic/demo-nodetron.git", - "deploy_script_path": "deploy/linux/pm2/roles", - "port": 5001, - "destinations": ["nodelinux2"], - "files": [ - { - "destination_filepath": "engine/cronjob.json", - "content": [ - { - "frequency": "* * * * *", - "job": "for ((i=1;i<=30;i++)); do curl '[service:nodetron:url]/'; curl '[service:nodetron:url]/api/inventory'; sleep 1; done" - } - ] - } - ] - } +{ + "id": "nodejs", + "source_repository": "https://github.com/newrelic/open-install-library.git", + "deploy_script_path": "test/deploy/linux/nodejs/redhat/roles", + "port": 80, + "destinations": ["node-js"] + } ] -} +} \ No newline at end of file diff --git a/test/manual/readme.MD b/test/manual/readme.MD index 5e8e84f0c..14f406ff2 100644 --- a/test/manual/readme.MD +++ b/test/manual/readme.MD @@ -156,3 +156,38 @@ Smoke test: ``` vagrant up && vagrant destroy -f ``` + +## Testing Local Recipe Changes + +To test local recipe changes with the New Relic CLI, you can use the `--recipePath` flag. This flag bypasses the default recipe execution from the CLI core bundle and instead executes the recipe specified in the provided path. Below is a detailed guide on how to perform this: + +Steps for Testing Local Recipe Changes + +1) Locate Your Local Recipe: + Ensure your local recipe is saved on your system. For example, assume the recipe file is located at `~/debian.yml` on an EC2 instance. + +2) Modify the Guided Install Command: + Replace the default guided install command from New Relic's UI with a custom command by specifying the actual recipe name and using the `--recipePath` flag to point to your local recipe file. + +Example Command: + +```bash +curl -Ls https://download.newrelic.com/install/newrelic-cli/scripts/install.sh | bash && \ +sudo NEW_RELIC_API_KEY= NEW_RELIC_ACCOUNT_ID= /usr/local/bin/newrelic install -n infrastructure-agent-installer --recipePath ~/debian.yml # Add --debug for verbose logging +``` +Additionally, We can test multiple local recipe changes by using comma-separated values for targeted installs and specifying multiple paths with the `--recipePath` flag. See the example below: + +```bash +curl -Ls https://download.newrelic.com/install/newrelic-cli/scripts/install.sh | bash && \ +sudo NEW_RELIC_API_KEY= NEW_RELIC_ACCOUNT_ID= /usr/local/bin/newrelic install -n infrastructure-agent-installer,logs-integration --recipePath /path/to/your/local/infra-recipe/file,/path/to/your/local/logs-recipe/file # Add --debug for verbose logging +``` + +## Explanation of Parameters: + +NEW_RELIC_API_KEY: Replace with your actual New Relic API key. +NEW_RELIC_ACCOUNT_ID: Replace with your New Relic account ID. +`-n `: Specifies the name of the recipe (e.g., `infrastructure-agent-installer`). +`--recipePath /path/to/your/local/recipe/file`: Specifies the path to your local recipe file (`~/debian.yml` in this case). +`--debug`: Optional flag to enable verbose logging for debugging purposes. + +This approach allows you to test custom changes in your recipes locally before deploying them to production environments.