{"id":844,"date":"2021-05-02T09:04:03","date_gmt":"2021-05-02T03:34:03","guid":{"rendered":"https:\/\/cenacle.io\/?p=644"},"modified":"2024-06-20T02:22:24","modified_gmt":"2024-06-20T02:22:24","slug":"launching-multiple-instances-of-postgraphile-with-pm2","status":"publish","type":"post","link":"https:\/\/gk.palem.in\/articles\/launching-multiple-instances-of-postgraphile-with-pm2\/","title":{"rendered":"Launching multiple instances of PostGraphile with PM2"},"content":{"rendered":"\n<p>PM2 allows you to restart your application instances if they stop for any internal reason. A typical way to launch the PostGraphile with <span style=\"color: #cf2e2e;\" class=\"ugb-highlight\">PM2 <\/span>is as below:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"pm2 start --name &quot;postgraphile&quot; 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\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #88C0D0\">pm2<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">start<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">--name<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">postgraphile<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">postgraphile<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">--<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">--append-plugins<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">postgraphile-plugin-connection-filter<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">-c<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">postgres:\/\/user:password@localhost:15432\/db<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">-s<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">public<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">-a<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">-j<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">-n<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">0.0<\/span><span style=\"color: #A3BE8C\">.0.0<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">-p<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">15433<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">--enhance-graphiql<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">--disable-query-log<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">--no-ignore-indexes<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">--simple-collections<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">both<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>The<span style=\"color: #cf2e2e;\" class=\"ugb-highlight\"> postgraphile-plugin-connection-filter<\/span> plugin can be installed with command as below:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"npm install -g tslib postgraphile-plugin-connection-filter postgraphile\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #88C0D0\">npm<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">install<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">-g<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">tslib<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">postgraphile-plugin-connection-filter<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">postgraphile<\/span><\/span><\/code><\/pre><\/div>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img width=\"1237\" height=\"123\" data-public-id=\"gk.palem.in\/wp_assets\/pm2\/pm2.jpg\" decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/cenacle-cdn\/images\/w_1237,h_123,c_scale\/v1715779372\/gk.palem.in\/wp_assets\/pm2\/pm2.jpg?_i=AA\" alt=\"\" style=\"width:928px;height:92px\" class=\"wp-post-0 wp-image-849\" data-format=\"jpg\" data-transformations=\"\" data-version=\"1715779372\" data-seo=\"1\" data-responsive=\"1\" srcset=\"https:\/\/res.cloudinary.com\/cenacle-cdn\/images\/w_1237,h_123,c_scale\/v1715779372\/gk.palem.in\/wp_assets\/pm2\/pm2.jpg?_i=AA 1237w, https:\/\/res.cloudinary.com\/cenacle-cdn\/images\/w_1088,h_108,c_scale\/v1715779372\/gk.palem.in\/wp_assets\/pm2\/pm2.jpg?_i=AA 1088w, https:\/\/res.cloudinary.com\/cenacle-cdn\/images\/w_768,h_76,c_scale\/v1715779372\/gk.palem.in\/wp_assets\/pm2\/pm2.jpg?_i=AA 768w, https:\/\/res.cloudinary.com\/cenacle-cdn\/images\/w_448,h_44,c_scale\/v1715779372\/gk.palem.in\/wp_assets\/pm2\/pm2.jpg?_i=AA 448w\" sizes=\"(max-width: 1237px) 100vw, 1237px\" \/><\/figure>\n<\/div>\n\n\n<p>However, if you have multiple databases that need <span style=\"color: #cf2e2e;\" class=\"ugb-highlight\">PostGraphile<\/span>, 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:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#292D3E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"\/\/ content of pm2.config.js file\nmodule.exports = {\n   &quot;apps&quot;: [\n     {\n       &quot;name&quot;: &quot;postgraphile-mimic&quot;,\n       &quot;script&quot;: &quot;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&quot;,\n       &quot;env&quot;: {\n         &quot;PGUSER&quot;: &quot;user&quot;,\n         &quot;PGPASSWORD&quot;: &quot;password&quot;,\n         &quot;PGPORT&quot;: 15432,\n       }\n     },\n     {\n       &quot;name&quot;: &quot;postgraphile-fup&quot;,\n       &quot;script&quot;: &quot;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&quot;,\n       &quot;env&quot;: {\n         &quot;PGUSER&quot;: &quot;user&quot;,\n         &quot;PGPASSWORD&quot;: &quot;password&quot;,\n         &quot;PGPORT&quot;: 15432,\n       }\n     }\n   ]\n }\" style=\"color:#babed8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki material-theme-palenight\" style=\"background-color: #292D3E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #676E95; font-style: italic\">\/\/ content of pm2.config.js file<\/span><\/span>\n<span class=\"line\"><span style=\"color: #89DDFF\">module.exports<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">=<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">   <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #F07178\">apps<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">:<\/span><span style=\"color: #BABED8\"> [<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">     <\/span><span style=\"color: #89DDFF\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">       <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #F07178\">name<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">:<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">postgraphile-mimic<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">       <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #F07178\">script<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">:<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">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<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">       <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #F07178\">env<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">:<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">         <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #F07178\">PGUSER<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">:<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">user<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">         <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #F07178\">PGPASSWORD<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">:<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">password<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">         <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #F07178\">PGPORT<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">:<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #F78C6C\">15432<\/span><span style=\"color: #89DDFF\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">       <\/span><span style=\"color: #89DDFF\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">     <\/span><span style=\"color: #89DDFF\">},<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">     <\/span><span style=\"color: #89DDFF\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">       <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #F07178\">name<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">:<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">postgraphile-fup<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">       <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #F07178\">script<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">:<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">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<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">       <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #F07178\">env<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">:<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">         <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #F07178\">PGUSER<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">:<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">user<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">         <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #F07178\">PGPASSWORD<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">:<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">password<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">         <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #F07178\">PGPORT<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">:<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #F78C6C\">15432<\/span><span style=\"color: #89DDFF\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">       <\/span><span style=\"color: #89DDFF\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">     <\/span><span style=\"color: #89DDFF\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">   ]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Launch the apps as below:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"pm2 start pm2.config.js\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #88C0D0\">pm2<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">start<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">pm2.config.js<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Now use the command <code><span style=\"color: #9b51e0;\" class=\"ugb-highlight\">pm2 list<\/span><\/code> to observe the status of the launched applications.<\/p>\n\n\n\n<p>If you are interested in gaining experience in working on cutting edge technologies <a href=\"https:\/\/cenacle.io\/blog\/apply-for-live-projects-training-597\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Apply <\/strong><\/a>here.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Launching PostGraphile with PM2 allows multiple PostGres databases to be exposed through GraphQL.<\/p>\n<p>PostGraphile allows additional plugins to support advanced filtering and queries capabilities.<\/p>\n<p>However, PM2 requires special configuration to allows multiple processes with same script name to be started.<\/p>\n<p>In this post, we review the configuration required to achieve this.<\/p>\n","protected":false},"author":1,"featured_media":914,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_cloudinary_featured_overwrite":false,"fifu_image_url":"https:\/\/res.cloudinary.com\/cenacle-cdn\/image\/upload\/v1619924497\/CenacleResearch\/blog\/images\/pm2.jpg","fifu_image_alt":"Launching multiple instances of PostGraphile with PM2","footnotes":""},"categories":[69],"tags":[70,83],"class_list":["post-844","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-javascript","tag-node-js"],"jetpack_featured_media_url":"https:\/\/res.cloudinary.com\/cenacle-cdn\/image\/upload\/v1619924497\/CenacleResearch\/blog\/images\/pm2.jpg","jetpack-related-posts":[],"jetpack_shortlink":"https:\/\/wp.me\/pfLaRd-dC","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/gk.palem.in\/articles\/wp-json\/wp\/v2\/posts\/844","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gk.palem.in\/articles\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gk.palem.in\/articles\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gk.palem.in\/articles\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gk.palem.in\/articles\/wp-json\/wp\/v2\/comments?post=844"}],"version-history":[{"count":1,"href":"https:\/\/gk.palem.in\/articles\/wp-json\/wp\/v2\/posts\/844\/revisions"}],"predecessor-version":[{"id":913,"href":"https:\/\/gk.palem.in\/articles\/wp-json\/wp\/v2\/posts\/844\/revisions\/913"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gk.palem.in\/articles\/wp-json\/wp\/v2\/media\/914"}],"wp:attachment":[{"href":"https:\/\/gk.palem.in\/articles\/wp-json\/wp\/v2\/media?parent=844"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gk.palem.in\/articles\/wp-json\/wp\/v2\/categories?post=844"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gk.palem.in\/articles\/wp-json\/wp\/v2\/tags?post=844"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}