Skip to content

Instantly share code, notes, and snippets.

@wichopy
Created May 1, 2018 00:53
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 wichopy/bbd26c318f2cd1d75d533aef5317928f to your computer and use it in GitHub Desktop.
Save wichopy/bbd26c318f2cd1d75d533aef5317928f to your computer and use it in GitHub Desktop.
Redeploy server war and restart postgres docker container locally.
#!/bin/bash
echo "Stop tomcat";
/Library/Tomcat/bin/shutdown.sh;
echo "Restart postgres container";
#Assuming you have docker, with a postgres container running called local-postgres. The postgres container can be renamed in the docker run command.
docker stop local-postgres;
docker rm local-postgres;
docker run --name local-postgres -e POSTGRES_USER=user -e POSTGRES_DB=db -d -p 5432:5432 postgres;
echo "Package server war";
mvn clean package war:war;
echo "Deploy to local tomcat";
cp target/server.war /usr/local/tomcat/webapps/server.war;
echo "Start tomcat";
/Library/Tomcat/bin/startup.sh;
echo "Wait for server to start";
#Assuming you have npm package wait-on globally installed with `npm install -g wait-on`
wait-on http://localhost:8080/server/swagger-ui && echo "Done restarting server + postgres container"; # wait for http 2XX HEAD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment