Skip to content

Commit

Permalink
added clean command
Browse files Browse the repository at this point in the history
  • Loading branch information
jmlord committed Nov 16, 2023
1 parent c8b2740 commit a8a7fe1
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions prod-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ function help {
echo " up Start the server, accessible in http://localhost"
echo " stop Stops the server"
echo " validate Run basic basic validation on pipelines and scripts. "
echo " clean Removes the docker containers of all services."
echo " This is useful in development switching from prod to dev server,"
echo " in cases when we get the following error:"
echo " \"The container name ... is already in use by container ...\""
echo " command [ARGS...] Run an arbitrary docker compose command,"
echo " such as (pull|run|up|down|build|logs)"
echo
Expand All @@ -45,7 +49,6 @@ function command { # args appended to the docker compose command
assertSuccess
}

# Run basic validation
function validate {
get_server $branch

Expand All @@ -72,8 +75,8 @@ function validate {
assertSuccess
}

function checkout { # Mandatory arg 1: branch name of server repo
branch=$1
function checkout {
branch=$1 # Mandatory arg 1: branch name of server repo

echo "Updating server files..."
git checkout origin/$branch -- .prod-paths.env ; assertSuccess
Expand All @@ -100,11 +103,15 @@ function up {
echo "Done."
}

# Stops the production server.
function down {
command down
}

function clean {
docker container rm http-rev-prox biab-ui biab-script-server \
biab-tiler biab-runner-r biab-runner-julia
}

case "$1" in
help)
help
Expand All @@ -125,6 +132,9 @@ case "$1" in
shift
command $@
;;
clean)
clean
;;
*)
help
exit 1
Expand Down

0 comments on commit a8a7fe1

Please sign in to comment.