I'm still not sure what the advantage of that is over using perhaps the most reliable, certainly most-used web server as a proxy in front of your app. I'm open to convincing, though.
I don't mean to overstate the advantages--I think both solutions are fine; neither will make or break your operation.
I use go net/http every day, in production. I trust it, but NGINX provides so much more battle tested functionality out of the box.
How do you know how many lines are required to configure hypothetical middleware?
> No go gets
How is static compilation worse than `apt-get install` or `docker run`?
> No middleware
It's another process... why would running another process be better than middleware?
> it's well tested, mature and backed by software that powers a majority of the web.
Granted. It seems like this is the only clear win for NGINX, and it may well change if Go libraries mature. Time will tell.
Primarily through experience. Happy to be shown otherwise. Middleware usually takes a bit more configuration than that.
> Granted. It seems like this is the only clear win for NGINX, and it may well change if Go libraries mature. Time will tell.
We can quibble over whether it's the "only" win, but even so, it's a very, very big win. It's a single point of failure that handles a lot of features you'd have to replicate with various packages that lack the kind of support, maturity and community that NGINX has.
Sorry but I'm not going to be writing ansible code that modifies structs inside of some program then compiles said program. No thank you that sounds like crazy town. Also other sysadmins and infrastructure engineers will actually know how things work and won't have to go reading the source code for some crazy Go app program at 2am that also is a webserver for some reason?
Separation of concerns, use it!!
The discussion is scoped to a single Go application. No one is proposing replacing NGINX with Go (or anything else) for JVM apps.
> won't have to go reading the source code for some crazy Go app program at 2am that also is a webserver for some reason?
This is a rephrasing of the question I posed earlier--is it easier to manage configuration in Go source code or NGINX config files.
> Separation of concerns, use it!!
Concerns can be separated without being in distinct processes or implemented by distinct programmers or implemented in distinct programming languages.
It's also about reproducing all the business logic provided by nginx, not just configuration. You can't pretend like net/http package gives you everything ngnix provides, that's a lie.
When it comes to these decisions, I use the Principal of Least Power (https://en.wikipedia.org/wiki/Rule_of_least_power)
If writing
proxy_cache_path /path/to/cache levels=1:2 keys_zone=my_cache:10m max_size=10g
location / {
proxy_cache my_cache;
proxy_pass http://my_upstream;
}
gets me what I want without Turing-completeness, I'll choose that.Obviously, more complicated tasks require more complicated tools.
This doesn't seem like a solid basis for making engineering decisions -- or any kind of decisions.
This doesn't always lead to the best decisions -- although by chance it can work out okay -- and it also has the effect of limiting your horizons. Now I can't say one should learn about every single web server out there, but when the choice is between a dedicated web server and a library in a particular programming language, there is really a lot to see on the other side. Rewrite rules and the wide variety of HTTP stats available for logging are both areas where web servers can give us new ideas.
When I was much younger I thought, why learn databases? I can use Java, I know XML. Just open the XML file and add the records. There's XQuery for searching... The historical precursor for "Why not write everything in Go?" is "Why not write everything in Java?".
I think you can know enough about an alternative to decide whether or not its appropriate without conquering its learning curve.
> I think you can know enough about an alternative to decide whether or not its appropriate without conquering its learning curve.
Yeah, but that's not the same thing as using your level of knowledge as the deciding factor.