[UP] Launch script so that some line don't take more than 80 chars
This commit is contained in:
parent
fd70112911
commit
6d97d5e9ac
52
launch.sh
52
launch.sh
@ -28,7 +28,8 @@ if test -z "$GISSMO_CFG"; then
|
|||||||
if ! test -f ${CONFIG_FILE}; then
|
if ! test -f ${CONFIG_FILE}; then
|
||||||
CONFIG_FILE="${PWD}/${CONFIG_FILENAME}"
|
CONFIG_FILE="${PWD}/${CONFIG_FILENAME}"
|
||||||
if ! test -f ${CONFIG_FILE}; then
|
if ! test -f ${CONFIG_FILE}; then
|
||||||
echo "'config' file not found. Use 'config.example' file and copy it to 'config' one either in ${CONFIG_DEFAULT_DIR} or ${PWD}. Then try again!"
|
echo "'config' file not found. Use 'config.example' file and copy it \\
|
||||||
|
to 'config' one either in ${CONFIG_DEFAULT_DIR} or ${PWD}. Then try again!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -82,21 +83,21 @@ not_implemented() {
|
|||||||
show_help() {
|
show_help() {
|
||||||
echo "$PROGRAM COMMAND [arg ...]"
|
echo "$PROGRAM COMMAND [arg ...]"
|
||||||
echo -e " Where ${green}COMMAND${reset} is one of:"
|
echo -e " Where ${green}COMMAND${reset} is one of:"
|
||||||
echo -e " - create Create postgreSQL database volume and \\
|
echo -e " - create Create postgreSQL database volume and \
|
||||||
postgreSQL Docker container"
|
postgreSQL Docker container"
|
||||||
echo -e " - dev [arg ...] Mount Git repository directory AS VOLUME \\
|
echo -e " - dev [arg ...] Mount Git repository directory AS VOLUME \
|
||||||
for Gissmo Docker container and launch it in \\
|
for Gissmo Docker container and launch it in \
|
||||||
'development' mode"
|
'development' mode"
|
||||||
echo -e " - init Create project directory as python virtual \\
|
echo -e " - init Create project directory as python virtual \
|
||||||
environment, fetch git repository and install \\
|
environment, fetch git repository and install \
|
||||||
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 " - 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 \
|
||||||
in GISSMO_DOCKER_NAME variable. args is optional."
|
in GISSMO_DOCKER_NAME variable. args is optional."
|
||||||
echo -e " - stop Stop Gissmo Docker container which name is \\
|
echo -e " - stop Stop Gissmo Docker container which name is \
|
||||||
GISSMO_DOCKER_NAME variable content"
|
GISSMO_DOCKER_NAME variable content"
|
||||||
echo ""
|
echo ""
|
||||||
echo "For an example you can use it in this order:"
|
echo "For an example you can use it in this order:"
|
||||||
@ -110,10 +111,13 @@ show_help() {
|
|||||||
echo -e " $PROGRAM start python manage.py shell"
|
echo -e " $PROGRAM start python manage.py shell"
|
||||||
echo -e " $PROGRAM stop"
|
echo -e " $PROGRAM stop"
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "If GISSMO_CFG used, you can specify another configuration file. Example:"
|
echo -e "If GISSMO_CFG used, you can specify another configuration file. \
|
||||||
|
Example:"
|
||||||
echo ""
|
echo ""
|
||||||
echo -e " GISSMO_CFG=~/new_config $PROGRAM"
|
echo -e " GISSMO_CFG=~/new_config $PROGRAM"
|
||||||
# TODO: Add clean() command with args to: STOP and DELETE Gissmo container, STOP and DELETE postgreSQL container, DELETE dbdata OR do all these thing into one.
|
# TODO: Add clean() command with args to: STOP and DELETE Gissmo container,
|
||||||
|
# STOP and DELETE postgreSQL container, DELETE dbdata OR do all these
|
||||||
|
# things into one.
|
||||||
}
|
}
|
||||||
|
|
||||||
check_command() {
|
check_command() {
|
||||||
@ -140,7 +144,8 @@ check_command() {
|
|||||||
|
|
||||||
test_docker_cmd() {
|
test_docker_cmd() {
|
||||||
if test -z "$docker_cmd"; then
|
if test -z "$docker_cmd"; then
|
||||||
error_and_quit "Docker command not found. Install docker or fill in the PATH."
|
error_and_quit "Docker command not found. Install docker or fill\
|
||||||
|
in the PATH."
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -166,13 +171,16 @@ test_create() {
|
|||||||
error_and_quit "No database directory given (DB_DIR in config file)."
|
error_and_quit "No database directory given (DB_DIR in config file)."
|
||||||
fi
|
fi
|
||||||
if test -z "$DB_VOLUME_NAME"; then
|
if test -z "$DB_VOLUME_NAME"; then
|
||||||
error_and_quit "No database volume name given (DB_VOLUME_NAME in config file)."
|
error_and_quit "No database volume name given (DB_VOLUME_NAME in \
|
||||||
|
config file)."
|
||||||
fi
|
fi
|
||||||
if test -z "$POSTGRES_VERSION"; then
|
if test -z "$POSTGRES_VERSION"; then
|
||||||
error_and_quit "No postgres version given (POSTGRES_VERSION in config file)."
|
error_and_quit "No postgres version given (POSTGRES_VERSION in \
|
||||||
|
config file)."
|
||||||
fi
|
fi
|
||||||
if test -z "$POSTGRES_DOCKER_NAME"; then
|
if test -z "$POSTGRES_DOCKER_NAME"; then
|
||||||
error_and_quit "You need a name for your Docker database container (POSTGRES_DOCKER_NAME in config file)."
|
error_and_quit "You need a name for your Docker database container \
|
||||||
|
(POSTGRES_DOCKER_NAME in config file)."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,7 +198,8 @@ dev() {
|
|||||||
if [ $? -eq 1 ]; then
|
if [ $? -eq 1 ]; then
|
||||||
$docker_cmd run -it --rm --link ${POSTGRES_DOCKER_NAME}:db -p ${GISSMO_DOCKER_PORT}:8000 -v ${GISSMO_DIR}:/opt/gissmo --name ${GISSMO_DOCKER_NAME} gissmo:${GISSMO_VERSION} ${ARGS:='development'} || error_and_quit "Failed to create and launch ${GISSMO_DOCKER_NAME} container."
|
$docker_cmd run -it --rm --link ${POSTGRES_DOCKER_NAME}:db -p ${GISSMO_DOCKER_PORT}:8000 -v ${GISSMO_DIR}:/opt/gissmo --name ${GISSMO_DOCKER_NAME} gissmo:${GISSMO_VERSION} ${ARGS:='development'} || error_and_quit "Failed to create and launch ${GISSMO_DOCKER_NAME} container."
|
||||||
else
|
else
|
||||||
error_and_quit "${GISSMO_DOCKER_NAME} is already launched! If you need another name please set GISSMO_DOCKER_NAME in configuration file."
|
error_and_quit "${GISSMO_DOCKER_NAME} is already launched! If you need \
|
||||||
|
another name please set GISSMO_DOCKER_NAME in configuration file."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,7 +228,8 @@ init() {
|
|||||||
fi
|
fi
|
||||||
. bin/activate || error_and_quit "Failed entering python virtual environment"
|
. bin/activate || error_and_quit "Failed entering python virtual environment"
|
||||||
cd $GISSMO_DIR
|
cd $GISSMO_DIR
|
||||||
pip install -q -r requirements.txt || error_and_quit "Python dependancies installation failed."
|
pip install -q -r requirements.txt || error_and_quit "Python dependancies \
|
||||||
|
installation failed."
|
||||||
info "Python dependancies checked."
|
info "Python dependancies checked."
|
||||||
deactivate || error_and_quit "Failed exiting python virtual environment."
|
deactivate || error_and_quit "Failed exiting python virtual environment."
|
||||||
}
|
}
|
||||||
@ -264,7 +274,8 @@ test_initial_start() {
|
|||||||
error_and_quit "Docker file don't exists: ${DOCKERFILE}"
|
error_and_quit "Docker file don't exists: ${DOCKERFILE}"
|
||||||
fi
|
fi
|
||||||
if test -z "$GISSMO_DOCKER_PORT"; then
|
if test -z "$GISSMO_DOCKER_PORT"; then
|
||||||
error_and_quit "No Gissmo Docker container port given (GISSMO_DOCKER_PORT in config file)."
|
error_and_quit "No Gissmo Docker container port given \
|
||||||
|
(GISSMO_DOCKER_PORT in config file)."
|
||||||
fi
|
fi
|
||||||
test_postgresql_exists
|
test_postgresql_exists
|
||||||
}
|
}
|
||||||
@ -291,7 +302,8 @@ start() {
|
|||||||
if [ $? -eq 1 ]; then
|
if [ $? -eq 1 ]; then
|
||||||
$docker_cmd run -it --rm --link ${POSTGRES_DOCKER_NAME}:db -p ${GISSMO_DOCKER_PORT}:8000 -e SECRET_KEY="abcdefg" --name ${GISSMO_DOCKER_NAME} gissmo:${GISSMO_VERSION} $ARGS || error_and_quit "Failed to create and launch ${GISSMO_DOCKER_NAME} container."
|
$docker_cmd run -it --rm --link ${POSTGRES_DOCKER_NAME}:db -p ${GISSMO_DOCKER_PORT}:8000 -e SECRET_KEY="abcdefg" --name ${GISSMO_DOCKER_NAME} gissmo:${GISSMO_VERSION} $ARGS || error_and_quit "Failed to create and launch ${GISSMO_DOCKER_NAME} container."
|
||||||
else
|
else
|
||||||
error_and_quit "${GISSMO_DOCKER_NAME} is already launched! If you need another name please set GISSMO_DOCKER_NAME in configuration file."
|
error_and_quit "${GISSMO_DOCKER_NAME} is already launched! If you need \
|
||||||
|
another name please set GISSMO_DOCKER_NAME in configuration file."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user