The main Bubble source repository. Contains the Bubble API server, the web UI, documentation and utilities. https://getbubblenow.com
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

bpatchfull 2.1 KiB

hace 4 años
hace 4 años
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/bin/bash
  2. #
  3. # Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/
  4. #
  5. #
  6. # Usage:
  7. #
  8. # bpatchfull hostname [norestart]
  9. #
  10. # hostname : the hostname of the bubble node to update
  11. # Usually you will have an entry in ~/.ssh/config to set the username and ssh key
  12. # norestart : If present, do not restart the API server after updating the jar file
  13. #
  14. # Patch the bubble.jar on a remote node.
  15. # This script updates the entire jar file, and takes a lot longer than bpatch
  16. #
  17. # You install the JDK on the remote node first: apt install openjdk-11-jdk-headless
  18. #
  19. SCRIPT="${0}"
  20. SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd)
  21. . ${SCRIPT_DIR}/bubble_common
  22. HOST=${1:?no host provided}
  23. NO_RESTART=${2}
  24. BUBBLE_SERVER_DIR="${SCRIPT_DIR}/../bubble-server"
  25. if [[ ! -d "${BUBBLE_SERVER_DIR}" ]] ; then
  26. die "bubble-server dir not found: ${BUBBLE_SERVER_DIR}"
  27. fi
  28. cd ${BUBBLE_SERVER_DIR}
  29. ANY_JAR=$(find "./target" -type f -name "bubble*.jar" | head -1 | wc -l | tr -d ' ')
  30. if [[ ${ANY_JAR} -eq 0 ]] ; then
  31. ANY_CHANGES=1
  32. else
  33. ANY_CHANGES=$(find "./src/main" -type f -newer "$(find "./target" -type f -name "bubble*.jar" | head -1)" | wc -l | tr -d ' ')
  34. fi
  35. if [[ ${ANY_CHANGES} -eq 0 ]] ; then
  36. echo "No changes, not repackaging jar"
  37. scp ./target/bubble*.jar ${HOST}:/tmp/bubble.jar || die "Error copying file to remote host ${HOST}"
  38. else
  39. if [[ ${ANY_JAR} -eq 0 ]] ; then
  40. echo "No bubble jar file found, rebuilding"
  41. else
  42. echo "Files changed, rebuilding bubble jar: "
  43. find "./src/main" -type f -newer "$(find "./target" -type f -name "bubble*.jar" | head -1)"
  44. fi
  45. mvn -DskipTests=true -Dcheckstyle.skip=true clean package || die "Error packaging jar"
  46. scp ./target/bubble*.jar ${HOST}:/tmp/bubble.jar || die "Error copying file to remote host ${HOST}"
  47. fi
  48. if [[ ! -z "${NO_RESTART}" && "${NO_RESTART}" == "norestart" ]] ; then
  49. echo "Patching but not restarting..."
  50. ssh ${HOST} "cat /tmp/bubble.jar > ~bubble/current/bubble.jar"
  51. else
  52. echo "Patching and restarting..."
  53. ssh ${HOST} "cat /tmp/bubble.jar > ~bubble/current/bubble.jar && supervisorctl restart bubble"
  54. fi