- SEE ALSO
starlight - a light and pure-Perl PSGI/Plack HTTP server with pre-forks
$ starlight --workers=20 --max-reqs-per-child=100 app.psgi $ starlight --port=80 --ipv6=1 app.psgi $ starlight --port=443 --ssl=1 --ssl-key-file=file.key --ssl-cert-file=file.crt app.psgi $ starlight --socket=/tmp/starlight.sock app.psgi
Starlight is a standalone HTTP/1.1 server with keep-alive support. It uses pre-forking. It is pure-Perl implementation which doesn't require any XS package.
Starlight is created for Unix-like systems but it should also work on Windows with some limitations.
In addition to the options supported by plackup, starlight accepts following options(s).
Number of worker processes. (default: 10)
Seconds until timeout. (default: 300)
Timeout for persistent connections. (default: 2)
Max. number of requests allowed per single persistent connection. If set to one, persistent connections are disabled. (default: 1)
Max. number of requests to be handled before a worker process exits. (default: 1000)
If set, randomizes the number of requests handled by a single worker process between the value and that supplied by
--max-reqs-per-chlid. (default: none)
If set, worker processes will not be spawned more than once than every given seconds. Also, when SIGHUP is being received, no more than one worker processes will be collected every given seconds. This feature is useful for doing a "slow-restart". (default: none)
The Starlight does not synchronize its processes and it requires a small delay in main process so it doesn't consume all CPU. (default: 0.1)
Enables SSL support. The IO::Socket::SSL module is required. (default: 0)
Specifies the path to SSL key file. (default: none)
Specifies the path to SSL certificate file. (default: none)
Enables IPv6 support. The IO::Socket::IP module is required. (default: 0)
Enables UNIX socket support. The IO::Socket::UNIX module is required. The socket file have to be not yet created. The first character
\0 in the socket file name means that abstract socket address will be created. (default: none)
Changes the user id or user name that the server process should switch to after binding to the port. The pid file, error log or unix socket also are created before changing privileges. This options is usually used if main process is started with root privileges beacause binding to the low-numbered (<1024) port. (default: none)
Changes the group ids or group names that the server should switch to after binding to the port. The ids or names can be separated with comma or space character. (default: none)
Changes file mode creation mask. The "umask" in perlfunc is an octal number representing disabled permissions bits for newly created files. It is usually
022 when group shouldn't have permission to write or
002 when group should have permission to write. (default: none)
Makes the process run in the background. It doesn't work (yet) in native Windows (MSWin32). (default: 0)
Specify the pid file path. Use it with
-D|--daemonize option. (default: none)
Specify the pathname of a file where the error log should be written. This enables you to still have access to the errors when using
--daemonize. (default: none)
Suppress the message about starting a server.
Perl on Windows systems (MSWin32 and cygwin) emulates "fork" in perlfunc and "waitpid" in perlfunc functions and uses threads internally. See perlfork (MSWin32) and perlcygwin (cygwin) for details and limitations.
For Cygwin the
perl-libwin32 package is highly recommended, because of Win32::Process module which helps to terminate stalled worker processes.
There is a problem with Perl threads implementation which occurs on Windows systems (MSWin32). Cygwin version seems to be correct.
Some requests can fail with message:
failed to set socket to nonblocking mode:An operation was attempted on something that is not a socket.
Bad file descriptor at (eval 24) line 4.
This problem was introduced in Perl 5.16 and fixed in Perl 5.19.5.
See https://rt.perl.org/rt3/Public/Bug/Display.html?id=119003 and https://github.com/dex4er/Thrall/issues/5 for more information about this issue.
The server fails when worker process calls "exit" in perlfunc function:
Attempt to free unreferenced scalar: SV 0x293a76c, Perl interpreter: 0x22dcc0c at lib/Plack/Handler/Starlight.pm line 140.
It means that Harakiri mode can't work and the server have to be started with
See https://rt.perl.org/Public/Bug/Display.html?id=40565 and https://github.com/dex4er/Starlight/issues/1 for more information about this issue.
If you find the bug or want to implement new features, please report it at https://github.com/dex4er/Starlight/issues
The code repository is available at http://github.com/dex4er/Starlight
Piotr Roszatycki <firstname.lastname@example.org>
Based on Thrall by:
Piotr Roszatycki <email@example.com>
Based on Starlet by:
Some code based on Plack:
Some code based on Net::Server::Daemonize:
Jeremy Howard <firstname.lastname@example.org>
Paul Seamons <email@example.com>
Copyright (c) 2013-2016 Piotr Roszatycki <firstname.lastname@example.org>.
This is free software; you can redistribute it and/or modify it under the same terms as perl itself.