Allow reflex run to support non interactive mode
Right now, if reflex is already running and you execute reflex run (either in prod mode or not), the tool shows a prompt and lets you decide whether you want to kill the current process, change it or exit.
First of all, I think it would be useful for production use-cases (where you want to achieve zero downtime) to add a command line argument in order to disable interactive mode and force the system to kill (or change) any previously running processes.
Also, I was wondering what's exactly the difference between kill and change? How do they affect the running processes? Do you have any recommendations to avoid downtime when running a new version of the app?
Thanks
Hey @PasqualePuzio Thanks for bringing this up. We recently merged in this PR https://github.com/reflex-dev/reflex/pull/2867 that looks for the next available slot. Check this out and let me know your thoughts
Hey @PasqualePuzio Thanks for bringing this up. We recently merged in this PR #2867 that looks for the next available slot. Check this out and let me know your thoughts
Hi @ElijahAhianyo thank you for pointing that out. However that doesn't actually answer my question/concern. When running in production, you want to keep downtime to zero when updating the app, which could happen several times a day. If you want to deploy a new version of the app in a non-interactive way, if i'm not missing anything, right now there's no way to bypass the prompted question which requires you to enter k (kill), c (change) or n (cancel). Another way to achieve that could be to run the app within a container so that when you have to do an update you can just spin up a new instance and replace the old instances when the new ones are up and running.
Please let me know if i've been clear enough or not.
@PasqualePuzio the PR linked above #2867 removes those interactive options (there will be no more kill/change options in the next release) and just starts your app on a new available port, so there should be no more interactive mode in reflex run from 0.4.7. LMK if that answers your question.
The reflex init command does have interactivity with the template selection, but you can pass in --template blank on that step if needed.
When you say deploy, you mean to a hosting provider? In that case how are there multiple apps running together?
@PasqualePuzio the PR linked above #2867 removes those interactive options (there will be no more kill/change options in the next release) and just starts your app on a new available port, so there should be no more interactive mode in
reflex runfrom 0.4.7. LMK if that answers your question.The
reflex initcommand does have interactivity with the template selection, but you can pass in--template blankon that step if needed.When you say deploy, you mean to a hosting provider? In that case how are there multiple apps running together?
Sure, I agree with you.
However I was raising the issue because in a production environment you really dont' want to change the port because that means you have to change the configuration of the load balancer or reverse proxy as well (nginx for instance).
Got it - we could have a flag in reflex run to specify that it should try to run on the default port and kill any other process on that port, seems like that would solve your use case.
Got it - we could have a flag in
reflex runto specify that it should try to run on the default port and kill any other process on that port, seems like that would solve your use case.
yes, that would be great. It would be even better if that could be done with zero downtime, so that both the frontend and the backend never stop responding.
Not sure if we can accomplish the zero downtime requirement easily, will have to think more on that. But yes we can add a flag that makes sure it uses the default port rather than auto changing.
We no longer prompt when the port is taken and automatically change the port.