Hacker News new | past | comments | ask | show | jobs | submit login

https://github.com/victrixsoft/bashbro/blob/c543d5d42ba2425f... needs amending to listen to a Unix socket instead of a port if that's something you'd like to contribute.

As for using Nginx, you should be able to install Nginx and enable its service and in that way immediately get a local HTTP server. You can then edit the config such that requests for the Host `myfiles.localhost` are `proxy_pass ...` to your bashbro server. Then `http://myfiles.localhost` in your browser should just work.




Ok, I appreciate your suggestions. But now I'm thinking about some utility where you can say:

    run-http-service myfiles bashbro -s -p PORT
And then it would just allocate a new port (clash-free), invoke bashbro with the given flags and substitute PORT by the newly allocated port number, and such that it uses myfiles.localhost as the domain. And when bashbro exits, the port number is garbage collected. Somehow, it feels like this should already exist ...


Perhaps it would be enough to have a folder in your Nginx config that is imported by glob, and to have the port number and service name in the filename of each file in the folder. The contents might be templated out from some template (`envsubst` and `sed` are probably acceptable ways to fill the template). To allocate a service is to check if it's already allocated, then find the greatest port number in use and add 1 (the filesystem can help you with this if you name the files appropriately), then check to make sure nothing else is already listening, then write the config file and restart Nginx.

I would not bother with service management to the extent that you are checking to see if the process is still running. Maybe garbage collection is worth doing, you could do it in a single run of `lsof` (the temptation to do it with multiple should be resisted).

I think this does not exist because stuff like foreman/overmind have their own method for allocating ports per-project (add 100 for each line in the config file, set the PORT env var to that) as would any sort of production-ready solution.

But it is a fun idea. And perhaps it should exist.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: