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 my-domain.com and calls to my-domain.com/api 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 https://coderwall.com/p/ttrhow/deploying-rails-app-using-nginx-puma-and-capistrano-3 has worked for me all the time.