TypistTech.trellis-newrelic-php

Trellis New Relic PHP Agent

Ansible Role GitHub tag (latest SemVer) Ansible Role Ansible Quality Score GitHub GitHub Sponsor Sponsor via PayPal Hire Typist Tech Twitter Follow @TangRufus

This tool helps you install the New Relic PHP agent on servers using Trellis.

Role Variables

You will need to set some key variables in your configuration.

# group_vars/<environment>/vault.yml
# Please encrypt this file. For more details, refer to: https://roots.io/trellis/docs/vault/
##########################################################################

# Your New Relic License Key
vault_newrelic_license: xxxxxxxxxxx

# group_vars/<environment>/main.yml
###################################

# Set the desired package state.
# Use `latest` to always install the latest version.
# Use `present` to keep the already installed version.
# Options: present|latest
# Default: latest
newrelic_package_state: present

# Check the default settings here: https://github.com/TypistTech/trellis-newrelic-php/blob/master/defaults/main.yml
# More info: https://docs.newrelic.com/docs/agents/php-agent/configuration/php-agent-configuration
newrelic_config:
  appname: "My Awesome App {{ env }}"
  framework: no_framework
  transaction_tracer.detail: 1
  datastore_tracer.database_name_reporting.enabled: true

Updating Trellis' Playbook

To include this role, add it to dev.yml and server.yml right after role: php:

  # `dev.yml` & `server.yml`

  roles:
      # Other Trellis roles ...
      - { role: php, tags: [php] }
+     - { role: TypistTech.trellis-newrelic-php, tags: [php, newrelic-php] }
      # Other Trellis roles ...

Requirements

You will need:

Installation

Add this role to your galaxy.yml file:

- src: TypistTech.trellis-newrelic-php # Remember, it's case-sensitive!
  version: XXX.YYY.ZZZ # Make sure to check for the latest version!

Run $ trellis galaxy install to install this role.

Common Errors

vault_newrelic_license is not defined

Make sure your New Relic license key is encrypted in group_vars/<environment>/vault.yml. Check the role variables section for details.

New Relic combines different environments into one application

To fix this, set a unique appname for each environment.

Example:

# group_vars/all/main.yml
#########################

newrelic_config:
  appname: "My Awesome App {{ env }}"

Error after updating PHP version

If you see errors after a PHP upgrade (like from 7.4 to 8.0), follow these steps to resolve:

# If you manage multiple servers, do this on each server.
ssh [email protected]
sudo newrelic-install install
sudo reboot

# After the server(s) restart, re-provision them
# You just need to re-provision once for all servers.
trellis provision production

Limitations

  • By default, only one New Relic APM application is allowed per server.

To work around this, you may need to extend the fastcgi_basic block to include the necessary settings for multiple applications.

FAQs

Where can I find more useful resources like this?

Can I leave a review for this package?

Sure! It's great to hear that you enjoy the project. Since it's not on wp.org, you can:

Sponsoring :heart:

Do you love trellis-newrelic-php? You can help maintain it by sponsoring.

GitHub Sponsors Matching Fund

Did you know GitHub matches your sponsorship?

Sponsor now via GitHub to double the impact of your support.

Interested in freelance work?

I'm open to freelance WordPress opportunities. Contact me via the contact form here or email [email protected].

Want to contribute in other ways?

Reach out to: Tang Rufus

Feedback

We welcome your feedback! It helps us improve the library for future projects. Please submit an issue to share your thoughts, or feel free to fork the project and suggest changes. No feedback is too minor.

Security

Report any security issues directly to [email protected], rather than using the issue tracker.

Credits

The Trellis New Relic PHP Agent is a project by Typist Tech and is maintained by Tang Rufus, a freelance developer available for hire.

You can find the full list of contributors here.

Special thanks to the Roots team for creating Trellis, which made this project possible.

Contributing

For more details, please refer to the CODE_OF_CONDUCT.

License

The Trellis New Relic PHP Agent is licensed under the MIT License.

Informazioni sul progetto

Install New Relic PHP agent on Trellis servers

Installa
ansible-galaxy install TypistTech.trellis-newrelic-php
Licenza
mit
Download
5.6k
Proprietario