Browse Source

new: allow to change server db docker run param and connection check command !api

myceliandre/dev/mac-compat
Valentin Lab 5 years ago
parent
commit
a5ffe9dff7
  1. 10
      bin/compose-core

10
bin/compose-core

@ -758,7 +758,7 @@ ensure_db_docker_running () {
docker pull "$DOCKER_BASE_IMAGE" docker pull "$DOCKER_BASE_IMAGE"
fi fi
docker_opts=
_set_server_db_params
debug docker network create "$_DB_NAME" debug docker network create "$_DB_NAME"
if ! network_id=$(docker network create "$_DB_NAME"); then if ! network_id=$(docker network create "$_DB_NAME"); then
err "'docker network create $_DB_NAME' failed !" err "'docker network create $_DB_NAME' failed !"
@ -768,14 +768,14 @@ ensure_db_docker_running () {
fi fi
debug docker run -d \ debug docker run -d \
--name "$_DB_NAME" \ --name "$_DB_NAME" \
$docker_opts \
"${server_docker_opts[@]}" \
--network "$_DB_NAME" \ --network "$_DB_NAME" \
-v "$host_db_working_dir:$DB_DATADIR" \ -v "$host_db_working_dir:$DB_DATADIR" \
"$DOCKER_BASE_IMAGE" "$DOCKER_BASE_IMAGE"
if ! container_id=$( if ! container_id=$(
docker run -d \ docker run -d \
--name "$_DB_NAME" \ --name "$_DB_NAME" \
$docker_opts \
"${server_docker_opts[@]}" \
--network "$_DB_NAME" \ --network "$_DB_NAME" \
-v "$host_db_working_dir:$DB_DATADIR" \ -v "$host_db_working_dir:$DB_DATADIR" \
"$DOCKER_BASE_IMAGE" "$DOCKER_BASE_IMAGE"
@ -934,13 +934,15 @@ wait_for_docker_ip() {
[ "$type" == "tcp" ] || continue [ "$type" == "tcp" ] || continue
wait_for_tcp_port "$DOCKER_NETWORK" "$DOCKER_IP:${port}" || return 17 wait_for_tcp_port "$DOCKER_NETWORK" "$DOCKER_IP:${port}" || return 17
info "Host/Port $DOCKER_IP:${port} checked ${GREEN}open${NORMAL}." info "Host/Port $DOCKER_IP:${port} checked ${GREEN}open${NORMAL}."
## XXXvlab: what to do with more than one port ?
break
done < <(image_exposed_ports_0 "$container_id") done < <(image_exposed_ports_0 "$container_id")
## Checking direct connection ## Checking direct connection
timeout=30 timeout=30
start=$SECONDS start=$SECONDS
while true; do while true; do
if err=$(echo "SELECT 1;" | ddb 2>&1 >/dev/null); then
if err=$(echo "$check_command" | ddb 2>&1 >/dev/null); then
break break
fi fi
if ! [[ "$err" == *"the database system is starting up" ]]; then if ! [[ "$err" == *"the database system is starting up" ]]; then

Loading…
Cancel
Save