Using supervisord to manage multiple processes in an app

Hi,

You are correct in that using supervisord would indeed keep all three on the same VM, reducing cost. So you’d just need to get them to talk to each other.

My guess would be the URL you are using in Pocketbase needs modifying to use the internal, private network. The name.fly.dev hostname is normally used from outside Fly (such as your frontend React, running in a browser).

(That assumes the request goes client (React) → Express → Pocketbase. Since some databases are exposed directly to the frontend client)

If so, it sounds kind of similar to the approach I set up while back when I was messing with a web/api (in that case, it was Fastify, but the principle seems much the same). Take a look at:

… and scroll down. Notice to get it working I used:

const results = await fetch('http://fastify-api.internal:8080/api')

… so that URL is the app name, using the private internal network, on port 8080. You’d likely need something similar to connect to your database by using a URL. Note don’t copy the fly.toml directly from that thread since back then it was using V1, and Fly have since moved to V2 (machines). So their syntax is probably different.

It’s also possible you need to have the database listen on IPv6 (::), rather than IPv4 (0.0.0.0). Since Fly’s internal network uses IPv6. As you say, take it one step at a time :thinking:

1 Like