Replies: 9 comments 15 replies
-
I vote for the daemonization functionality within the SurrealDB command-line tool. |
Beta Was this translation helpful? Give feedback.
-
Hello @tobiemh |
Beta Was this translation helpful? Give feedback.
-
Hello @tobiemh Currently in deb distros we use Makefile and deb tools to build debian packages, is a lot more complex, but its not hard Luckily in rust ecosystem we have the best tooling, and in this case we have cargo-deb With that we build the Debian package, with manifest and systemd service too, but in a friendly easy way I can start prepare everything for next release alpha6 that I suspect is comming soon :) We install and thats all, service will be running in background like all others sshd, samba, bind etc we use it like # install
$ sudo dpkg -i surrealdb.deb
# enable service and start service
$ systemctl enable --now surrealdb
# start
$ systemctl start surreald
# stop
$ systemctl stop surrealdb
etc I think I have time to do it later, and make a PR If surrealdb have a exposed log file please sent me the location, like /var/log/surrealdb.log We can have env variables in systemd service, to tweak systemd service to, like port etc, this way we can override port 8080, but for this think about a free port like 8228 |
Beta Was this translation helpful? Give feedback.
-
Personally, I don't like to install a package. I always prefer single binary and in my opinion daemonization functionality within the SurrealDB command-line tool is the right solution. |
Beta Was this translation helpful? Give feedback.
-
Hello @ansarizafar I understand your preferences But systemd service has other things like start service on reboot, is more user friendly, we can see logs, start, stop, enable, disable services, and this is what is used in linux distros everywhere But there is some binariea that have a flag for run in background to like -d etc In this case this solution is just a option for debian releases, and I think @tobiemh is open for other options to What is your OS? @ansarizafar in nix we can run commands in background, |
Beta Was this translation helpful? Give feedback.
-
Are there any updates about daemonization?I would like to use SurrealDB on production but I have concerns about when the server crash etc.
I agree, is it will be better if it can handle the demonization binary itself. |
Beta Was this translation helpful? Give feedback.
-
There are several aspects to this conversation
For the native support, it should be easy enough to add by using the POSIX For the install script, it looks like we would follow what @koakh has been proposing. For the systemctl script, we could definitely add this. I would also like to add that there is the option to call |
Beta Was this translation helpful? Give feedback.
-
I would encourage you to use any of the init systems provided by your operating system. If the Surreal CLI spawns the SurrealDB server and lets it run in the background, you lost control over it. Nothing will start it again in case something happens to it: server reboots, the kernel kills it because of OutOfMemory, it simply crashes... that's why the OSes provide Systemd and similar systems. |
Beta Was this translation helpful? Give feedback.
-
hello buddies in the past I use I thing is not a good practice, and a no way to go, we will pollute the surrealdb project with stuff that is not useful there (IMHO) maybe we can create a project with Makefiles and scripts to package the different formats When I have some free time, I can do the scripts for a .deb from a surrealdb stable binary, both can share systemd service etc when I arrive at home I can check my cargo-deb work that I made almost 14 months, what are your opinion? |
Beta Was this translation helpful? Give feedback.
-
It would be useful to be able to start the SurrealDB server in the background, and use the SurrealDB command-line tool to stop the server in the background.
The first way to handle this would be to use the default shell syntax to start the server in the background and redirect the stdout to a logfile. We could then create a surreal-ctl command-line tool for managing the shell arguments easier.
Alternatively we could implement the daemonization functionality within the SurrealDB command-line tool itself, so that we don't have to create a separate command-line tool for managing the background process (using https://crates.io/crates/daemonize for example) with the following commands added:
and stop it with
Beta Was this translation helpful? Give feedback.
All reactions