The main Bubble source repository. Contains the Bubble API server, the web UI, documentation and utilities. https://getbubblenow.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

38 line
1.6 KiB

  1. #!/bin/bash
  2. #
  3. # Usage:
  4. #
  5. # bpatch hostname
  6. #
  7. # hostname : the hostname of the bubble node to update
  8. # Usually you will have an entry in ~/.ssh/config to set the username and ssh key
  9. # norestart : If present, do not restart the API server after updating the jar file
  10. #
  11. # Patch the bubble.jar on a remote node.
  12. # This script only works if the only classes that have changed are in the bubble-server codebase.
  13. # If other classes have changed, use bpatchfull
  14. #
  15. # You install the JDK on the remote node first: apt install openjdk-11-jdk-headless
  16. #
  17. SCRIPT="${0}"
  18. SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd)
  19. . ${SCRIPT_DIR}/bubble_common
  20. HOST=${1:?no host provided}
  21. NO_RESTART=${2}
  22. BUBBLE_SERVER_DIR="${SCRIPT_DIR}/../bubble-server"
  23. if [[ ! -d "${BUBBLE_SERVER_DIR}" ]] ; then
  24. die "bubble-server dir not found: ${BUBBLE_SERVER_DIR}"
  25. fi
  26. cd ${BUBBLE_SERVER_DIR}
  27. mvn -DskipTests=true -Dcheckstyle.skip=true compile && rsync -avzc ./target/classes ${HOST}:/tmp/ | egrep -v '*/$' || die "Error recompiling classes"
  28. if [[ ! -z "${NO_RESTART}" && "${NO_RESTART}" == "norestart" ]] ; then
  29. echo "Patching but not restarting..."
  30. ssh ${HOST} "cd /tmp && cp ~bubble/current/bubble.jar . && cd classes && jar uvf ../bubble.jar . | egrep -v '*/\(*' && cat ../bubble.jar > ~bubble/current/bubble.jar" || die "Error patching remote jar"
  31. else
  32. echo "Patching and restarting..."
  33. ssh ${HOST} "cd /tmp && cp ~bubble/current/bubble.jar . && cd classes && jar uvf ../bubble.jar . | egrep -v '*/\(*' && cat ../bubble.jar > ~bubble/current/bubble.jar && supervisorctl restart bubble" || die "Error patching remote jar"
  34. fi