From 1d8ec91a4e8220852455b856c42c447448e738bb Mon Sep 17 00:00:00 2001 From: Mauro Torrez Date: Fri, 20 Sep 2019 10:25:45 -0300 Subject: [PATCH] internal routing in Unit, change port to 8080 --- Dockerfile | 69 ++++++++++++++++++++++++------------------------------ 1 file changed, 31 insertions(+), 38 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7ae7d3d..39c26c3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,7 +25,6 @@ RUN { \ echo 'html_errors = Off'; \ } > /etc/php/7.3/embed/conf.d/error-logging.ini - VOLUME /var/www/html ENV WORDPRESS_VERSION 5.2.3 @@ -41,7 +40,7 @@ RUN set -ex; \ chown -R www-data:www-data /var/www/html # port used by the listener in config.json -EXPOSE 8090 8091 +EXPOSE 8080 # application setup @@ -50,42 +49,36 @@ 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 \ - # upload the app config to Unit - && curl -X PUT --data-binary '{ \ - "listeners": { \ - "*:8090": { \ - "application": "script_index_php" \ - }, \ - "*:8091": { \ - "application": "direct_php" \ - } \ - }, \ - "applications": { \ - "script_index_php": { \ - "type": "php", \ - "processes": { \ - "max": 20, \ - "spare": 5 \ - }, \ - "user": "www-data", \ - "group": "www-data", \ - "root": "/var/www/html", \ - "script": "index.php" \ - }, \ - "direct_php": { \ - "type": "php", \ - "processes": { \ - "max": 5, \ - "spare": 0 \ - }, \ - "user": "www-data", \ - "group": "www-data", \ - "root": "/var/www/html", \ - "script": "index.php" \ - } \ - } \ - }' --unix-socket /var/run/control.unit.sock http://localhost/config/ \ + && unitd --control unix:/var/run/control.unit.sock \ + # upload the app config to Unit + && curl -X PUT --data-binary \ +'{ \ + "listeners": { "*:8080": { "pass": "routes" } }, \ + "routes": [ \ + { "match": { "uri": "*.php" }, "action": { "pass": "applications/direct_php" } }, \ + { "action": { "share": "/var/www/html" } }, \ + { "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" \ + }, \ + "direct_php": { \ + "type": "php", \ + "processes": { "max": 5, "spare": 0 }, \ + "user": "www-data", \ + "group": "www-data", \ + "root": "/var/www/html", \ + "index": "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; \ }