[ADD] Launch script: export command to have a dump of postgreSQL
This commit is contained in:
parent
412ac87007
commit
c5d430ee9b
9
TODO
9
TODO
@ -1,6 +1,13 @@
|
||||
# Scripts
|
||||
|
||||
## À faire
|
||||
|
||||
* Faire un script qui lance l'environnement complet pour le test et les lance
|
||||
|
||||
## Terminés
|
||||
|
||||
* Faire un script de déploiement Docker :
|
||||
* avec un dump possible de la base
|
||||
* des variables OBLIGATOIRES pour définir le répertoire dans lequel sera la base, la version postgres à utiliser et la version Gissmo courante + le fichier Docker
|
||||
* Faire un script qui lance l'environnement complet pour le test et les lance
|
||||
* DUMP pour le script via : docker run -it --rm --volume $PWD/:/tmp/ --link gissmo_db:db postgres:9.5 bash -c 'exec pg_dump -F c -h "$DB_PORT_5432_TCP_ADDR" -p "$DB_PORT_5432_TCP_PORT" -U postgres postgres > /tmp/gissmo-$(date +"%Y.%m.%d-%H%M").dump'
|
||||
|
||||
|
20
launch.sh
20
launch.sh
@ -88,6 +88,8 @@ show_help() {
|
||||
echo -e " - dev [arg ...] Mount Git repository directory AS VOLUME
|
||||
for Gissmo Docker container and launch it in
|
||||
'development' mode"
|
||||
echo -e " - export Create a compressed postgreSQL database dump
|
||||
in current directory"
|
||||
echo -e " - init Create project directory as python virtual
|
||||
environment, fetch git repository and install
|
||||
Python dependancies"
|
||||
@ -112,6 +114,8 @@ check_command() {
|
||||
return 0
|
||||
elif test $1 == "dev"; then
|
||||
return 0
|
||||
elif test $1 == "export"; then
|
||||
return 0
|
||||
elif test $1 == "init"; then
|
||||
return 0
|
||||
elif test $1 == "migrate"; then
|
||||
@ -189,6 +193,22 @@ another name please set GISSMO_DOCKER_NAME in configuration file."
|
||||
fi
|
||||
}
|
||||
|
||||
test_export() {
|
||||
# Check postgreSQL Docker container exists and is launched.
|
||||
test_postgresql_launched
|
||||
if [ $? -eq 1 ]; then
|
||||
$docker_cmd start ${POSTGRES_DOCKER_NAME}
|
||||
fi
|
||||
}
|
||||
|
||||
export() {
|
||||
# Check all variables are availables
|
||||
test_create
|
||||
# Then check some specific things for dump method
|
||||
test_export
|
||||
$docker_cmd run -it --rm --volume $PWD/:/tmp/ --link ${POSTGRES_DOCKER_NAME}:db postgres:${POSTGRES_VERSION} bash -c 'exec pg_dump -F c -h "$DB_PORT_5432_TCP_ADDR" -p "$DB_PORT_5432_TCP_PORT" -U postgres postgres > /tmp/gissmo-`date +"%Y.%m.%d.%H%M"`-'${GISSMO_VERSION}'.dump' || error_and_quit "Failed to export Gissmo database."
|
||||
}
|
||||
|
||||
init() {
|
||||
# check directory existence
|
||||
if ! test -d "$PROJECT_DIR"; then
|
||||
|
Loading…
Reference in New Issue
Block a user