appsmith icon indicating copy to clipboard operation
appsmith copied to clipboard

add new relic agent to the container

Open pratapaprasanna opened this issue 1 year ago • 6 comments
trafficstars

Fixes: #29892

docker_env is the environments we setup to have new_relic

(base) ➜  appsmith git:(feat/add/newrelicagent) ✗ cat ./docker_env
APPSMITH_ENABLE_NEW_RELIC_LOGGING=1
APPSMITH_NEW_RELIC_APP_NAME="appsmith"
APPSMITH_APP_NEW_RELIC_LICENSE_KEY="temp"
(base) ➜  appsmith git:(feat/add/newrelicagent) ✗ docker run -it -d --name appsmith_custom -v ./deploy/docker/fs/opt/appsmith/entrypoint.sh:/opt/appsmith/entrypoint.sh --env-file=./docker_env -p 8003:80 -p 9003:9001 -v "$PWD/stacks_new:/appsmith-stacks" appsmith/appsmith-ce:nightly
de97599ccbb38c3a540b1d746c3ac933d196e4bac768433cfe5f010cfcf1215f
(base) ➜  appsmith git:(feat/add/newrelicagent) ✗ docker ps -a
CONTAINER ID   IMAGE                          COMMAND                  CREATED         STATUS                            PORTS                                                   NAMES
de97599ccbb3   appsmith/appsmith-ce:nightly   "/opt/appsmith/entry…"   3 seconds ago   Up 2 seconds (health: starting)   443/tcp, 0.0.0.0:8003->80/tcp, 0.0.0.0:9003->9001/tcp   appsmith_custom

Results:

(base) ➜  appsmith git:(feat/add/newrelicagent) ✗ docker exec -it -u root de97599ccbb3 bash
root@de97599ccbb3:/opt/appsmith# ps -eAf | grep java
root      1947     1 99 11:15 pts/0    00:01:05 java -javaagent:/opt/appsmith/newrelic/newrelic.jar --add-opens java.base/java.time=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED -Dserver.port=8080 -XX:+ShowCodeDetailsInExceptionMessages -Djava.security.egd=file:/dev/./urandom -Dlog4j2.formatMsgNoLookups=true -jar server.jar
root      2301  2257  0 11:16 pts/1    00:00:00 grep --color=auto java
root@de97599ccbb3:/opt/appsmith# cat newrelic/newrelic.yml
common:
  license_key: "temp"
  app_name: "appsmith"

If APPSMITH_ENABLE_NEW_RELIC_LOGGING is not set

root@bd22ad16f9e5:/opt/appsmith# head -n 20 newrelic/newrelic.yml
# This file configures the New Relic agent. New Relic monitors
# Java applications with deep visibility and low overhead. For more details and additional
# configuration options visit https://docs.newrelic.com/docs/agents/java-agent/configuration/java-agent-configuration-config-file.
#
# <%= generated_for_user %>
#
# This section is for settings common to all environments.
# Do not add anything above this next line.
common: &default_settings

  # ============================== LICENSE KEY ===============================
  # You must specify the license key associated with your New Relic
  # account. For example, if your license key is 12345 use this:
  # license_key: '12345'
  # The key binds your agent's data to your account in the New Relic UI.
  license_key: '<%= license_key %>'

  # Agent enabled
  # Use this setting to disable the agent instead of removing it from the startup command.
  # Default is true.
root@bd22ad16f9e5:/opt/appsmith# ps -eAf | grep java
root      1946     1 76 11:19 pts/0    00:00:56 java --add-opens java.base/java.time=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED -Dserver.port=8080 -XX:+ShowCodeDetailsInExceptionMessages -Djava.security.egd=file:/dev/./urandom -Dlog4j2.formatMsgNoLookups=true -jar server.jar
root      2366  2106  0 11:21 pts/1    00:00:00 grep --color=auto java

pratapaprasanna avatar Apr 11 '24 13:04 pratapaprasanna

This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.

github-actions[bot] avatar Apr 18 '24 16:04 github-actions[bot]

Walkthrough

The changes focus on integrating New Relic monitoring into Docker-based deployments. The Dockerfile now includes the unzip package and a step to handle New Relic Java files. Additionally, the entrypoint script introduces a new function to configure the New Relic agent settings based on environment variables, enabling on-demand monitoring for self-hosted instances.

Changes

File Path Change Summary
deploy/docker/base.dockerfile Added unzip package and a step for New Relic file handling.
deploy/docker/fs/opt/appsmith/entrypoint.sh Introduced setup_new_relic_agent() function to configure New Relic settings.

Assessment against linked issues

Objective Addressed Explanation
Integrate NewRelic in docker images by default, which can be enabled with environment variables (#29892)
Generate and manage New Relic license keys manually on demand for customers (#29892) The PR does not involve changes related to managing or generating license keys, typically handled outside the codebase.
Allow self-hosted customers to report data to our New Relic account using specific environment variables (#29892)
Enable/disable monitoring via environment variables or by deleting the license key (#29892)

The assessment confirms that the code changes successfully integrate New Relic monitoring into Docker deployments and facilitate management through environment variables as per the objectives outlined in the linked issue.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Apr 25 '24 10:04 coderabbitai[bot]

Where does a fresh system get the newrelic.yml file from ?

rajatagrawal avatar Apr 29 '24 11:04 rajatagrawal

Can we use a custom version of new relic that is tracked in our github repo instead of downloading a fresh newrelic.yml in the setup ?

rajatagrawal avatar Apr 29 '24 11:04 rajatagrawal

Where does a fresh system get the newrelic.yml file from ? Can we use a custom version of new relic that is tracked in our github repo instead of downloading a fresh newrelic.yml in the setup ? we are generating the file and not downloading it from web

pratapaprasanna avatar May 03 '24 07:05 pratapaprasanna

Where does a fresh system get the newrelic.yml file from ? Can we use a custom version of new relic that is tracked in our github repo instead of downloading a fresh newrelic.yml in the setup ? we are generating the file and not downloading it from web

@pratapaprasanna

Can we please generate the newrelic yml file from here ?

rajatagrawal avatar May 07 '24 07:05 rajatagrawal

This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.

github-actions[bot] avatar May 21 '24 16:05 github-actions[bot]

This PR has been closed because of inactivity.

github-actions[bot] avatar Jun 02 '24 16:06 github-actions[bot]