The main Bubble source repository. Contains the Bubble API server, the web UI, documentation and utilities. https://getbubblenow.com
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 

62 行
2.3 KiB

  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 [user@]hostname [norestart]
  9. #
  10. # [user@]hostname : the hostname of the bubble node to update. Optionally, also specify a username.
  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. 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. ANY_JAR=$(find "./target" -type f -name "bubble*.jar" | head -1 | wc -l | tr -d ' ')
  28. if [[ ${ANY_JAR} -eq 0 ]] ; then
  29. ANY_CHANGES=1
  30. else
  31. ANY_CHANGES=$(find "./src/main" -type f -newer "$(find "./target" -type f -name "bubble*.jar" | head -1)" | wc -l | tr -d ' ')
  32. fi
  33. if [[ ${ANY_CHANGES} -eq 0 ]] ; then
  34. echo "No changes, not repackaging jar"
  35. scp ./target/bubble*.jar ${HOST}:/tmp/bubble.jar || die "Error copying file to remote host ${HOST}"
  36. else
  37. if [[ ${ANY_JAR} -eq 0 ]] ; then
  38. echo "No bubble jar file found, rebuilding"
  39. else
  40. echo "Files changed, rebuilding bubble jar: "
  41. find "./src/main" -type f -newer "$(find "./target" -type f -name "bubble*.jar" | head -1)"
  42. fi
  43. BUBBLE_PRODUCTION=1 mvn -DskipTests=true -Dcheckstyle.skip=true clean package || die "Error packaging jar"
  44. scp ./target/bubble*.jar ${HOST}:/tmp/bubble.jar || die "Error copying file to remote host ${HOST}"
  45. fi
  46. if [[ ! -z "${NO_RESTART}" && "${NO_RESTART}" == "norestart" ]] ; then
  47. echo "Patching but not restarting..."
  48. ssh ${HOST} "cat /tmp/bubble.jar > ~bubble/api/bubble.jar"
  49. else
  50. echo "Patching and restarting..."
  51. ssh ${HOST} "cat /tmp/bubble.jar > ~bubble/api/bubble.jar && supervisorctl restart bubble"
  52. fi
  53. if unzip -Z -1 ./target/bubble*.jar | grep -q "^site/$" ; then
  54. echo "Deploying new web..."
  55. ssh ${HOST} "cd ~bubble && unzip -o /tmp/bubble.jar 'site/*' && chown -R bubble:bubble site"
  56. fi