How to deploy a Rails API Server and Ionic App to an Ubuntu 20.04 VPS using Capistrano and Passenger

I have an Ionic Angular App which makes requests to a Rails Api server.

On my local development machine everything works fine. The Rails Api server is accessible via localhost:3000/api which the app makes calls to.

Now I want to deploy the app and the rails server to the same machine where my app runs on and calls to should be proxied to the rails api server.

Tried following instructions for passenger and capistrano but information is limited to “normal” rails apps and doesn’t work for my situation where a front-end nodejs app and the rails api server are running on the same machine.

What is the proper procedure to follow?

Should I be using a different tool?

I am not sure about passenger, but this Deploying Rails app using Nginx, Puma and Capistrano 3 (Example) has worked for me all the time.