Nginx Unit – Universal web app server
181–190 of 201 posts
Re: Nginx Unit – Universal web app server
#182I remember when they announced this a couple years ago I had no idea why I would use it over standard nginx. That seems to still be the case. It’s JSON controlled via Curl? And has a bunch of langue’s built in for some reason? The question becomes why?
For example, in this project we use nginx + php-fpm to serve some PHP app:
https://github.com/PrivateBin/docker-nginx-fpm-alpine
It uses s6 to handle nginx + php-fpm services, meaning we have to maintain configuration for s6 services (written in execline), nginx webserver configuration files (nginx proprietary format) and php-fpm (INI format).
I've created a fork that replaces that stack with nginx unit:
https://github.com/PrivateBin/docker-unit-alpine
No need for a service manager and both webserver and php configuration are in one file[1]. What is not well documented IMHO is that you don't have to load the config at runtime - if you place the JSON file in the (compile time changeable) /var/lib/unit directory it will be loaded on startup, similar to a traditional /etc config file. But it also will get updated at runtime, if configuration is uploaded on the config socket, making it persist service restarts, hence /var is more appropriate than /etc.
[1] https://github.com/PrivateBin/docker-unit-alpine/blob/master...
Re: Nginx Unit – Universal web app server
#183Re: Nginx Unit – Universal web app server
#184I remember when they announced this a couple years ago I had no idea why I would use it over standard nginx. That seems to still be the case. It’s JSON controlled via Curl? And has a bunch of langue’s built in for some reason? The question becomes why?
This tool does have it's appeals to folks that run web applications behind web servers in containers. For example, in this project we use nginx + php-fpm to serve some PHP app: https://github.com/PrivateBin/docker-nginx-fpm-alpine It uses s6 to handle nginx + php-fpm services, meaning we have to maintain configuration for s6 services (written in execline), nginx webserver configuration files (nginx proprietary format…
Thank you very much for this example, and calling out the config file option.
Do you find that you get any use from the config api in your setup (vs pushing a new container)?
I imagine it might be more useful if nginx unit acts like a k8s ingress like setup?
As for:
> both webserver and php configuration are in one file[1].
That's just the line in the Docker file:
COPY --chown=${UID}:${GID} conf.json /var/lib/unit/
I found the actual file more illuminating:https://github.com/PrivateBin/docker-unit-alpine/blob/master...
Re: Nginx Unit – Universal web app server
#185This is really great! What I'm really look forward to trying is the server side WebAssembly: https://unit.nginx.org/configuration/#configuration-wasm . Huge potential!
What’s the advantage of server side WebAssembly over just running a Rust/whatever application?
You don't need your language/runtime to support arm/other to run same compile artifact on arm32, arm64, power5 and amd64 - compile to wasm once, run anywhere (nginx unit would still need to support your target).
Your runtime theoretically don't need is support - compile to wasm, run on FreeBSD/arm.
You can compile your c microservice to wasm, and your rust microservice, and your c++ microservice to wasm - and deploy them sandboxed via the same stack - reducing complexity (note that another option is to deploy via nginx unit - different way to reduce complexity).
Re: Nginx Unit – Universal web app server
#186It is a great start and shows very good potential. Still need to build support for io_uring, and all the sundry features in mainline nginx, apache, haproxy etc.
Re: Nginx Unit – Universal web app server
#187Earlier quoted context omitted.
I too would like to see a properly configured php+php-fpm container benchmark. There's a lot of overhead when you link by http instead of a unix socket, in the same container.
Technically, you should be able to share a domain socket via a shared volume too (between an "app" and "web" container) - as with postgres: https://github.com/sameersbn/docker-postgresql/issues/30#iss... Curious about benchmarks and tests of TCP vs Unix domain sockets between docker containers.
"Unix Domain Sockets vs Loopback TCP Sockets"
https://nicisdigital.wordpress.com/2014/03/03/unix-domain-so...
Hn submission: https://news.ycombinator.com/item?id=37466475
Re: Nginx Unit – Universal web app server
#188This seems a lot more like how IIS works, unless I'm missing something? As an aside: it's always curious to see how the programming world has splintered into cliques that no longer hang out together. NGINX Unit is a "Universal" web server without support for C++, Rust, or ASP.NET! But PERL is supported, like the 1990s Linux cgi-bin world never went away.
Don't know about ASP.NET, but one of the supported languages is assembly, so I'd presume C++ and Rust can easily add a wrapper around that. > Binary-compiled languages in general: using the embedded libunit library. From https://unit.nginx.org/keyfeatures/#supported-app-languages
Choice quote:
The benefits of using the assembly language for your web apps are immense:
You get all the bragging rights: coding in assembly while everyone is working safe and secure within the confines of their precious sandboxed languages is like doing a perfect triple somersault without safety mats.
Next: I recommend multi-threaded assembly code with self-modifying code and lock free data structures!Re: Nginx Unit – Universal web app server
#189Earlier quoted context omitted.
YAML is an order of magnitude more hell...
But TOML is worse, right ? I can't write nor read TOML to save my life... :(
This may contribute to YAML's popularity in CI systems, because CI systems often need to be adjusted by someone who isn't super familiar with the syntax, and YAML is easier to intuit than TOML.
Re: Nginx Unit – Universal web app server
#190Earlier quoted context omitted.
Unironically this. After trying Kubernetes, Terraform, Ansible, and various proprietary PaaS config formats, I've grown to love Compose files' simplicity.
so I guess you are on Docker Swarm?
Shameless plug: I also make a Docker Swarm dashboard, check it out: https://lunni.dev/