Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow reflex run to support non interactive mode #2859

Open
PasqualePuzio opened this issue Mar 14, 2024 · 7 comments
Open

Allow reflex run to support non interactive mode #2859

PasqualePuzio opened this issue Mar 14, 2024 · 7 comments
Labels
enhancement Anything you want improved good first issue Good for newcomers

Comments

@PasqualePuzio
Copy link

PasqualePuzio commented Mar 14, 2024

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

@ElijahAhianyo
Copy link
Collaborator

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

@PasqualePuzio
Copy link
Author

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.

@picklelo
Copy link
Contributor

@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
Copy link
Author

@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?

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).

@picklelo
Copy link
Contributor

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.

@PasqualePuzio
Copy link
Author

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.

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.

@picklelo
Copy link
Contributor

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.

@picklelo picklelo added enhancement Anything you want improved good first issue Good for newcomers labels Mar 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Anything you want improved good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants