mirror of
https://github.com/cytopia/devilbox.git
synced 2024-12-19 04:47:52 +00:00
Merge pull request #39 from cytopia/DVL-005
DVL-005 Show log files on error
This commit is contained in:
commit
8fc5ff8be1
@ -55,7 +55,7 @@ class Postgres
|
||||
|
||||
// Silence errors and try to connect
|
||||
error_reporting(0);
|
||||
$link = pg_pconnect('host='.$host.' user='.$user.' password='.$pass);
|
||||
$link = pg_connect('host='.$host.' user='.$user.' password='.$pass);
|
||||
error_reporting(-1);
|
||||
|
||||
if (!$link || pg_connection_status($link) !== PGSQL_CONNECTION_OK) {
|
||||
@ -126,10 +126,10 @@ class Postgres
|
||||
// Silence errors and try to connect
|
||||
error_reporting(0);
|
||||
if ($database !== null) {
|
||||
$link = pg_pconnect('host='.$host.' dbname='.$database.' user='.$user.' password='.$pass);
|
||||
$link = pg_connect('host='.$host.' dbname='.$database.' user='.$user.' password='.$pass);
|
||||
} else {
|
||||
// NOTE: using dbname=postgres prevents HHVM from segfaulting
|
||||
$link = pg_pconnect('host='.$host.' dbname=postgres user='.$user.' password='.$pass);
|
||||
$link = pg_connect('host='.$host.' user='.$user.' password='.$pass);
|
||||
}
|
||||
error_reporting(-1);
|
||||
|
||||
|
@ -398,7 +398,7 @@ debilbox_test() {
|
||||
# Get actual versions
|
||||
echo "http://localhost settings"
|
||||
echo "------------------------------------------------------------"
|
||||
curl -q localhost 2>/dev/null | grep -E '<h3>.*</h3>' | sed 's/.*<h3>//g' | sed 's/<\/h3>//g'
|
||||
curl -q http://localhost/index.php 2>/dev/null | grep -E '<h3>.*</h3>' | sed 's/.*<h3>//g' | sed 's/<\/h3>//g'
|
||||
echo
|
||||
|
||||
|
||||
@ -440,7 +440,7 @@ debilbox_test() {
|
||||
print_h2 "4. Error output"
|
||||
echo "Curl"
|
||||
echo "------------------------------------------------------------"
|
||||
curl localhost
|
||||
curl -vv http://localhost/index.php || true
|
||||
echo
|
||||
|
||||
echo "docker-compose ps"
|
||||
@ -448,7 +448,19 @@ debilbox_test() {
|
||||
docker-compose ps
|
||||
echo
|
||||
|
||||
echo "docker-compose logs"
|
||||
echo "------------------------------------------------------------"
|
||||
docker-compose logs
|
||||
echo
|
||||
|
||||
echo "log files"
|
||||
echo "------------------------------------------------------------"
|
||||
ls -lap log/
|
||||
sudo find log -type f -exec sh -c 'echo "{}:\n-----------------"; cat "{}"; echo "\n\n"' \;
|
||||
|
||||
return 1
|
||||
|
||||
|
||||
fi
|
||||
|
||||
return 0
|
||||
@ -460,9 +472,9 @@ debilbox_test() {
|
||||
###
|
||||
_test_docker_compose() {
|
||||
|
||||
_broken="$( docker-compose ps | grep -c 'Exit' )"
|
||||
_running="$( docker-compose ps | grep -c 'Up' )"
|
||||
_total="$( docker-compose ps -q | grep -c '' )"
|
||||
_broken="$( docker-compose ps | grep -c 'Exit' || true )"
|
||||
_running="$( docker-compose ps | grep -c 'Up' || true )"
|
||||
_total="$( docker-compose ps -q | grep -c '' || true )"
|
||||
|
||||
if [ "${_broken}" != "0" ]; then
|
||||
return 1
|
||||
@ -482,7 +494,19 @@ _test_docker_compose() {
|
||||
_test_curled_oks() {
|
||||
_oks="${1}"
|
||||
|
||||
_count="$( curl -q localhost 2>/dev/null | grep -c OK )"
|
||||
max="20"
|
||||
i=0
|
||||
while [ $i -lt $max ]; do
|
||||
if [ "$( curl -s -o /dev/null -w '%{http_code}' http://localhost/index.php )" != "404" ]; then
|
||||
break;
|
||||
fi
|
||||
sleep 1s
|
||||
i=$(( i + 1 ))
|
||||
done
|
||||
|
||||
# sleep (in case hhvm segfaulted and needs to be restarted)
|
||||
sleep 10
|
||||
_count="$( curl -q http://localhost/index.php 2>/dev/null | grep -c 'OK' || true )"
|
||||
echo "${_count}"
|
||||
|
||||
if [ "${_count}" != "${_oks}" ]; then
|
||||
|
@ -67,8 +67,8 @@ set_host_port_pgsql "54320"
|
||||
###
|
||||
### Docker default versions to use
|
||||
###
|
||||
_httpd="apache-2.2"
|
||||
_mysql="mariadb-10.2"
|
||||
_httpd="nginx-stable"
|
||||
_mysql="mariadb-10.1"
|
||||
_pgsql="9.6"
|
||||
_php="php-fpm-7.0"
|
||||
|
||||
|
@ -87,6 +87,8 @@ No need to install and configure different versions locally. Simply choose your
|
||||
| | [![Build Status](https://travis-ci.org/cytopia/docker-mariadb-10.1.svg?branch=master)](https://travis-ci.org/cytopia/docker-mariadb-10.1) [MariaDB 10.1](https://github.com/cytopia/docker-mariadb-10.1) | | [![Build Status](https://travis-ci.org/cytopia/docker-hhvm-latest.svg?branch=master)](https://travis-ci.org/cytopia/docker-hhvm-latest) [HHVM latest](https://github.com/cytopia/docker-hhvm-latest)
|
||||
| | [![Build Status](https://travis-ci.org/cytopia/docker-mariadb-10.2.svg?branch=master)](https://travis-ci.org/cytopia/docker-mariadb-10.2) [MariaDB 10.2](https://github.com/cytopia/docker-mariadb-10.2) | |
|
||||
|
||||
<sub>**Incompatible choices:**<sub><br/>
|
||||
<sub>- Apache 2.2 and HHVM do not work together</sub>
|
||||
|
||||
**Optional NoSQL stack**
|
||||
|
||||
|
@ -63,8 +63,8 @@ LOCAL_LISTEN_ADDR=127.0.0.1:
|
||||
### 1.1 Choose HTTP Server Image
|
||||
###
|
||||
#HTTPD_SERVER=apache-2.2
|
||||
HTTPD_SERVER=apache-2.4
|
||||
#HTTPD_SERVER=nginx-stable
|
||||
#HTTPD_SERVER=apache-2.4
|
||||
HTTPD_SERVER=nginx-stable
|
||||
#HTTPD_SERVER=nginx-mainline
|
||||
|
||||
###
|
||||
|
Loading…
Reference in New Issue
Block a user