Skip to content

Add daemon off in config json #300

Open
@joanhey

Description

@joanhey

In nginx we can use daemon off from config, normally to run it in docker.

In Unit don't exist. The only solution that I find to configure and run in docker is running unitd 2 times.
With unitd --no-daemon we can't run and config in the same dockerfile.
Another way to do it ??

Examples:

FROM ubuntu:19.04

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update -yqq && apt-get install -yqq software-properties-common > /dev/null
RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
RUN apt-get update -yqq > /dev/null && \
    apt-get install -yqq curl php7.3 php7.3-mysql > /dev/null

RUN curl https://nginx.org/keys/nginx_signing.key | apt-key add - \
    && add-apt-repository "deb https://packages.nginx.org/unit/ubuntu/ disco unit" -s \
    && apt-get -y update \
    && apt-get -y install unit unit-php

ADD ./ /php
WORKDIR /php

# forward log to docker log collector
#RUN ln -sf /dev/stdout /var/log/unit.log

# RUN if [ $(nproc) = 2 ]; then sed -i "s|\"processes\": 128,|\"processes\": 64,|g" /php/deploy/nginx-unit.json ; fi;

RUN unitd && \
    curl -X PUT --data-binary @/php/deploy/nginx-unit.json --unix-socket \
        /var/run/control.unit.sock http://localhost/config

CMD unitd --no-daemon

But that create all the processes 2 times. Works perfectly, but will be better set it from the config.

Thank you

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions