neo-node icon indicating copy to clipboard operation
neo-node copied to clipboard

Neo CLI requires tty to start

Open aprasolova opened this issue 5 years ago • 8 comments

It's impossible to start neo-cli with command dotnet neo-cli.dll /rpc if this process wouldn't have a tty allocated. The only way to run neo-cli with no terminal attached (in case if I'd like to run it in a docker container, for instance) is smth like screen -DmS node dotnet neo-cli.dll /rpc, i.e. allocate tty anyway.

I wonder, is it really necessary? If it's not, would you be so kind to get rid of this minor, but annoying defect?

aprasolova avatar Aug 27 '19 12:08 aprasolova

@aprasolova did you tried run neo-cli.dll --rpc?


UPD: as I understand, Anastasia want to run node as daemon (service in Windows terminology), without interpritator-mode. It's a great feature for production environment

im-kulikov avatar Aug 27 '19 12:08 im-kulikov

You're right @aprasolova but you can use screenor tmux. 😅

You can create a systemd services as workaround.

[Unit]
Description=neo-cli service

After=network-online.target
Requires=network-online.target

[Service]
WorkingDirectory=/opt/neo-cli
ExecStart=/usr/bin/tmux new-session '/usr/bin/dotnet neo-cli.dll --rpc'
ExecStop=/usr/bin/pkill -SIGTERM -f neo-cli
Restart=always
TimeoutSec=5
RestartSec=10
StandardInput=tty-force
TTYPath=/dev/tty2
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=neonode
User=node
Group=node

[Install]
WantedBy=multi-user.target

belane avatar Sep 02 '19 08:09 belane

@belane as I said before, “screen” is good for developing, but what about production?

im-kulikov avatar Sep 02 '19 08:09 im-kulikov

Meanwhile I have been using it in production environment for a long time without any problem.

belane avatar Sep 02 '19 08:09 belane

@belane just look at any linux daemon, they doesn't need any screen to work..

I think, screen is good idea for development (as I said before), but for production env, I don't understand the need of screen


UPD: without any problem I didn't say, that there was a some problem.. just screen is unnecessary layer

im-kulikov avatar Sep 02 '19 09:09 im-kulikov

@belane, NEO-node with screen (or tmux) works fine for sure, but do it really need a shell? Systemd service is not a workaround, because in ExecStart section it spawns new shell as well. :)

My point is that server process is /usr/bin/dotnet neo-cli.dll --rpc, but it requires an allocated tty to start for some reason. I believe if a user could start NEO-node as a server with just running /usr/bin/dotnet neo-cli.dll --rpc then it would look more clear.

I reported this issue with an intention to propose a little enhacement: to get rid of a tty when one starts a NEO-node as a server. What do you think on it?

aprasolova avatar Sep 02 '19 09:09 aprasolova

Definitely, we should try to improve this

shargon avatar Sep 02 '19 15:09 shargon

@aprasolova thanks for the suggestion, it has been decided to add this feature. At some point this issue will be closed to add it to a list of cosmetic changes.

belane avatar Sep 09 '19 15:09 belane