top | item 37465966

(no title)

El_RIDO | 2 years ago

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) 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...

discuss

order

e12e|2 years ago

> 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.

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...