Best Practices for Using New Relic Agent with Fargate and FastAPI

0
4
Asked By FastTech112 On

I'm running a FastAPI app on AWS Fargate and I'm looking to implement the New Relic agent. Should I go with a single Dockerfile that combines both my FastAPI setup and the New Relic agent, or should I follow the guidance of keeping them in separate Dockerfiles as suggested in New Relic documentation? What are the best practices for this setup?

1 Answer

Answered By CodeMaster77 On

For deploying a FastAPI app on Fargate with the New Relic Python agent, it's generally recommended to use a single Dockerfile. This makes things easier to manage and helps avoid the complications of a multi-container setup. The New Relic agent is meant to wrap directly around your application. Here’s a quick run-down of the steps:
1. Install the `newrelic` package via pip.
2. Generate the `newrelic.ini` config file using `newrelic-admin generate-config`.
3. Set your `NEW_RELIC_LICENSE_KEY` and `NEW_RELIC_APP_NAME` as environment variables.
4. Start your app with the command: `newrelic-admin run-program uvicorn main:app`.
This approach is typically straightforward and works well for most FastAPI applications on Fargate.

DevNinja52 -

Was thinking the same. Thanks for inputs!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.