How to clone existing machine into different app?

Hi team, Need some help with below queries

Basically I want to run some nodejs code in flyio machine and then clone that state into a new machine in different app. Basically I want to have 2 machines in 2 apps which will evolve differently and have 2 separate URLs. Is that possible with fly clone ?

If that is not possible, Is it possible to run 2 node processes in FlyIO machine on different ports and expose 2 separate URLS, one listening on port1 and another on port 2

Yes, probably, though it depends on what you mean. Could you give an example of what part of a machine’s state you’d like to clone? In narrow terms, yes, a virtual machine’s running state can be cloned, but that is often overkill and the actual problem is simpler.

For example, let’s say you have an app running an AI conversation bot. You adjust some settings on it, and give it some knowledge by interacting with it. You then decide you want to clone the app, but in fact the only thing that has changed is the config and the AI learning. So you just launch a new app on the same container, and find a way to clone the config from the first into the second (maybe by pushing a JSON request from one to the other).

I fear I may not have understood your request though, so perhaps you could say if this is close to what you are after.

So the idea is that, I clone a repo + install some packages in a container.

I want to check if there is a way to take snapshot of the running container ( equivalent of Docker commit ) and deploy a new app with that image

Current clone command in flyio ctl enables cloning a machine within same app. I want to clone a machine from app1 into a brand new app.

Ah, that’s most interesting. I didn’t know there was that restriction. I’ve been peeking at the source and I wonder if a clone is really just a read and then a very explicit create.

Do you mean application packages e.g. from Composer or NPM etc? Or are these operating system packages from Yum or Apt? In the former case I wouldn’t bother with a clone; I’d just use a regular machine create operation, and use the config → files JSON property to write any number of files on top of your pristine image.

That said, in either case, you could just replay the installations in the new image in an initialisation phase, either using an in-image feature, or via SSH commands from another machine.

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