Setting up Multiple Fly Processes

I’m currently working on a project that involves serving a web app (built with nodeJS) that connects to a SQLite database. Additionally, there’s a separate jobs process (also nodeJS) responsible for writing data to the database. While the web app mostly performs read operations on the database, there are occasional write operations, although they are not frequent.

I’m considering migrating the application to Fly, but I came across some information in the documentation stating that each Fly Volume belongs to a specific Fly App and cannot be shared between apps. As a workaround, I discovered that it’s possible to run multiple process groups within a single app, which seems like a viable solution.

However, I have concerns regarding the restart of both processes upon each new deployment. I was wondering if anyone could provide me with a sample Fly config to properly set up multiple process groups communicating with a SQLite volume. Any advice or suggestions would be greatly appreciated.

The following page lists several options: Running Multiple Processes Inside A App · Fly Docs

The first option (Process groups) won’t work for you.

For node, concurrently is perhaps the simplest approach. In your package.json create a script for your webapp, and a script for your jobs, and then change your start script to be something like:

   "start": "concurrently --kill-others-on-fail npm:webapp npm:jobs"

Thanks for replying. If I run the processes concurrently then they’ll both get reset on every new deploy, correct? Also, I’m trying to understand why process groups won’t work for my case. Can you please elaborate on your point?


Machines can’t share a volume. Each member of a process group is a machine.

If you can structure things so that all writes are done by one machine, LiteFS - Distributed SQLite · Fly Docs can be used to propagate those updates to the remaining machines.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.