6 ms·
The docs mentions: > The control API is the single source of truth about Unit’s configuration. There are no configuration files that can or should be manipulat
by gawa 2y ago
The docs mentions:
> The control API is the single source of truth about Unit’s configuration. There are no configuration files that can or should be manipulated; this is a deliberate design choice
(https://unit.nginx.org/controlapi/#no-config-files https://unit.nginx.org/controlapi/#no-config-files)
So yeah, the way to go is to run something like `curl -X PUT --data-binary @/config.json --unix-socket /var/run/control.unit.sock http://localhost/config/ http://localhost/config/` right after you start your nginx-unit.
The way to manage a separate config step depends on how you manage to run the process nginx-unit (systemd, docker, podman, kubernetes...). Here's an example I found where the command is put in the entrypoint script of the container (see toward the end): https://blog.castopod.org/containerize-your-php-applications-using-nginx-unit/ https://blog.castopod.org/containerize-your-php-applications...
- casperb 2y agoI did that, but sometimes it takes a short moment before Unit is started, so you need a loop to check if Unit is responding before you can send the config. In total it was around 20 lines just to load the config. It feels like doing something wrong. Or using the wrong tool.