leafo / lapis

A web framework for Lua and OpenResty written in MoonScript
http://leafo.net/lapis/
MIT License
3.14k stars 247 forks source link

display "listening on ..." on startup #779

Open teto opened 10 months ago

teto commented 10 months ago

I am trying to run luarocks.org and when starting I see:

sudo lapis serve
[sudo] password for teto: 
nginx: [alert] lua_code_cache is off; this will hurt performance in /home/teto/luarocks-site/nginx.conf.compiled:38
nginx: [warn] duplicate MIME type "text/html" in /home/teto/luarocks-site/nginx.conf.compiled:97
nginx: [alert] lua_code_cache is off; this will hurt performance in /home/teto/luarocks-site/nginx.conf.compiled:196
2024/01/21 18:34:51 [notice] 671747#671747: using the "epoll" event method
2024/01/21 18:34:51 [notice] 671747#671747: openresty/1.21.4.1
2024/01/21 18:34:51 [notice] 671747#671747: built by gcc 12.3.0 (GCC) 
2024/01/21 18:34:51 [notice] 671747#671747: OS: Linux 6.7.0
2024/01/21 18:34:51 [notice] 671747#671747: getrlimit(RLIMIT_NOFILE): 32768:32768
2024/01/21 18:34:51 [notice] 671747#671747: start worker processes
2024/01/21 18:34:51 [notice] 671747#671747: start worker process 671775

would it make sense to display host:port the application is listening to to help newcomers ?

cycomachead commented 9 months ago

Yes, I would love this even for myself. :) I always forget which ports I dedicate to which apps.

Was about to just drop at print statement at the end of our app.lua file, but do think it'd be nice for basically everyone.

leafo commented 9 months ago

I agree that lapis server could output some help information about the used environment and configuration when using openresty. The only discrepancy is that with openresty, it uses the config, and the config may be listening on many/different ports separate from what is included in the environment configuration.

When using server with the cqueues server backend it currently outputs that information.