6 ms·
Show HN: Neh – Execute any script or program from Nginx location directives
- dylz 7y agoAnother curl | bash installer that is not even tied to a commit :(
- asadlionpk 7y agoUpdating the blogpost each time they commit would be inconvenient no?
- throwanem 7y agoMoving a Git tag isn't.
- oap_bram 7y agoGood point, I'll also try to move it into a git tag like the comment down here also suggests!
- dylz 7y agoThanks! I'm really not a fan of the trope of piping stuff directly into running it as root for obvious reasons. Have you seen zerotier (the software)'s idea too? They ask you to import a GPG key and verify it before chaining it into a |sh or |bash.
- h43z 7y ago"When I searched the first time, most of the answers that I found revolved around using things like “FastCGI with PHP” . I wasn’t gonna use PHP to call a bash script, that would be overdoing it probably." FYI. You don't have to use PHP to make use of FastCGI. You can simply use something like fcgiwrap (apt-installable on debian) and use it in Nginx.
- maallooc 7y agoI want to scream out: Why the f would you want to do that?
- dillonmckay 7y agoDeploy script triggered from a third party webhook?
- donatj 7y agoBlatant self promotion, I built a server in Go to do exactly this with GitHub webhooks... I make very extensive use of it. https://github.com/donatj/hookah https://github.com/donatj/hookah
- cnorthwood 7y agoAnd we've come back round full circle from CGI scripts, although separating out headers and body on different fds sounds neat
- Natsu 7y agoYeah, this seems nice for small scripts and all, but I wonder how long until scope creep makes them end up writing or replacing this with an API gateway?
- deleted 7y ago[deleted]
- CodeWriter23 7y agoMany things we’ve dispensed with long ago seem to be forgotten and the younger coders are learning for themselves the hard way. Aka the same way we did.
- badrabbit 7y agoExcept with a lot of learned lessons applied.
- oap_bram 7y agoOne of the things I'm wondering however: How popular is CGI if I don't find it with the query "run script on nginx location directive".
- westurner 7y agoNginx probably somewhat-deliberately has FastCGI but not regular CGI for a number of reasons. CGI has process-per-request overhead. CGI typically runs processes as the user the webserver is running as; said processes can generally read and write to the unsandboxed address space of the calling process (such as x.509 private certs). Just about any app can be (D)DOS'd. That requires less resources with the process-per-request overhead of CGI. In order to prevent resource exhaustion due to e.g someone benignly hitting reload a bunch of times and thus creating multiple GET requests, applications should enqueue task messages which a limited number of workers retrieve from a (durable) FIFO or priority queue and update the status of. Websockets may or may not scale better than long-polling for streaming stdout to a client.
- VWWHFSfQ 7y agothis is just cgi right. you don't need lua
- odkamkfn 7y agonginx doesn't do cgi
- minhoryang 7y agoWhy are you recreate CGI? over nginx?
- minhoryang 7y agoSTDIN/STDOUT and header at environment variables is definitely CGI.
- tinus_hn 7y agoWhat could possibly go wrong?
- ficklepickle 7y agoThis is awesome! Thanks for sharing it. I, too, have unintentionally recreated existing technologies (a unix util, pass, in my case). I recently built something similar with node + bash scripts. Node basically just verifies the webhook, runs a bash script, on failure it rolls back and emails me.