github.com/unigraph-dev/dgraph@v1.1.1-0.20200923154953-8b52b426f765/compose/run.sh (about) 1 #!/bin/bash 2 3 readonly ME=${0##*/} 4 readonly DGRAPH_ROOT=${GOPATH:-$HOME}/src/github.com/dgraph-io/dgraph 5 readonly COMPOSE_FILE="./docker-compose.yml" 6 7 if [[ $1 == "-h" || $1 == "--help" ]]; then 8 cat <<EOF 9 usage: ./run.sh [./compose args ...] 10 11 description: 12 13 Without arguments, rebuild dgraph and bring up the docker-compose.yml 14 config found here. 15 16 With arguments, pass them all to ./compose to create a docker-compose.yml 17 file first, then rebuild dgraph and bring up the config. 18 EOF 19 exit 0 20 fi 21 22 function Info { 23 echo -e "INFO: $*" 24 } 25 26 # 27 # MAIN 28 # 29 30 set -e 31 32 if [[ $# -gt 0 ]]; then 33 Info "creating compose file ..." 34 go build compose.go 35 ./compose "$@" 36 fi 37 38 if [[ ! -e $COMPOSE_FILE ]]; then 39 echo >&2 "$ME: no $COMPOSE_FILE found" 40 exit 1 41 fi 42 43 Info "rebuilding dgraph ..." 44 ( cd $DGRAPH_ROOT/dgraph && make install ) 45 46 # No need to down existings containers, if any. 47 # The up command handles that automatically 48 49 Info "bringing up containers" 50 docker-compose -p dgraph up --force-recreate --remove-orphans