Mercurial > public > ssdt-docker
comparison scripts/.functions.sh @ 85:8f45c43ea7a4 feature/djs-DEP-12-docker
DEP-12: start upgrading scripts and compose files for RC and docker 1.12
author | Dave Smith <smith@nwoca.org> |
---|---|
date | Wed, 21 Sep 2016 19:00:41 -0400 |
parents | 85957628f4c0 |
children | c029be781d13 |
comparison
equal
deleted
inserted
replaced
84:36d4c33e43a3 | 85:8f45c43ea7a4 |
---|---|
1 #!/bin/bash | 1 #!/bin/bash |
2 export SSDT_SCRIPTS=$(dirname "${BASH_SOURCE[0]}") | |
3 export SSDT_HOME=$(dirname $SSDT_SCRIPTS) | |
2 | 4 |
3 # deletes psql data from specified service | 5 # deletes psql data from specified service |
4 resetDbVolume() { | 6 resetDbVolume() { |
5 # Works for named and unnamed volumes and custom $PGDATA. | 7 # Works for named and unnamed volumes and custom $PGDATA. |
6 # Container must be stopped | 8 # Container must be stopped |
25 service=${1?Must supply db service to execute against} | 27 service=${1?Must supply db service to execute against} |
26 container=$(composeGetContainer $service) | 28 container=$(composeGetContainer $service) |
27 | 29 |
28 echo "$2" | docker exec -i $container sh -c "gosu postgres psql \$DB_NAME" | 30 echo "$2" | docker exec -i $container sh -c "gosu postgres psql \$DB_NAME" |
29 } | 31 } |
32 | |
33 composeGetProject() { | |
34 service=${1?"Must supply service from current project"} | |
35 container=$(composeGetContainer $service) | |
36 echo $(docker inspect -f '{{index .Config.Labels "com.docker.compose.project" }}' $container) | |
37 } |