[ADD] Launch script: new 'psql' command to enter postgreSQL database
This commit is contained in:
parent
c5d430ee9b
commit
f332f6c32b
12
launch.sh
12
launch.sh
@ -95,6 +95,7 @@ show_help() {
|
|||||||
Python dependancies"
|
Python dependancies"
|
||||||
echo -e " - migrate Launch migration command:
|
echo -e " - migrate Launch migration command:
|
||||||
python manage.py migrate"
|
python manage.py migrate"
|
||||||
|
echo -e " - psql Enter PSQL database via psql command"
|
||||||
echo -e " - restore dump Restore the given dump"
|
echo -e " - restore dump Restore the given dump"
|
||||||
echo -e " - start [arg ...] Launch Gissmo Docker container
|
echo -e " - start [arg ...] Launch Gissmo Docker container
|
||||||
(created by 'create' command) with a name given
|
(created by 'create' command) with a name given
|
||||||
@ -118,6 +119,8 @@ check_command() {
|
|||||||
return 0
|
return 0
|
||||||
elif test $1 == "init"; then
|
elif test $1 == "init"; then
|
||||||
return 0
|
return 0
|
||||||
|
elif test $1 == "psql"; then
|
||||||
|
return 0
|
||||||
elif test $1 == "migrate"; then
|
elif test $1 == "migrate"; then
|
||||||
return 0
|
return 0
|
||||||
elif test $1 == "restore"; then
|
elif test $1 == "restore"; then
|
||||||
@ -261,6 +264,15 @@ test_restore() {
|
|||||||
DUMP_DIR="${ARGS%/*}"
|
DUMP_DIR="${ARGS%/*}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
psql() {
|
||||||
|
test_postgresql_launched
|
||||||
|
if [ $? -eq 1 ]; then
|
||||||
|
$docker_cmd start ${POSTGRES_DOCKER_NAME}
|
||||||
|
sleep 4 # wait postgreSQL database to be fully launched
|
||||||
|
fi
|
||||||
|
$docker_cmd run -it --link ${POSTGRES_DOCKER_NAME}:db --rm postgres sh -c 'exec psql -h "$DB_PORT_5432_TCP_ADDR" -p "$DB_PORT_5432_TCP_PORT" -U postgres' || error_and_quit "Failed to connect to postgreSQL Docker container."
|
||||||
|
}
|
||||||
|
|
||||||
restore() {
|
restore() {
|
||||||
test_create
|
test_create
|
||||||
test_restore
|
test_restore
|
||||||
|
Loading…
Reference in New Issue
Block a user