The main Bubble source repository. Contains the Bubble API server, the web UI, documentation and utilities. https://getbubblenow.com
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 

56 lignes
2.0 KiB

  1. #!/bin/bash
  2. #
  3. # Usage:
  4. #
  5. # bpatchfull hostname [norestart]
  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 updates the entire jar file, and takes a lot longer than bpatch
  13. #
  14. # You install the JDK on the remote node first: apt install openjdk-11-jdk-headless
  15. #
  16. SCRIPT="${0}"
  17. SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd)
  18. . ${SCRIPT_DIR}/bubble_common
  19. HOST=${1:?no host provided}
  20. NO_RESTART=${2}
  21. BUBBLE_SERVER_DIR="${SCRIPT_DIR}/../bubble-server"
  22. if [[ ! -d "${BUBBLE_SERVER_DIR}" ]] ; then
  23. die "bubble-server dir not found: ${BUBBLE_SERVER_DIR}"
  24. fi
  25. cd ${BUBBLE_SERVER_DIR}
  26. ANY_JAR=$(find "./target" -type f -name "bubble*.jar" | head -1 | wc -l | tr -d ' ')
  27. if [[ ${ANY_JAR} -eq 0 ]] ; then
  28. ANY_CHANGES=1
  29. else
  30. ANY_CHANGES=$(find "./src/main" -type f -newer "$(find "./target" -type f -name "bubble*.jar" | head -1)" | wc -l | tr -d ' ')
  31. fi
  32. if [[ ${ANY_CHANGES} -eq 0 ]] ; then
  33. echo "No changes, not repackaging jar"
  34. scp ./target/bubble*.jar ${HOST}:/tmp/bubble.jar || die "Error copying file to remote host ${HOST}"
  35. else
  36. if [[ ${ANY_JAR} -eq 0 ]] ; then
  37. echo "No bubble jar file found, rebuilding"
  38. else
  39. echo "Files changed, rebuilding bubble jar: "
  40. find "./src/main" -type f -newer "$(find "./target" -type f -name "bubble*.jar" | head -1)"
  41. fi
  42. mvn -DskipTests=true -Dcheckstyle.skip=true clean package || die "Error packaging jar"
  43. scp ./target/bubble*.jar ${HOST}:/tmp/bubble.jar || die "Error copying file to remote host ${HOST}"
  44. fi
  45. if [[ ! -z "${NO_RESTART}" && "${NO_RESTART}" == "norestart" ]] ; then
  46. echo "Patching but not restarting..."
  47. ssh ${HOST} "cat /tmp/bubble.jar > ~bubble/current/bubble.jar"
  48. else
  49. echo "Patching and restarting..."
  50. ssh ${HOST} "cat /tmp/bubble.jar > ~bubble/current/bubble.jar && supervisorctl restart bubble"
  51. fi