Last active
May 4, 2021 06:36
-
-
Save xverges/aaa0d624b4d9362bca21c0b6a5081ec3 to your computer and use it in GitHub Desktop.
Start my Biomage development environment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# Bash "strict mode", to help catch problems and bugs in the shell | |
# script. Every bash script you write should include this. See | |
# http://redsymbol.net/articles/unofficial-bash-strict-mode/ for | |
# details. | |
set -euo pipefail | |
MAIN="$(dirname "${BIOMAGE_DATA_PATH}")" | |
# Cleanup | |
# zombie api and ui | |
kill $(lsof -t -i :3000) 2> /dev/null && echo Killed zombie api || true | |
kill $(lsof -t -i :5000) 2> /dev/null && echo Killed zombie ui || true | |
# zombie containers | |
(cd ${MAIN}/worker && docker-compose stop --timeout 1) | |
(cd ${MAIN}/inframock && docker-compose stop --timeout 1) | |
# zombie resources | |
docker system prune --force | |
# ttab: https://github.com/mklement0/ttab | |
# tabset: https://github.com/jonathaneunice/iterm2-tab-set | |
# On zsh, DISABLE_AUTO_TITLE='true' for tabset to work | |
while read line | |
do | |
IFS=: read repo color task <<< ${line} | |
if [ -n "${task}" ]; then | |
ttab -d ${MAIN}/${repo} "tabset --color ${color} ${repo}.git; clear; git fetch --prune; git pull --ff-only" | |
ttab -d ${MAIN}/${repo} "tabset --color ${color} ${repo}.run; clear; echo '$(tput setaf 2)' Press a key to run ${(qq)task}, ^C to skip it '$(tput sgr 0)'; read -krs 1; ${task}" | |
fi | |
done <<EOM | |
inframock:pink:export restart="make run" && \${=restart} | |
# ^ make run already builds | |
api:cyan:export restart="make run" && npm ci && \${=restart} | |
# ^ Switching make's "npm install" to "npm ci" | |
worker:green:export restart="docker-compose up --build --force-recreate" && \${=restart} | |
# ^ Avoid make's prompt before build | |
pipeline:blue:export restart="eval make build && make run" && cd local-runner && npm ci && cd .. && \${=restart} | |
# ^ Switching make's "npm install" to "npm ci" | |
ui:lightgreen:export restart="npm start" && npm ci && \${=restart} | |
# ^ Switching make's "npm install" to "npm ci". Avoiding the useless "make build" | |
e2e-tests:salmon:npx cypress open | |
EOM | |
ttab -d ${MAIN}/biomage-utils " tabset utils; clear; git fetch --prune" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment