-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1979 from bomoko/feature/add_healthcheck_endpoint…
…_to_nginx_php Adds healthz-php to php fpm
- Loading branch information
Showing
9 changed files
with
66 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Healthcheck | ||
|
||
In this directory you'll find two files | ||
|
||
- healthz.locations.php.disable | ||
- healthz.locations | ||
|
||
Both are designed to expose a `/.lagoonhealthz` location from the nginx service. The difference being that the `.php.disable` file is used to point to the [healthz-php](https://github.com/amazeeio/healthz-php) application _if_ there is a PHP service attached to this application. | ||
|
||
The logic for which of the two files are enabled are contained in this image's `docker-entrypoint` file - there we check for the existence of the env var `NGINX_FASTCGI_PASS`, which indicates (or should indicate) the presence of a PHP-fpm service. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
location /.lagoonhealthz { | ||
content_by_lua_block { | ||
ngx.status = ngx.HTTP_OK; | ||
ngx.header.content_type = 'application/json'; | ||
ngx.say('{"check_nginx":"pass"}'); | ||
ngx.exit(ngx.OK); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
location /.lagoonhealthz { | ||
rewrite ^/.lagoonhealthz(/.*)?$ /.lagoonhealthz/index.php; | ||
|
||
location ~* \.php(/|$) { | ||
include /etc/nginx/fastcgi.conf; | ||
fastcgi_param SCRIPT_NAME /index.php; | ||
fastcgi_param SCRIPT_FILENAME /healthz-php/index.php; | ||
fastcgi_pass ${NGINX_FASTCGI_PASS:-php}:9000; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include /etc/nginx/conf.d/healthz.locations; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
set $fhcc none; | ||
|
||
if ( $http_user_agent ~* "StatusCake|Pingdom|Site25x7|Uptime|nagios" ) { | ||
set $fhcc "A"; | ||
} | ||
|
||
if ( $request_method = 'GET' ) { | ||
set $fhcc "$fhcc G"; | ||
} | ||
|
||
if ( $fhcc = 'A G' ) { | ||
rewrite ~* /.lagoonhealthz last; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters