Sat. Mar 7th, 2026

PM2 allows you to restart your application instances if they stop for any internal reason. A typical way to launch the PostGraphile with PM2 is as below:

pm2 start --name "postgraphile" postgraphile -- --append-plugins postgraphile-plugin-connection-filter -c postgres://user:password@localhost:15432/db -s public -a -j -n 0.0.0.0 -p 15433 --enhance-graphiql --disable-query-log --no-ignore-indexes --simple-collections both

The postgraphile-plugin-connection-filter plugin can be installed with command as below:

npm install -g tslib postgraphile-plugin-connection-filter postgraphile

However, if you have multiple databases that need PostGraphile, then you would have to start multiple instances of it and the way to achieve with PM2 is to have a configuration file as below:

// content of pm2.config.js file
module.exports = {
   "apps": [
     {
       "name": "postgraphile-mimic",
       "script": "postgraphile --append-plugins postgraphile-plugin-connection-filter -c postgres://localhost/mimic -s mimiciii -a -j -n 0.0.0.0 -p 15433 --enhance-graphiql --disable-query-log --no-ignore-indexes --simple-collections both",
       "env": {
         "PGUSER": "user",
         "PGPASSWORD": "password",
         "PGPORT": 15432,
       }
     },
     {
       "name": "postgraphile-fup",
       "script": "postgraphile --append-plugins postgraphile-plugin-connection-filter -c postgres://localhost/fup -s public -a -j -n 0.0.0.0 -p 15434 --enhance-graphiql --disable-query-log --no-ignore-indexes --simple-collections both",
       "env": {
         "PGUSER": "user",
         "PGPASSWORD": "password",
         "PGPORT": 15432,
       }
     }
   ]
 }

Launch the apps as below:

pm2 start pm2.config.js

Now use the command pm2 list to observe the status of the launched applications.

If you are interested in gaining experience in working on cutting edge technologies Apply here.

By GK Palem

A seasoned Executive with more than two decades of experience in growing software businesses and executing large-scale enterprise projects around emerging technologies. Proven track record of commercializing R&D concepts into commercial products. Connect with GK Palem if you are trying to adapt AI or Blockchain into Genomics, Computational Biology, Healthcare Informatics, Industrial Digitial Transformation, Cross-border Trade Smart Contracts or other deep-tech solutions or R&D concepts.

Leave a Comment