A Firefox web extension for working with PM2.
PM2 DevTools adds a new Developer Tools panel. Some of its main capabilities include:
- List, filter, and manage running processes. Processes can be started and stopped right in the panel.
- View a live stream of logs. Search by string or regexp, exclude by process.
- Set up scripts that can be executed directly in specific web pages using log data.
- Ensure your PM2 services are running.
- PM2 WebSocket needs to be set up and running in order to receive new PM2 logs.
- Download the extension from Firefox Add-ons.
- Or, get it from the Releases page, but you'll need to install it from
about:debugging
.
- Or, get it from the Releases page, but you'll need to install it from
- Once installed you'll see a new Developer Tools PM2 tab. Open that and start exploring.
Manage general settings from the top-right corner of the PM2 Developer Tools panel.
The URL where the extension can connect to the PM2 WebSocket Server. Changing this will cause the extension to attempt to re-connect to the WebSocket.
How many log items to render. All logs are kept in memory until the extension is closed. This setting is mostly for performance as thousands of logs streaming in can slow things down.
When enabled, logs will start rendering as soon as the WebSocket server is connected. Enable this to allow Log Scripts to be executed in the background (i.e. without the Developer Tools panel open).
Manage Log Scripts from the bottom-right corner of the PM2 Developer Tools panel.
Log Scripts are JavaScript snippets that can be executed when PM2 logs are broadcast. When the extension's background script receives a new log event it will check to see if any Log Scripts have matching URLs and then execute the script's code, which will have access to the log's data, directly on the page.
These are the script's options:
This can be used to turn off a Log Script without deleting it. Uncheck and the script will stop executing on the page (after you save).
The name of the Log Script. Only used for reference.
Which pages should this script run on?
This field is evaluated using minimatch, so globs are supported.
The code to be executed on the page, evaluated directly in the webpage. Be careful, this really does execute anything.
The data
object is available in the scope of the function and contains the log payload. You can use information from this, such as process name or ID, to further restrict when code is executed on the page.
See an example log payload:
{
"message": "some output from the service",
"timestamp": 1619810341487,
"pmId": 15,
"name": "auth-db"
}
- Clone the package
yarn install
to install dependenciesyarn start
to start developingyarn build
build and zip a production package
MPL-2.0