codenotary / immudb

immudb - immutable database based on zero trust, SQL/Key-Value/Document model, tamperproof, data change history
https://immudb.io
Other
8.55k stars 343 forks source link

Running as a service - mac #813

Closed kmanadkat closed 1 year ago

kmanadkat commented 3 years ago

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: cleaversdev@gmail.com
Built at: Fri, 21 May 2021 16:29:30 IST
dmacvicar commented 3 years ago

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.

@padurean @mmeloni what do you think?

padurean commented 3 years ago

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

kmanadkat commented 3 years ago

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.

mmeloni commented 3 years ago

It will be easy to fix. https://github.com/codenotary/immudb/tree/master/cmd/sservice is os/customizable .

gedw99 commented 3 years ago

yep and then https://github.com/codenotary/immudb/tree/master/cmd/immudb/command/service/config

ankane commented 2 years ago

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

jeroiraz commented 1 year ago

Homebrew

thanks a lot @ankane!