{"id":18817307,"url":"https://github.com/typisttech/trellis-newrelic-php","last_synced_at":"2025-04-13T23:01:26.321Z","repository":{"id":46864215,"uuid":"102819426","full_name":"typisttech/trellis-newrelic-php","owner":"typisttech","description":"Install New Relic PHP agent on Trellis servers","archived":false,"fork":false,"pushed_at":"2024-06-17T02:42:00.000Z","size":94,"stargazers_count":24,"open_issues_count":4,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-30T13:03:45.804Z","etag":null,"topics":["ansible","ansible-galaxy","monitoring","newrelic","trellis","wordpress","wordpress-deployment"],"latest_commit_sha":null,"homepage":"https://typist.tech/portfolio-item/trellis-newrelic-php/","language":"Jinja","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/typisttech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-08T04:59:03.000Z","updated_at":"2023-10-31T20:47:36.000Z","dependencies_parsed_at":"2023-02-16T06:40:18.682Z","dependency_job_id":null,"html_url":"https://github.com/typisttech/trellis-newrelic-php","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typisttech%2Ftrellis-newrelic-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typisttech%2Ftrellis-newrelic-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typisttech%2Ftrellis-newrelic-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typisttech%2Ftrellis-newrelic-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/typisttech","download_url":"https://codeload.github.com/typisttech/trellis-newrelic-php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248794565,"owners_count":21162614,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","ansible-galaxy","monitoring","newrelic","trellis","wordpress","wordpress-deployment"],"created_at":"2024-11-08T00:10:49.305Z","updated_at":"2025-04-13T23:01:26.287Z","avatar_url":"https://github.com/typisttech.png","language":"Jinja","funding_links":["https://github.com/sponsors/TangRufus"],"categories":[],"sub_categories":[],"readme":"# Trellis New Relic PHP Agent\n\n[![Ansible Role](https://img.shields.io/ansible/role/20311?style=flat-square)](https://galaxy.ansible.com/TypistTech/trellis-newrelic-php)\n[![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/TypistTech/trellis-newrelic-php?style=flat-square)](https://github.com/TypistTech/trellis-newrelic-php/releases)\n[![Ansible Role](https://img.shields.io/ansible/role/d/20311?style=flat-square)](https://galaxy.ansible.com/TypistTech/trellis-newrelic-php)\n[![Ansible Quality Score](https://img.shields.io/ansible/quality/20311?style=flat-square)](https://galaxy.ansible.com/TypistTech/trellis-newrelic-php)\n[![GitHub](https://img.shields.io/github/license/TypistTech/trellis-newrelic-php.svg)](https://github.com/TypistTech/trellis-newrelic-php/blob/master/LICENSE.md)\n[![GitHub Sponsor](https://img.shields.io/badge/Sponsor-GitHub-ea4aaa)](https://github.com/sponsors/TangRufus)\n[![Sponsor via PayPal](https://img.shields.io/badge/Sponsor-PayPal-blue.svg)](https://typist.tech/donate/trellis-newrelic-php/)\n[![Hire Typist Tech](https://img.shields.io/badge/Hire-Typist%20Tech-ff69b4.svg)](https://typist.tech/contact/)\n[![Twitter Follow @TangRufus](https://img.shields.io/twitter/follow/TangRufus?style=flat-square\u0026color=1da1f2)](https://twitter.com/tangrufus)\n\n\nInstall [New Relic PHP agent](https://docs.newrelic.com/docs/agents/php-agent) on [Trellis](https://github.com/roots/trellis) servers.\n\n## Role Variables\n\n```yaml\n# group_vars/\u003cenvironment\u003e/vault.yml\n# This file should be encrypted. See: https://roots.io/trellis/docs/vault/\n##########################################################################\n\n# New Relic License Key\n## See: https://docs.newrelic.com/docs/accounts-partnerships/accounts/account-setup/license-key\nvault_newrelic_license: xxxxxxxxxxx\n\n# group_vars/\u003cenvironment\u003e/main.yml\n###################################\n\n# Indicates the desired package state.\n# `latest` ensures that the latest version is installed.\n# `present` does not update if already installed.\n# Choices: present|latest\n# Default: latest\nnewrelic_package_state: present\n\n# Check for default values here: https://github.com/TypistTech/trellis-newrelic-php/blob/master/defaults/main.yml\n# See also: https://docs.newrelic.com/docs/agents/php-agent/configuration/php-agent-configuration\nnewrelic_config:\n  appname: \"My Awesome App {{ env }}\"\n  framework: no_framework\n  transaction_tracer.detail: 1\n  datastore_tracer.database_name_reporting.enabled: true\n```\n\n## Hacking Trellis' Playbook\n\nAdd this role to `dev.yml` and `server.yml` **immediately after** `role: php`:\n\n```diff\n  # `dev.yml` \u0026 `server.yml`\n\n  roles:\n      # Some other Trellis roles ...\n      - { role: php, tags: [php] }\n+     - { role: TypistTech.trellis-newrelic-php, tags: [php, newrelic-php] }\n      # Some other Trellis roles ...\n```\n\n## Requirements\n\n* [Ansible](http://docs.ansible.com/ansible/latest/intro_installation.html) v2.7 or later\n* Python v3.7.6 or later\n* [Trellis](https://github.com/roots/trellis) v1.3.0 or later\n* [New Relic](https://newrelic.com/) account\n\n## Installation\n\nAdd this role to `galaxy.yml`:\n\n```yaml\n- src: TypistTech.trellis-newrelic-php # Case-sensitive!\n  version: XXX.YYY.ZZZ # Check for latest version!\n```\n\nRun `$ trellis galaxy install` to install this new role.\n\n\n## Common Errors\n\n### `vault_newrelic_license` is not defined\n\nEncrypt your New Relic license key in `group_vars/\u003cenvironment\u003e/vault.yml`. See [role variables](#role-variables).\n\n### New Relic merges multiple environments into single application\n\nSolution: Define different `appname` for different environments.\n\nTips:\n```yaml\n# group_vars/all/main.yml\n#########################\n\nnewrelic_config:\n  appname: \"My Awesome App {{ env }}\"\n```\n\n### Error after upgrading PHP version\n\nNew Relic would fail and causes provision end up in errors when upgrading PHP major or minor releases (e.g: from 7.4 to 8.0, from 8.0 to 8.1).\n```\nnon-zero return code\nPHP Warning:  PHP Startup: Unable to load dynamic library 'newrelic.so'\n(tried: /usr/lib/php/20180731/newrelic.so (/usr/lib/php/20180731/newrelic.so:\ncannot open shared object file: No such file or directory),\n/usr/lib/php/20180731/newrelic.so.so (/usr/lib/php/20180731/newrelic.so.so:\ncannot open shared object file: No such file or directory)) in Unknown on\n```\n\nAfter each PHP major or minor release upgrade (i.e: when you see the above error):\n```bash\n# For multi-server setups, perform the following steps on each server.\nssh admin@123.456.789\nsudo newrelic-install install\nsudo reboot\n\n# Wait for the server(s) to reboot and then re-provision\n# For multi-server setups, you only need to re-provision once only\ntrellis provision production\n```\n\n## Limitations\n\n* Only one New Relic APM application per server by default.\n\n[`Extends`](https://jinja.palletsprojects.com/en/2.10.x/templates/#template-inheritance) the [`fastcgi_basic` block](https://github.com/roots/trellis/blob/73cbfb9ff840b7b55b60c77ee7d655c54211dbc1/roles/wordpress-setup/templates/wordpress-site.conf.j2#L236-L241) to include `fastcgi_param PHP_VALUE \"newrelic.appname={{ item.key }} ({{ env }})\";` right after the line `include fastcgi_params;` to work around this limitation.\n\nPull requests are welcomed.\n\n## FAQs\n\n### It looks awesome. Where can I find some more goodies like this?\n\n* Articles on Typist Tech's [blog](https://typist.tech)\n* [Tang Rufus' WordPress plugins](https://profiles.wordpress.org/tangrufus#content-plugins) on wp.org\n* More projects on [Typist Tech's GitHub profile](https://github.com/TypistTech)\n* Stay tuned on [Typist Tech's newsletter](https://typist.tech/go/newsletter)\n* Follow [Tang Rufus' Twitter account](https://twitter.com/TangRufus)\n* Hire [Tang Rufus](https://typist.tech/contact) to build your next awesome site\n\n### This package isn't on wp.org. Where can I give a :star::star::star::star::star: review?\n\nThanks! Glad you like it. It's important to let me know somebody is using this project. Since this is not hosted on wordpress.org, please consider:\n\n- :heart: [sponsor](https://github.com/sponsors/TangRufus) this project\n- :star: star this [Github repo](https://github.com/TypistTech/trellis-newrelic-php)\n- :eyes: [watch](https://github.com/TypistTech/trellis-newrelic-php/subscription) this Github repo\n- tweet something good with mentioning [@TangRufus](https://twitter.com/tangrufus)\n- write blog posts\n- submit [pull requests](https://github.com/TypistTech/trellis-newrelic-php)\n- [hire me](https://typist.tech/)\n\n## Sponsoring :heart:\n\nLove `trellis-newrelic-php`? Help me maintain it, a [sponsorship here](https://typist.tech/donation/) can help with it.\n\n### GitHub Sponsors Matching Fund\n\nDo you know [GitHub is going to match your sponsorship](https://help.github.com/en/github/supporting-the-open-source-community-with-github-sponsors/about-github-sponsors#about-the-github-sponsors-matching-fund)?\n\n[Sponsor now via GitHub](https://github.com/sponsors/TangRufus) to double your greatness.\n\n### Why don't you hire me?\n\nReady to take freelance WordPress jobs. Contact me via the contact form [here](https://typist.tech/contact/) or, via email [info@typist.tech](mailto:info@typist.tech)\n\n### Want to help in other way? Want to be a sponsor?\n\nContact: [Tang Rufus](mailto:tangrufus@gmail.com)\n\n## Feedback\n\n**Please provide feedback!** We want to make this library useful in as many projects as possible.\nPlease submit an [issue](https://github.com/TypistTech/trellis-newrelic-php/issues/new) and point out what you do and don't like, or fork the project and make suggestions.\n**No issue is too small.**\n\n## Security\n\nIf you discover any security related issues, please email [trellis-newrelic-php@typist.tech](mailto:trellis-newrelic-php@typist.tech) instead of using the issue tracker.\n\n## Credits\n\n[Trellis New Relic PHP Agent](https://github.com/TypistTech/trellis-newrelic-php) is a [Typist Tech](https://typist.tech) project and maintained by [Tang Rufus](https://twitter.com/TangRufus), freelance developer for [hire](https://www.typist.tech/contact/).\n\nFull list of contributors can be found [here](https://github.com/TypistTech/trellis-newrelic-php/graphs/contributors).\n\nSpecial thanks to [the Roots team](https://roots.io/about/) whose [Trellis](https://github.com/roots/trellis) make this project possible.\n\n\n## Contributing\n\nPlease see [CODE_OF_CONDUCT](./CODE_OF_CONDUCT.md) for details.\n\n## License\n\n[Trellis New Relic PHP Agent](https://github.com/TypistTech/trellis-newrelic-php) is released under the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypisttech%2Ftrellis-newrelic-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftypisttech%2Ftrellis-newrelic-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypisttech%2Ftrellis-newrelic-php/lists"}