I have two separate web api code written using express.js from two different repositories and would like to automatically deploy it to the Ubuntu 20.04 on a single instance on different ports using pm2 with gitlab CI/CD. I tried it that way but when one server is up another server said nginx 502 Bad Gateway and seem like it can't process multiple WebApi within 1 server with Gitlab CICD.
What would be the possible .gitlab-ci.yml script for each repo if each of ecosystem.config.js is like this
module.exports = {
apps: [
{
name: 'API A',
script: 'index.js',
env: {
PORT: 3000,
},
},
],
};
or is there another better alternative way?