28 comments

[ 2.4 ms ] story [ 43.2 ms ] thread
A description / example of what this actually does would be useful.
It's a real simple web framework that uses shell files to return responses
Examples: https://github.com/cgsdev0/bash-stack/tree/main/examples

Overview describes what it does, really. Sends stdout of shell scripts to a client through http, routing via folders. “What a complicated bs!” I thought about this principle back in the day. Sigh.

So... basically like cgi_bin?
We avoid using obsolete deprecated terms for the same things here in webdev. It’s neither amazing, nor awesome.
From the repo: “This project is intended for educational / entertainment purposes only. In its current implementation, it is riddled with security issues, and it would probably be extremely irresponsible to use this for any sort of production grade web service.

...having said that, if you happen to use it for anything, I'd love to hear about it!”

So looks like a toy project for a bit of fun. Would like to see an example of what it does anyway though.

As of now, seems we’ve had too much fun with the demo. I didn’t get to see it.

The github page says “see the docs!” for all info, which appears to be (on its face) stored with the demo, heh. Fun one!

good old CGI is making a comeback.
CGI was the OG serverless, because it was a process-per-request model until e.g. fastcgi came along.

Put scripts on an S3 backed filesystem, and as you grow, wrap them in a container, then an auto-scaling group. It might even work today!

I'm surprised I haven't seen more of this from the anti-Kubernetes crowd.

Maybe they aren't a fan of S3.
Can it harass my users with push notifications?
Joke? Push notifications have a lot of valid use cases for web apps even if they are useless (or harmful) for web pages. The platform is shared between the two categories.
Push notifications are cancer. Push notifications are used a hundred times more for spam than they are some above board legitimate purpose. Even legitimate users have marketing departments foaming at the mouth to push ads with them.
More importantly, can it aggressively fingerprint them and supply adtech companies with an approximation of their identity?
How hard would it be to make bash be the only dependency (and not require tcpserver)?

Iirc bash has some built-in support for networking but perhaps it's only for clients?

A pure bash web server is indeed possible using a loadable builtin. See: https://github.com/dzove855/Bash-web-server (discussed: https://news.ycombinator.com/item?id=29794979).
But this isn't pure bash. It requires a shared library you have to compile.
>It requires a shared library you have to compile.

Library is part of bash and patch is for supporting multiple connections. On vers>=5.2 patch is included so no need to compile anything.

Not sure about bash, but iirc, zsh’s tcp module has a proxy function to listen on a port and pass input to a shell command.
Other similar projects require a CGI-capable web server. This one instead uses djb's tcpserver. Guess next step will be to drop any external dependencies.
I was actually just playing around with AWK as a backend for CGI. Busybox provides both an AWK implementation as well as an httpd server that supports cgi hosting (https://openwrt.org/docs/guide-user/services/webserver/http....).

AWK is definitely limited as a language, but IMO it’s a saner choice than going with BASH.

It’s also been interesting to integrate with SQLite by interfacing with it through AWK’s “pipe to variable” mechanism.

This is the best thing ever made for modern development