From fcc398e964acce113801772098cd40435028da6a Mon Sep 17 00:00:00 2001 From: Evgeniy Chekan Date: Wed, 6 May 2020 23:01:13 +0300 Subject: [PATCH 1/2] Adds `nginx -t` that will exit in case of fail before actually running nginx --- bin/start-nginx | 8 ++++++++ bin/start-nginx-debug | 8 ++++++++ bin/start-nginx-solo | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/bin/start-nginx b/bin/start-nginx index dbf1906..828070c 100755 --- a/bin/start-nginx +++ b/bin/start-nginx @@ -54,6 +54,14 @@ fi # Start nginx ( + #Test config before actually launching nginx + echo 'buildpack=nginx at=nginx-test-config' + bin/nginx -t -c config/nginx.conf + if [[ $? -ne 0 ]]; then + echo 'nginx-test-config' >$psmgr; + exit 1 + fi + # We expect nginx to run in foreground. # We also expect a socket to be at /tmp/nginx.socket. echo 'buildpack=nginx at=nginx-start' diff --git a/bin/start-nginx-debug b/bin/start-nginx-debug index 8a6b091..a5db55b 100755 --- a/bin/start-nginx-debug +++ b/bin/start-nginx-debug @@ -54,6 +54,14 @@ fi # Start nginx ( + #Test config before actually launching nginx + echo 'buildpack=nginx at=nginx-test-config' + bin/nginx-debug -t -c config/nginx.conf + if [[ $? -ne 0 ]]; then + echo 'nginx-test-config' >$psmgr; + exit 1 + fi + # We expect nginx to run in foreground. # We also expect a socket to be at /tmp/nginx.socket. echo 'buildpack=nginx at=nginx-start' diff --git a/bin/start-nginx-solo b/bin/start-nginx-solo index f8eccd9..d8f88e0 100755 --- a/bin/start-nginx-solo +++ b/bin/start-nginx-solo @@ -30,6 +30,14 @@ echo 'buildpack=nginx at=logs-initialized' # Start nginx ( + #Test config before actually launching nginx + echo 'buildpack=nginx at=nginx-test-config' + bin/nginx -t -c config/nginx.conf + if [[ $? -ne 0 ]]; then + echo 'nginx -t' >$psmgr; + exit 1 + fi + #We expect nginx to run in foreground. #We also expect a socket to be at /tmp/nginx.socket. echo 'buildpack=nginx at=nginx-start' From 51b4b775091a8eadad039255df2f29e8fc8de905 Mon Sep 17 00:00:00 2001 From: Evgeniy Chekan Date: Wed, 6 May 2020 23:06:02 +0300 Subject: [PATCH 2/2] Update changelog --- changelog.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/changelog.md b/changelog.md index 9ec6149..255e6ab 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.5] - 2020-05-06 +### Added +- [all] add `nginx -t` before starting nginx + ## [1.4] - 2020-05-05 ### Added - [all] add nginx-debug binary