mojolicious/mojo

Transform Morbo into a general purpose server restarter

Open

#1,715 opened on Feb 22, 2021

View on GitHub
 (1 comment) (0 reactions) (0 assignees)Perl (591 forks)auto 404
feature requesthelp wanted

Repository metrics

Stars
 (2,745 stars)
PR merge metrics
 (PR metrics pending)

Description

We already have support for receiving file descriptors from a parent process ($daemon->listen(['http://127.0.0.1?fd=3'])) in Mojo::Server::Daemon and Mojo::Server::Prefork for systemd. So Morbo feels a bit antiquated with its insistence on only supporting one specific web server.

Back when WSL did not yet exist it made sense to do it that way and have a somewhat working restarter on Windows, even if it only works half the time. But we can do better now, and there is no reason Morbo can't restart prefork web servers too. It would also help a lot with #1694.

$ morbo script/myapp daemon
...
$ morbo script/myapp prefork --workers 1
...
$ morbo --listen http://127.0.0.1:8080 --watch assets/css script/myapp prefork --workers 3
...

That's pretty much how i imagine it would work, the file descriptor could be passed along via environment variable. Otherwise just standard signals for process management and the same file watch behaviour for automatic restarts.

$ morbo script/myapp
...

Without extra arguments it could default to daemon for backwards compatibility. But it's not a hard requirement, since morbo is just a development tool.

Contributor guide