# Configuring NewRelic

{% hint style="warning" %}
Available only on Linux. WSL is not supported.
{% endhint %}

NewRelic will allow monitoring performance during development, hopefully allowing to spot performance regressions before going to prod.

You will need an infrastructure container running for the NewRelic daemon.

### 1. Retrieve your NR license key.

<https://docs.newrelic.com/docs/apis/intro-apis/new-relic-api-keys/>

### 2. Run the following command

It will spin up a NewRelic infra container (Note that it will run in [privileged mode](https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities)):

<pre class="language-bash"><code class="lang-bash">docker run \
    -d \
<strong>    --name newrelic-infra \
</strong>    --network=host \
    --cap-add=SYS_PTRACE \
    --privileged \
    --pid=host \
    -v "/:/host:ro" \
    -v "/var/run/docker.sock:/var/run/docker.sock" \
    -e NRIA_LICENSE_KEY=&#x3C;LICENSE_KEY> \
    newrelic/infrastructure:latest
</code></pre>

Replace `<LICENSE_KEY>` with your license key

### 3. Add the following configuration to your `cma.js`

```javascript
module.exports = {
	... // other configurations
    configuration: {
        newRelic: {
            enabled: true,
            licenseKey: '<LICENSE_KEY>'
        }
    }
};
```

### 4. Run the `start` command without the `-s` option


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.create-magento-app.com/usage-guide/configuring-newrelic.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
