From 416fbce956c139b194e0a7847cc6a4af5e200dcf Mon Sep 17 00:00:00 2001 From: Olivier DOSSMANN Date: Fri, 7 Jul 2017 16:05:54 +0200 Subject: [PATCH 1/2] [FIX] restore command: DUMP_DIR is empty while using "/f.dump" --- launch.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/launch.sh b/launch.sh index 76aede0..c774941 100755 --- a/launch.sh +++ b/launch.sh @@ -256,6 +256,9 @@ test_restore() { DUMP_FILE=`basename $ARGS` info "Dump file found: ${DUMP_FILE}" DUMP_DIR="${ARGS%/*}" + if [ -z "$DUMP_DIR" ]; then + DUMP_DIR="/" + fi } psql() { From f5163ce894195e00957d6328e5c9b0307872d58f Mon Sep 17 00:00:00 2001 From: Olivier DOSSMANN Date: Fri, 7 Jul 2017 16:19:36 +0200 Subject: [PATCH 2/2] [FIX] restore command: Missing postgreSQL port --- launch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launch.sh b/launch.sh index c774941..01f56f2 100755 --- a/launch.sh +++ b/launch.sh @@ -275,7 +275,7 @@ restore() { test_restore $docker_cmd stop ${POSTGRES_DOCKER_NAME} && $docker_cmd rm ${POSTGRES_DOCKER_NAME} || error_and_quit "Failed to stop and delete postgreSQL Docker container: ${POSTGRES_DOCKER_NAME}" sudo rm -rf ${DB_DIR} || error_and_quit "Failed to delete this directory: ${DB_DIR}" - $docker_cmd run -d -P -v "${DB_DIR}:/var/lib/postgresql/data" --name "${POSTGRES_DOCKER_NAME}" "postgres:${POSTGRES_VERSION}" || error_and_quit "Launching database docker container failed." + $docker_cmd run -d -p ${POSTGRES_PORT}:5432 -v "${DB_DIR}:/var/lib/postgresql/data" --name "${POSTGRES_DOCKER_NAME}" "postgres:${POSTGRES_VERSION}" || error_and_quit "Launching database docker container failed." sleep 6 # to wait about docker container runs totally RESTORE_COMMAND="$docker_cmd run -it --rm --link ${POSTGRES_DOCKER_NAME}:db -v ${DUMP_DIR}:/backup -e PGHOST=`$docker_cmd inspect -f \"{{ .NetworkSettings.IPAddress }}\" ${POSTGRES_DOCKER_NAME}` -e PGUSER=postgres postgres:${POSTGRES_VERSION} pg_restore -d postgres /backup/${DUMP_FILE}" exec $RESTORE_COMMAND || error_and_quit "Failed to launch this command: ${CMD}"