The Percona Monitoring and Management (PMM) Amazon Machine Image (AMI) currently lacks native support for ENV variables. In this guide, we’ll walk through a straightforward workaround that simplifies the process of using ENV variables in PMM AMI and reapplying them after an upgrade.
/srv/.envBegin by consolidating your ENV variables in the /srv/.env file. Edit the file and add your variables, like so:
|
1 |
PMM_DEBUG=1<br>DATA_RETENTION=2160h |
systemctl edit for systemd serviceTo avoid directly modifying the /usr/lib/systemd/system/supervisord.service file, which could be overwritten during system upgrades, leverage systemctl edit for a more sustainable approach. Open a terminal and run:
|
1 |
sudo systemctl edit supervisord.service |
|
1 |
[Service]<br>EnvironmentFile=/srv/.env |
After applying the changes, restart the supervisord service:
|
1 |
sudo systemctl daemon-reload<br>sudo systemctl restart supervisord |
While PMM currently rewrites /usr/lib/systemd/system/supervisord.service on each upgrade, the modifications made using systemctl edit remain safeguarded.
By adopting the systemctl edit approach, your ENV variable setup remains intact, offering a cleaner and more maintainable configuration for your PMM AMI.
Percona Monitoring and Management is a best-of-breed open source database monitoring solution. It helps you reduce complexity, optimize performance, and improve the security of your business-critical database environments, no matter where they are located or deployed.
Resources
RELATED POSTS