Skip to content

Instantly share code, notes, and snippets.

@rac021
Created August 11, 2020 11:31
Show Gist options
  • Save rac021/2f3c207cebffdf4351efa8fdb9186bc2 to your computer and use it in GitHub Desktop.
Save rac021/2f3c207cebffdf4351efa8fdb9186bc2 to your computer and use it in GitHub Desktop.
#!/bin/bash
## ARG1 ( up / down )
## ARG2 ( Version ) 1.0 / 1.5
OP=${1:-"up"}
VER=${2:-"1.5"}
echo
echo "Operation : - $OP - "
echo
if [ "$OP" == "up" ] ; then
cd ../bdd
###################################################################
## Generate empty dorectories before launching postgres database ##
###################################################################
docker run --rm --name db \
-p 6789:5432 \
-v $(pwd)/dbs/:/var/lib/postgresql/data \
-e POSTGRES_PASSWORD=admin \
-d postgres mkdir -p /var/lib/postgresql/data/{pg_tblspc,pg_twophase,pg_stat,pg_stat_tmp,pg_replslot,pg_snapshots,pg_commit_ts,pg_logical/mappings,pg_logical/snapshots,pg_wal/archive_status}/
#####################
### Deploy DB #######
#####################
docker-compose up -d
cd ../AnaEE
########################
### Deploy COBY ########
########################
if [ "$VER" == "1.5" ] ; then
cd coby/coby-1.5
echo
echo "Deploy COBY-1.5"
echo
docker-compose up -d
else
cd coby/coby-1.0
echo
echo "Deploy COBY-1.0"
echo
docker-compose up -d
fi
elif [ "$OP" == "down" ] ; then
cd bdd
#####################
### Undeploy DB #####
#####################
docker-compose down
cd ..
########################
### Undeploy COBY ######
########################
if [ "$VER" == "1.5" ] ; then
echo
echo "unDeploy COBY-1.5"
echo
cd coby/coby-1.5
docker-compose down
else
cd coby/coby-1.0
echo
echo "unDeploy COBY-1.0"
echo
docker-compose down
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment