running user code under a single app?

I am working on running user code in Fly VMs (a la Run User Code on Fly Machines · Fly Docs). I’ve also searched this forum for similar topics.

When a user creates an account, I will provision them with a VM that runs an HTTP server. The server is based on Deno and takes a request + code payload and executes it in Python or JS using Deno.command(). Users can set dependencies (e.g. requirements.txt), and when they save it will “deploy” the machine with a new dockerfile and the dependencies. A deploy is not required to run code because it’s a server. Each user needs their own VM so that they can’t compromise someone else’s enviroment.

What I would like to do is something like:

  1. Deploy an app “code-runner”
  2. Every time a user signs up deploy a machine “${userID}” that has the code-runner image and lives under the code-runner app.
  3. Re-deploy that machine when a user changes their dependencies (using updated dependencies, e.g. python packages).
  4. When a user executes code, route it to the right machine (e.g. using a custom URL or fly-replay or something to make sure it gets routed to the right machine).

It seems to me like this approach is not possible or discouraged because:

  • In order to get a new IP address you need an app (as opposed to a machine).
  • There are a lot of caveats about machines in the same region for an app.
  • fly-replay isn’t designed for this and may not work.
  • fly deploy works at the app level

I’m still new to Fly, so please forgive any inaccuracies. Thanks for your help!

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