From 7b42bd2d03e2b7b1453d54cbbb500208b33c7b00 Mon Sep 17 00:00:00 2001 From: Mauro Torrez Date: Mon, 23 Sep 2019 10:08:09 -0300 Subject: [PATCH] add unit config --- 14.0/unit/Dockerfile | 29 +++++++++++++++++++++++++++++ 14.0/unit/entrypoint.sh | 0 15.0/unit/Dockerfile | 29 +++++++++++++++++++++++++++++ 15.0/unit/entrypoint.sh | 0 16.0/unit/Dockerfile | 29 +++++++++++++++++++++++++++++ 16.0/unit/entrypoint.sh | 0 Dockerfile-unit.template | 29 +++++++++++++++++++++++++++++ docker-entrypoint.sh | 0 8 files changed, 116 insertions(+) mode change 100644 => 100755 14.0/unit/entrypoint.sh mode change 100644 => 100755 15.0/unit/entrypoint.sh mode change 100644 => 100755 16.0/unit/entrypoint.sh mode change 100644 => 100755 docker-entrypoint.sh diff --git a/14.0/unit/Dockerfile b/14.0/unit/Dockerfile index a647c18..119ffe1 100644 --- a/14.0/unit/Dockerfile +++ b/14.0/unit/Dockerfile @@ -91,6 +91,35 @@ RUN set -ex; \ COPY *.sh upgrade.exclude / COPY config/* /usr/src/nextcloud/config/ +# launch and configure Unit +RUN \ + [ -f /var/www/html/index.php ] || { \ + touch /var/www/html/index.php /var/www/html/index.php.remove; \ + } \ + && unitd --control unix:/var/run/control.unit.sock \ + && curl -X PUT --data-binary \ + '{ \ + "listeners": { "*:9000": { "pass": "routes" } }, \ + "routes": [ \ + { "action": { "pass": "applications/index_php" } } \ + ], \ + "applications": { \ + "index_php": { \ + "type": "php", \ + "processes": { "max": 20, "spare": 5 }, \ + "user": "www-data", \ + "group": "www-data", \ + "root": "/var/www/html", \ + "script": "index.php" \ + } \ + } \ + }' \ + --unix-socket /var/run/control.unit.sock http://localhost/config/ \ + && [ -f /var/www/html/index.php.remove ] && { \ + rm /var/www/html/index.php /var/www/html/index.php.remove; \ + } + +EXPOSE 9000 ENTRYPOINT ["/entrypoint.sh"] STOPSIGNAL SIGTERM CMD ["unitd", "--no-daemon", "--control", "unix:/var/run/control.unit.sock"] diff --git a/14.0/unit/entrypoint.sh b/14.0/unit/entrypoint.sh old mode 100644 new mode 100755 diff --git a/15.0/unit/Dockerfile b/15.0/unit/Dockerfile index 694ff00..c57ec29 100644 --- a/15.0/unit/Dockerfile +++ b/15.0/unit/Dockerfile @@ -91,6 +91,35 @@ RUN set -ex; \ COPY *.sh upgrade.exclude / COPY config/* /usr/src/nextcloud/config/ +# launch and configure Unit +RUN \ + [ -f /var/www/html/index.php ] || { \ + touch /var/www/html/index.php /var/www/html/index.php.remove; \ + } \ + && unitd --control unix:/var/run/control.unit.sock \ + && curl -X PUT --data-binary \ + '{ \ + "listeners": { "*:9000": { "pass": "routes" } }, \ + "routes": [ \ + { "action": { "pass": "applications/index_php" } } \ + ], \ + "applications": { \ + "index_php": { \ + "type": "php", \ + "processes": { "max": 20, "spare": 5 }, \ + "user": "www-data", \ + "group": "www-data", \ + "root": "/var/www/html", \ + "script": "index.php" \ + } \ + } \ + }' \ + --unix-socket /var/run/control.unit.sock http://localhost/config/ \ + && [ -f /var/www/html/index.php.remove ] && { \ + rm /var/www/html/index.php /var/www/html/index.php.remove; \ + } + +EXPOSE 9000 ENTRYPOINT ["/entrypoint.sh"] STOPSIGNAL SIGTERM CMD ["unitd", "--no-daemon", "--control", "unix:/var/run/control.unit.sock"] diff --git a/15.0/unit/entrypoint.sh b/15.0/unit/entrypoint.sh old mode 100644 new mode 100755 diff --git a/16.0/unit/Dockerfile b/16.0/unit/Dockerfile index 8a1c4bf..42bcfdc 100644 --- a/16.0/unit/Dockerfile +++ b/16.0/unit/Dockerfile @@ -91,6 +91,35 @@ RUN set -ex; \ COPY *.sh upgrade.exclude / COPY config/* /usr/src/nextcloud/config/ +# launch and configure Unit +RUN \ + [ -f /var/www/html/index.php ] || { \ + touch /var/www/html/index.php /var/www/html/index.php.remove; \ + } \ + && unitd --control unix:/var/run/control.unit.sock \ + && curl -X PUT --data-binary \ + '{ \ + "listeners": { "*:9000": { "pass": "routes" } }, \ + "routes": [ \ + { "action": { "pass": "applications/index_php" } } \ + ], \ + "applications": { \ + "index_php": { \ + "type": "php", \ + "processes": { "max": 20, "spare": 5 }, \ + "user": "www-data", \ + "group": "www-data", \ + "root": "/var/www/html", \ + "script": "index.php" \ + } \ + } \ + }' \ + --unix-socket /var/run/control.unit.sock http://localhost/config/ \ + && [ -f /var/www/html/index.php.remove ] && { \ + rm /var/www/html/index.php /var/www/html/index.php.remove; \ + } + +EXPOSE 9000 ENTRYPOINT ["/entrypoint.sh"] STOPSIGNAL SIGTERM CMD ["unitd", "--no-daemon", "--control", "unix:/var/run/control.unit.sock"] diff --git a/16.0/unit/entrypoint.sh b/16.0/unit/entrypoint.sh old mode 100644 new mode 100755 diff --git a/Dockerfile-unit.template b/Dockerfile-unit.template index c3197a9..ce32d20 100644 --- a/Dockerfile-unit.template +++ b/Dockerfile-unit.template @@ -90,6 +90,35 @@ RUN set -ex; \ COPY *.sh upgrade.exclude / COPY config/* /usr/src/nextcloud/config/ +# launch and configure Unit +RUN \ + [ -f /var/www/html/index.php ] || { \ + touch /var/www/html/index.php /var/www/html/index.php.remove; \ + } \ + && unitd --control unix:/var/run/control.unit.sock \ + && curl -X PUT --data-binary \ + '{ \ + "listeners": { "*:9000": { "pass": "routes" } }, \ + "routes": [ \ + { "action": { "pass": "applications/index_php" } } \ + ], \ + "applications": { \ + "index_php": { \ + "type": "php", \ + "processes": { "max": 20, "spare": 5 }, \ + "user": "www-data", \ + "group": "www-data", \ + "root": "/var/www/html", \ + "script": "index.php" \ + } \ + } \ + }' \ + --unix-socket /var/run/control.unit.sock http://localhost/config/ \ + && [ -f /var/www/html/index.php.remove ] && { \ + rm /var/www/html/index.php /var/www/html/index.php.remove; \ + } + +EXPOSE 9000 ENTRYPOINT ["/entrypoint.sh"] STOPSIGNAL SIGTERM CMD ["unitd", "--no-daemon", "--control", "unix:/var/run/control.unit.sock"] diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh old mode 100644 new mode 100755