add persistence flag, which by default is yes

progress for #2 (resolves idhub persisten needs)

and you have to explicitly say when you don't want it
This commit is contained in:
pedro 2024-02-06 14:29:14 +01:00
parent 68f9a64e4c
commit 24739e3983
2 changed files with 15 additions and 4 deletions

View File

@ -10,6 +10,7 @@ common_start() {
deployment="${1:-${deployment:-}}"
action="${action:-deploy}"
persistence="${persistence:-y}"
# detach on production deployment
if [ "${deployment}" = 'prod' ]; then
@ -29,12 +30,23 @@ common_start() {
idhub="${idhub:-idhub__${target}}"
idhub1="${idhub1:-idhub1__${target}}"
idhub2="${idhub2:-idhub2__${target}}"
if [ "${persistence}" = "n" ]; then
# no data persistence: cleanup previous possible data
rm -rf "./${idhub}"
fi
}
common_end() {
dc_file="docker-compose__${target}.yml"
docker compose -p ${target} -f ${dc_file} down -v || true
if [ "${persistence}" = "n" ]; then
# no data persistence, then cleanup docker volume
vol_arg='-v'
fi
docker compose -p ${target} -f ${dc_file} down ${vol_arg:-} || true
make idhub_build
if [ "${action:-}" = "deploy" ]; then

View File

@ -17,10 +17,9 @@ main() {
idhub="idhub__${target}"
common_start
persistence='n'
# no data persistence: cleanup previous possible data
rm -rf "./${idhub}"
common_start
# detect if is new
if [ ! -f "./${idhub}" ]; then