internal routing in Unit, change port to 8080
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Mauro Torrez 2019-09-20 10:25:45 -03:00
parent 3993d19e97
commit 1d8ec91a4e

View File

@ -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; \
}