2016-12-26 21:03:21 +00:00
|
|
|
#!/bin/sh -eu
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
#
|
|
|
|
# Arguments
|
|
|
|
#
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
###
|
|
|
|
### Validate arguments
|
|
|
|
###
|
2017-05-17 06:37:36 +00:00
|
|
|
if [ "${#}" != "5" ]; then
|
2016-12-26 21:03:21 +00:00
|
|
|
echo "Error: Invalid number of arguments"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -d "${1}" ]; then
|
|
|
|
echo "Error: Not a directory: ${1}"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
###
|
|
|
|
### Get arguments
|
|
|
|
###
|
2017-05-17 06:37:36 +00:00
|
|
|
DVL_PATH="$( echo "${1}"| sed 's/\/*$//' )" # remove last slash(es): /
|
|
|
|
DVL_SRV1="${2}" # Server 1
|
|
|
|
DVL_VER1="${3}" # Version 1
|
|
|
|
DVL_SRV2="${4}" # Server 2
|
|
|
|
DVL_VER2="${5}" # Version 2
|
2016-12-26 21:03:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
#
|
|
|
|
# Bootstrap
|
|
|
|
#
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
###
|
|
|
|
### Source library
|
|
|
|
###
|
2017-05-17 06:37:36 +00:00
|
|
|
. "${DVL_PATH}/.tests/.lib.sh" "${DVL_PATH}"
|
2016-12-26 21:03:21 +00:00
|
|
|
|
|
|
|
###
|
|
|
|
### Reset .env file
|
|
|
|
###
|
|
|
|
reset_env_file
|
|
|
|
|
|
|
|
###
|
|
|
|
### Enable debug mode
|
|
|
|
###
|
|
|
|
set_debug_enable
|
|
|
|
|
|
|
|
###
|
|
|
|
### Alter host ports
|
|
|
|
###
|
|
|
|
set_host_port_httpd "80"
|
2017-05-12 06:38:46 +00:00
|
|
|
set_host_port_mysql "3306"
|
|
|
|
set_host_port_pgsql "5432"
|
2016-12-26 21:03:21 +00:00
|
|
|
|
2017-05-24 06:37:37 +00:00
|
|
|
###
|
|
|
|
### Default values for container
|
|
|
|
###
|
2018-03-06 07:50:29 +00:00
|
|
|
DEF_PHP="7.0"
|
2017-05-24 06:37:37 +00:00
|
|
|
DEF_HTTPD="nginx-stable"
|
|
|
|
DEF_MYSQL="mariadb-10.0"
|
|
|
|
DEF_PGSQL="9.6"
|
|
|
|
|
2016-12-26 21:03:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
#
|
|
|
|
# Test
|
|
|
|
#
|
|
|
|
################################################################################
|
|
|
|
|
2017-05-25 10:43:50 +00:00
|
|
|
###
|
|
|
|
### Docker Host settings
|
|
|
|
###
|
|
|
|
print_h1 "Docker Host settings"
|
|
|
|
|
|
|
|
print_h2 "Listening services"
|
|
|
|
run "netstat -tulpn"
|
|
|
|
|
|
|
|
print_h2 "Docker version"
|
|
|
|
run "docker --version"
|
|
|
|
run "docker-compose --version"
|
|
|
|
|
|
|
|
|
2017-05-24 06:37:37 +00:00
|
|
|
|
|
|
|
###
|
|
|
|
### Configure
|
|
|
|
###
|
2017-05-24 06:45:53 +00:00
|
|
|
print_h1 "Configuration: ${DVL_SRV1}-${DVL_VER1} vs ${DVL_SRV2}-${DVL_VER2}"
|
2017-05-25 09:00:36 +00:00
|
|
|
|
|
|
|
print_h2 "Enabled settings in .env"
|
2017-05-24 06:37:37 +00:00
|
|
|
devilbox_configure "${DVL_SRV1}" "${DVL_VER1}" "${DVL_SRV2}" "${DVL_VER2}" "${DEF_PHP}" "${DEF_HTTPD}" "${DEF_MYSQL}" "${DEF_PGSQL}"
|
2017-05-25 09:00:36 +00:00
|
|
|
devilbox_configured_settings
|
|
|
|
|
2017-05-24 06:37:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
###
|
|
|
|
### Download and run
|
|
|
|
###
|
2017-05-25 09:00:36 +00:00
|
|
|
print_h1 "Startup Devilbox"
|
|
|
|
|
|
|
|
print_h2 "Download"
|
2017-05-24 06:37:37 +00:00
|
|
|
devilbox_pull
|
2017-05-25 09:00:36 +00:00
|
|
|
|
|
|
|
print_h2 "Run"
|
2017-05-24 06:37:37 +00:00
|
|
|
devilbox_start
|
2017-05-25 09:00:36 +00:00
|
|
|
|
|
|
|
print_h2 "Actual settings from index.php"
|
|
|
|
devilbox_print_actual_settings
|
|
|
|
|
2017-05-24 06:37:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
###
|
|
|
|
### Test
|
|
|
|
###
|
|
|
|
print_h1 "Testing"
|
|
|
|
|
|
|
|
print_h2 "docker-compose"
|
2017-05-24 06:45:53 +00:00
|
|
|
if ! devilbox_test_compose; then
|
2017-05-26 06:36:16 +00:00
|
|
|
devilbox_print_errors "http://127.0.0.1/index.php"
|
2017-05-24 06:37:37 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2017-05-24 06:45:53 +00:00
|
|
|
print_h2 "Testing 'dvlbox-ok': index.php"
|
2017-05-26 06:36:16 +00:00
|
|
|
if ! devilbox_test_url "http://127.0.0.1/index.php" "dvlbox-ok" "20"; then
|
|
|
|
devilbox_print_errors "http://127.0.0.1/index.php"
|
2017-05-24 06:37:37 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2017-05-24 06:45:53 +00:00
|
|
|
print_h2 "Testing 'dvlbox-err': index.php"
|
2017-05-26 06:36:16 +00:00
|
|
|
if ! devilbox_test_url "http://127.0.0.1/index.php" "dvlbox-err" "0"; then
|
|
|
|
devilbox_print_errors "http://127.0.0.1/index.php"
|
2017-05-24 06:37:37 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2017-05-25 09:00:36 +00:00
|
|
|
|
2017-05-24 06:37:37 +00:00
|
|
|
###
|
|
|
|
### Stop
|
|
|
|
###
|
2017-05-24 06:45:53 +00:00
|
|
|
print_h1 "Shutdown and exit"
|
2016-12-26 21:03:21 +00:00
|
|
|
devilbox_stop
|