Closed 1st1 closed 2 years ago
Dupe of #679?
Yes and no. The issue here is even more pronounced, because answering "no" results in our tool crashing with an error.
@tailhook
Well, this was intentional. You are expected to run start --foreground when start-conf=manual. And also we couldn't start edgedb in any other way when we supported systemd only. So I'm not sure yet if we want to change this.
Well, if this was intentional it was a questionable decision. We have to fix this. If edgedb project init
tries to run migrations automatically and fails it's a bug.
It should always run a freshly created instance. It should keep it running after edgedb prokect init
is done running. The question is about "running it automatically on login", not about whether to run it now or not.
@tailhook
Well, this was intentional. You are expected to run start --foreground when start-conf=manual. And also we couldn't start edgedb in any other way when we supported systemd only. So I'm not sure yet if we want to change this.
Well, if this was intentional it was a questionable decision. We have to fix this.
Note: it wasn't questionable decision. It was the only possible at that point.
If
edgedb project init
tries to run migrations automatically and fails it's a bug.
Note: migrations worked. Then EdgeDB failed to shutdown. So it looks like bug in EdgeDB shutdown code.
Actually there's nothing wrong with how it worked, except warnings from the EdgeDB. CLI didn't return failure or printed error. We can try swallowing all errors after sending a signal. But it's better to fix shutdown code.
It should always run a freshly created instance. It should keep it running after
edgedb prokect init
is done running. The question is about "running it automatically on login", not about whether to run it now or not.
We have to teach user how to actually run that instance. This is a good time to do that.
In my opinion, the question is more like "do you want the instance to be always running?", or even more like "do you want instance to be running in background or do you have your own script to run your app with EdgeDB?". So these are quite connected. "Run it now but don't run on login" mode looks like mostly useful for us running ad-hoc instances to test something.
And yes the question isn't specific enough. We can fix the question I think.
Update: Also note that it's --start-conf=manual
, which mean "now start manually too", I think. We can ask another question at the end of wizard, but learnability is still an argument here.
We have to teach user how to actually run that instance. This is a good time to do that.
We can ask another question at the end of wizard, but learnability is still an argument here.
No, I disagree. The installer should do the least surprising thing and have as friction-less flow as possible. Educating users shouldn't be part of it (because where do you want that education to stop?)
There's almost zero chance you'd be initializing a project and not doing anything to it in the same session. So you're requiring users to make an extra step just to educate them and this I say is a wrong way to do it.
BTW, do we have a command to make an instance start or not start on boot?
IMO:
edgedb instance start
explicitly edgedb project init
flow; users who want the "autostart on login" option shoujld configure that with a separate commandThe problem is that the question "Do you want to start instance automatically on login?" does not indicate in any way that the instance would not be started this time. FWIW, I also find it weird that an instance I'm creating would require an extra startup step, as it's almost guaranteed that I'm creating it to work on it right now. So, we either need to reword the question and add an explanation that the instance was created in stopped state and how to start it, or fix the option to start the instance automatically.
- this question isn't important enough to be part of the standard
edgedb project init
flow; users who want the "autostart on login" option shoujld configure that with a separate command
IIRC, we added it in response to complaints that users who create a bunch of project instances and then forget about them end up with a bunch of EdgeDB processes on their machine consuming lots of RAM. This would be less of a problem with 2.0 and on_demand
compiler pool, but it's still a useful option IMO.
Hot take: I think we can eat the cake and have it if we switch to socket activation of instance servers. Both systemd and launchd have support for it. Servers can auto-shutdown after a period of inactivity and will be brought up at the first request. Thoughts?
Hot take: I think we can eat the cake and have it if we switch to socket activation of instance servers. Both systemd and launchd have support for it. Servers can auto-shutdown after a period of inactivity and will be brought up at the first request. Thoughts?
+1. Can feel a bit flaky since it takes time for the server to start, but I think it's an OK compromise. What about Windows?
And yet... If we go with socket activation, I think we need to do it the right way. We should have a flag for local instances, something like "load policy". It can be "manual", "auto", or "boot". By default edgedb project init
should set it to "auto" for the new instance. But we should have a command to also change it later to a different value, like edgedb instance load-policy foo boot
or something.
There's almost zero chance you'd be initializing a project and not doing anything to it in the same session. So you're requiring users to make an extra step just to educate them and this I say is a wrong way to do it.
There is a scenario where what you're saying is true, but current behavior is not only acceptable, but also desirable:
edgedb project init
./start_app.sh
Where the latter scripts does start EdgeDB. Note: a lot of companies have scripts to start their projects in one way or another that includes bunch of things.
Also note: this is not just a matter of interactive question. --start-conf=manual
for me implies that I want to start it manually even this time.
Socket activation doesn't solve the main issue. --start-conf=manual
is very often used where systemd/launchctl doesn't work.
There is a scenario where what you're saying is true, but current behavior is not only acceptable, but also desirable:
For that ./start_app.sh
could contain something like edgedb instance start proj --silent
. But the script might not work at all if the user gave the instance a different name. I find this argument to be on the weak side here.
There is a scenario where what you're saying is true, but current behavior is not only acceptable, but also desirable:
For that
./start_app.sh
could contain something likeedgedb instance start proj --silent
.
It's more like "copy the certificates then run" or something. start
is already no-op if process is already running.
But the script might not work at all if the user gave the instance a different name. I find this argument to be on the weak side here.
Yes, actual command-line is likely: edgedb project init --server-start-conf=manual --server-instance=myapp
.
Now I'm thinking that maybe we need to split those:
--start-conf=auto
-> --start-conf=eager-start
(i.e. no socket activation)--start-conf=manual
-> --suppress-start --start-conf=eager-start
--start-conf=manual
-- do not create systemd file? (we already don't create launchd file), but start as a daemon now--start-conf=auto
-- uses socket activation, enables the serviceSo that:
--suppress-start
and doesn't care about --start-conf
--start-conf=manual
doesn't care about presense/absense of systemd/launchctl, but still starts the daemon--suppress-start
doesn't fail when systemd/launchctl can't enable service (so that next edgedb instance start
works regardless of that)With socket activation it's also unclear whether edgedb instance stop
should stop just the server or socket unit too (i.e. disable activation).
This is fixed with socket activation #745
Suppose a project has migrations. A user runs
edgedb project init
and answers "n" to “Do you want to start instance automatically on login? [y/n]”.edgedb project init
then DOESN'T start the instance and fails with applying migrations.edgedb project init
should always start the DB when it creates an instance. Whether the instance is starting with boot or not is an entirely separate matter.Also, I think there should be a default for this question set to "y".