Skip to content

Instantly share code, notes, and snippets.

@r-k-b
Last active December 11, 2020 00:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save r-k-b/8593c9db6615b00c4e2f09061e59f9ac to your computer and use it in GitHub Desktop.
Save r-k-b/8593c9db6615b00c4e2f09061e59f9ac to your computer and use it in GitHub Desktop.
helper for starting hippo review apps
#!/usr/bin/env bash
set -e
usage() { echo "$0 usage:" && grep " .)\ #" $0; exit 0; }
[ $# -eq 0 ] && usage
while getopts ":hb:p:" arg; do
case $arg in
p) # Specify port prefix value. Any of: 80, 83, 84, 85, 86, 87.
portprefix=${OPTARG}
;;
b) # Specify branch name.
branch=${OPTARG}
;;
h | *) # Display help.
usage
;;
esac
done
echo "using ports in :${portprefix}xx"
echo "using branch ${branch}"
if [ -z "${portprefix}" ] || [ -z "${branch}" ]; then
usage
fi
if [ ! -d "${branch}" ]; then
git clone --single-branch --branch "${branch}" ../PHDSys-webapp "${branch}"
#echo ":${portprefix}xx = ${branch} " >> notes.md
echo "./start.sh -p ${portprefix} -b ${branch} &" >> all.sh
else
echo Reusing folder "${branch}"
skippedClone=1
fi
cat << EOF
---
# temporary review urls
## Hippo
- [HP](http://10.1.6.120:${portprefix}25/#login)
- [RT](http://10.1.6.120:${portprefix}21/#login)
- [WF](http://10.1.6.120:${portprefix}24/#login)
## TCM
- [HP](http://10.1.6.120:${portprefix}25/tcm/)
- [RT](http://10.1.6.120:${portprefix}21/tcm/)
- [WF](http://10.1.6.120:${portprefix}24/tcm/)
---
EOF
cd "${branch}"/hippo/tools/review-apps/
if [ "$skippedClone" ]; then
git pull
fi
export PROJECT_NAME=reviewP"${portprefix}"xx
export HOST_PORT_RT="${portprefix}"21
export HOST_PORT_WF="${portprefix}"24
export HOST_PORT_HP="${portprefix}"25
./up.sh
#!/usr/bin/env nix-shell
#!nix-shell ../PHDSys-webapp/hippo/shell.nix -i bash
set -e
usage() { echo "$0 usage:" && grep " .)\ #" $0; exit 0; }
[ $# -eq 0 ] && usage
while getopts ":hb:p:" arg; do
case $arg in
p) # Specify port prefix value. Any of: 80, 83, 84, 85, 86, 87.
portprefix=${OPTARG}
;;
h | *) # Display help.
usage
;;
esac
done
if [ -z "${portprefix}" ]; then
usage
fi
echo "stopping reviewapps using ports :${portprefix}xx"
cd $(docker inspect --format '{{index .Config.Labels "com.docker.compose.project.working_dir"}}' reviewp${portprefix}xx_proxy_1)
docker-compose -p "reviewp${portprefix}xx" down
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment