Integrating PostgreSQL Databases with ANF: Join this workshop to learn how to create a PostgreSQL server using Instaclustr’s managed service

Mobile Database Essentials: Assess data needs, storage requirements, and more when leveraging databases for cloud and edge applications.

Monitoring and Observability for LLMs: Datadog and Google Cloud discuss how to achieve optimal AI model performance.

Automated Testing: The latest on architecture, TDD, and the benefits of AI and low-code tools.

How to Install NewRelic on Docker Stacks

NewRelic is server performance monitoring that can track microservice performance. This tutorial shows you how to integrate monitoring via deploy hooks in a Docker stack.

· Tutorial
Save
3.08K Views

in this post, i'll be walking you through the steps needed to install newrelic on your docker stack using deploy hooks.

for any of you unfamiliar with newrelic , they're a san francisco based analytics software company, which helps you monitor your web server or mobile app's performance. they've got some pretty cool kits that do everything from monitoring critical transactions, to identifying performance bottlenecks across your microservices.

this guide will help you install the tools for monitoring your server. it's worth mentioning that to add monitoring to your application, you will need to apply some additional configuration, which is not covered in the scope of this post.

so to get started, first you'll need to create a new docker stack, provide the relevant git information or the docker image, and any databases your application might need. once you go to the next step, your custom git repository will be created and on the side bar on the right you should see:

since docker stacks don't have a git repository by default, we create one for you to use for your deploy hooks amongst another things.

this of course applies to existing stacks as well. you can find your repository in settings & information > information > customconfig git.


  1. the first thing to do is to clone this repository on your machine: git clone git@git1.cloud66.com:your_git_name_and_id.git
  2. then create a new file in that folder called deploy_hooks.yml and add the following:
    production: 
     first_thing:
     - snippet: cloud66/newrelic
     target: any
     sudo: true
     execute: true
     apply_during: all

    if apply_during is set to all , this will run on every deployment. set this value to build_only if you only want to run during the stack build process. the deploy hook will run the following code snippet to automate the installation of newrelic, and requires the newrelic_key environment variable to be set on a stack. this snippet is open source and can be found here .
  3. then add this file to the git repository with: git add deploy_hooks.yml
  4. check that is has been added: git status
  5. and then commit to the repository and push: git commit -m 'deploy hook - initial commit'git push origin master
  6. back on the cloud 66 stack creation page, click on the: add environment variables button on the right, to add a new one called newrelic_key with your key from newrelic.when you now deploy your stack, the snippet will be the first thing that will run on the server and will install everything that's needed.


Published at DZone with permission of Andreas Galanomatis, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.


Comments
X