jeansaad / chalet

🏩 A simple process manager for developers. Start apps from your browser and access them using local domains
MIT License
156 stars 19 forks source link

Feature Request: start/stop/restart saved servers from CLI #30

Open svicalifornia opened 2 years ago

svicalifornia commented 2 years ago

Currently hotel and chalet allow a user/developer to start/stop each saved server from the daemon's web app (localhost:2000).

I would like to be able to start/stop/restart a saved server via the chalet CLI, as shown here:

chalet start --name myapp
chalet stop --name myapp
chalet restart --name myapp

Optionally Tail Server Output

For start and restart, I would like an option (enabled via a new CLI option such as --listen) to output the server's logs to STDOUT, so that I could run these commands from a terminal window (or VS Code terminal) and see the server logs right there. This listening/tailing of the server logs could be terminated by SIGTERM or SIGINT (ctrl-C), ending the CLI process and returning to the shell, but keeping the server running (until stopped in the Chalet daemon web app or via chalet stop --name myapp).

If Server Already Running

Running the start command and specifying a server that is already running should cause an error message to be emitted to STDERR:

"Server '<name>' is already running"

However, if the --listen option is given, then the CLI process should output the server's logs to STDOUT and continue to tail the logs until terminated by SIGTERM or SIGINT (ctrl-C).

Preserve Current Daemon Management via start/stop/restart

If the -n/--name argument is omitted, then start/stop/restart would manage the daemon, as they do now, so current usage of chalet start/stop/restart would not be affected in any way.

svicalifornia commented 2 years ago

I just realized/remembered that the add and run commands use the name of the current directory as the server name if the -n/--name option is not given. This makes me think it might be better to add new CLI commands for the behaviors described above, such as start-server/stop-server/restart-server. However, those look awkward, and newcomers to hotel/chalet would likely get confused between the daemon commands (e.g. start) and these server commands.

I'm open to alternative ideas for command syntax, but I still think it's highly desirable to be able to start/stop/restart servers and to see their log output from the CLI.