immudb
immudb copied to clipboard
Running as a service - mac
What happened
I want to run immudb as a service on macOS 11.2.3, I am following official docs It is failing when I run immudb service install
in terminal. Below is the log:
xeuser@AE_C02Z94A6LVCG ~ % sudo immudb service install
Error: exec: "groupadd": executable file not found in $PATH
Usage:
immudb service [install uninstall start stop restart status] [flags]
Examples:
Install the immutable database
sudo ./immudb service install - Installs the daemon
sudo ./immudb service stop - Stops the daemon
sudo ./immudb service start - Starts initialized daemon
sudo ./immudb service restart - Restarts daemon
sudo ./immudb service uninstall - Removes daemon and its setup
Uninstall immudb after 20 second
sudo ./immudb service install --time 20 immudb
Flags:
-h, --help help for service
-t, --time int number of seconds to wait before stopping | restarting the service
Global Flags:
--config string config file (default path are configs or $HOME. Default filename is immudb.toml)
exec: "groupadd": executable file not found in $PATH
As far as I understand it is trying to use linux command groupadd
but that doesnot exists in mac due to security reasons.
What you expected to happen
It was expected to be installed without issues, it could perhaps use currently logged in user instead of trying to run groupadd
How to reproduce it (as minimally and precisely as possible)
Run sudo immudb service install
in macOS after setting immudb path in .bashrc
or .zshrc
Environment
xeuser@AE_C02Z94A6LVCG ~ % immudb version
immudb 1.0.0
Commit : fb5398fe7b7d69dd352685d477fbd01a86b64568
Built by: [email protected]
Built at: Fri, 21 May 2021 16:29:30 IST
Thanks for the report.
IMHO, The immediate fix would be to have immuos layer use dscl
on MacOS. I don't get how service install ever worked on MacOS.
However, I wonder if we can get out of the user management business completely.
- On Linux use systemd
DynamicUser
(which is what I am doing in this experimental package) - On MacOS create services by the user installing the service, as we do not expect production workloads here
- On Windows ???>
@padurean @mmeloni what do you think?
@dmacvicar AFAIK running immudb as a service in MacOS never worked. It was assumed no one runs production servers on MacOS, hence the feature is not really needed.
Your suggestions sound good for me, although for Windows we still need to define and decide the approach.
I agree with @dmacvicar & @padurean . We almost never use MacOS for production, it is most likely ubuntu or linux I guess. But we developers might want to setup development environment just like production so that we can consider potential issues might occur when deploying in cloud virtual machine.
It will be easy to fix. https://github.com/codenotary/immudb/tree/master/cmd/sservice is os/customizable .
yep and then https://github.com/codenotary/immudb/tree/master/cmd/immudb/command/service/config
fwiw, just added a service to Homebrew, so users can do:
brew install immudb
brew services start immudb
Ref: https://github.com/Homebrew/homebrew-core/pull/92428
Homebrew
thanks a lot @ankane!