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.

4 jaren geleden
4 jaren geleden
4 jaren geleden
Introduce packer support (#18) cleanups and fixes, packer is ready to roll add errorApi endpoint initialize mitmproxy dependencies packer deployments finally working fix virtualenv call for ubuntu 20.04 WIP. update to ubuntu 20.04. fixing algo installation WIP. packer fixes remove unused constant WIP. packer basics working for ec2 Merge branch 'master' of git.bubblev.org:bubblev/bubble into cobbzilla/introduce_packer remove automation dir, all moved to resources log pg autovacuum if longer than 250ms touch install marker for algo set mitmproxy as owner of all mitmproxy files add hostname to packer image name avoid closing progress meter prematurely WIP. parallelize node startup, fix packer bugs clarify docs add missing vars, algo tweaks add missing vars, update algo hash WIP. improving algo/mitmproxy packer stuff install packer for sage, call packer from proper location Use compute driver to get regions improve comments wait longer before polling new vultr server, avoid spurious ok status unquote simple filenames WIP. Use packer key, no more instance ssh key. Change API installation. Simplify packer/ansible. rename bubble_finalizer to just finalizer, remove default_roles filter servers/images based on installType for now, consider packer image OK if bubble version matches add algo/mitm roles to packer. add installType to BubbleNode fix NODE_ROLES file templatize packer file and playbook, use same template for sage and node WIP: refactor addAllRegions WIP: do not re-create identical images WIP: packer build for vultr now working Merge branch 'master' of git.bubblev.org:bubblev/bubble into cobbzilla/introduce_packer WIP. working on vultr packer builds WIP: packer image creation working for digitalocean WIP: packer basics working for digitalocean add packer endpoints, introduce packer support to cloud compute drivers remove roles endpoints AnsibleRole is no longer an model entity. Introduce Packer. Merge branch 'sfedoriv/APIAddSupportForAmazonEC2ComputeCloudService' of git.bubblev.org:bubblev/bubble into sfedoriv/APIAddSupportForAmazonEC2ComputeCloudService Merge branch 'master' of git.bubblev.org:bubblev/bubble into sfedoriv/APIAddSupportForAmazonEC2ComputeCloudService Merge branch 'master' into sfedoriv/APIAddSupportForAmazonEC2ComputeCloudService Merge branch 'master' into sfedoriv/APIAddSupportForAmazonEC2ComputeCloudService Merge branch 'master' into sfedoriv/APIAddSupportForAmazonEC2ComputeCloudService Merge branch 'master' into sfedoriv/APIAddSupportForAmazonEC2ComputeCloudService Add instance count to script Co-authored-by: Jonathan Cobb <jonathan@kyuss.org> Co-authored-by: Svitlana <sfedoriv@itekako.com> Reviewed-on: https://git.bubblev.org/bubblev/bubble/pulls/18
4 jaren geleden
4 jaren geleden
Introduce packer support (#18) cleanups and fixes, packer is ready to roll add errorApi endpoint initialize mitmproxy dependencies packer deployments finally working fix virtualenv call for ubuntu 20.04 WIP. update to ubuntu 20.04. fixing algo installation WIP. packer fixes remove unused constant WIP. packer basics working for ec2 Merge branch 'master' of git.bubblev.org:bubblev/bubble into cobbzilla/introduce_packer remove automation dir, all moved to resources log pg autovacuum if longer than 250ms touch install marker for algo set mitmproxy as owner of all mitmproxy files add hostname to packer image name avoid closing progress meter prematurely WIP. parallelize node startup, fix packer bugs clarify docs add missing vars, algo tweaks add missing vars, update algo hash WIP. improving algo/mitmproxy packer stuff install packer for sage, call packer from proper location Use compute driver to get regions improve comments wait longer before polling new vultr server, avoid spurious ok status unquote simple filenames WIP. Use packer key, no more instance ssh key. Change API installation. Simplify packer/ansible. rename bubble_finalizer to just finalizer, remove default_roles filter servers/images based on installType for now, consider packer image OK if bubble version matches add algo/mitm roles to packer. add installType to BubbleNode fix NODE_ROLES file templatize packer file and playbook, use same template for sage and node WIP: refactor addAllRegions WIP: do not re-create identical images WIP: packer build for vultr now working Merge branch 'master' of git.bubblev.org:bubblev/bubble into cobbzilla/introduce_packer WIP. working on vultr packer builds WIP: packer image creation working for digitalocean WIP: packer basics working for digitalocean add packer endpoints, introduce packer support to cloud compute drivers remove roles endpoints AnsibleRole is no longer an model entity. Introduce Packer. Merge branch 'sfedoriv/APIAddSupportForAmazonEC2ComputeCloudService' of git.bubblev.org:bubblev/bubble into sfedoriv/APIAddSupportForAmazonEC2ComputeCloudService Merge branch 'master' of git.bubblev.org:bubblev/bubble into sfedoriv/APIAddSupportForAmazonEC2ComputeCloudService Merge branch 'master' into sfedoriv/APIAddSupportForAmazonEC2ComputeCloudService Merge branch 'master' into sfedoriv/APIAddSupportForAmazonEC2ComputeCloudService Merge branch 'master' into sfedoriv/APIAddSupportForAmazonEC2ComputeCloudService Merge branch 'master' into sfedoriv/APIAddSupportForAmazonEC2ComputeCloudService Add instance count to script Co-authored-by: Jonathan Cobb <jonathan@kyuss.org> Co-authored-by: Svitlana <sfedoriv@itekako.com> Reviewed-on: https://git.bubblev.org/bubblev/bubble/pulls/18
4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
Introduce packer support (#18) cleanups and fixes, packer is ready to roll add errorApi endpoint initialize mitmproxy dependencies packer deployments finally working fix virtualenv call for ubuntu 20.04 WIP. update to ubuntu 20.04. fixing algo installation WIP. packer fixes remove unused constant WIP. packer basics working for ec2 Merge branch 'master' of git.bubblev.org:bubblev/bubble into cobbzilla/introduce_packer remove automation dir, all moved to resources log pg autovacuum if longer than 250ms touch install marker for algo set mitmproxy as owner of all mitmproxy files add hostname to packer image name avoid closing progress meter prematurely WIP. parallelize node startup, fix packer bugs clarify docs add missing vars, algo tweaks add missing vars, update algo hash WIP. improving algo/mitmproxy packer stuff install packer for sage, call packer from proper location Use compute driver to get regions improve comments wait longer before polling new vultr server, avoid spurious ok status unquote simple filenames WIP. Use packer key, no more instance ssh key. Change API installation. Simplify packer/ansible. rename bubble_finalizer to just finalizer, remove default_roles filter servers/images based on installType for now, consider packer image OK if bubble version matches add algo/mitm roles to packer. add installType to BubbleNode fix NODE_ROLES file templatize packer file and playbook, use same template for sage and node WIP: refactor addAllRegions WIP: do not re-create identical images WIP: packer build for vultr now working Merge branch 'master' of git.bubblev.org:bubblev/bubble into cobbzilla/introduce_packer WIP. working on vultr packer builds WIP: packer image creation working for digitalocean WIP: packer basics working for digitalocean add packer endpoints, introduce packer support to cloud compute drivers remove roles endpoints AnsibleRole is no longer an model entity. Introduce Packer. Merge branch 'sfedoriv/APIAddSupportForAmazonEC2ComputeCloudService' of git.bubblev.org:bubblev/bubble into sfedoriv/APIAddSupportForAmazonEC2ComputeCloudService Merge branch 'master' of git.bubblev.org:bubblev/bubble into sfedoriv/APIAddSupportForAmazonEC2ComputeCloudService Merge branch 'master' into sfedoriv/APIAddSupportForAmazonEC2ComputeCloudService Merge branch 'master' into sfedoriv/APIAddSupportForAmazonEC2ComputeCloudService Merge branch 'master' into sfedoriv/APIAddSupportForAmazonEC2ComputeCloudService Merge branch 'master' into sfedoriv/APIAddSupportForAmazonEC2ComputeCloudService Add instance count to script Co-authored-by: Jonathan Cobb <jonathan@kyuss.org> Co-authored-by: Svitlana <sfedoriv@itekako.com> Reviewed-on: https://git.bubblev.org/bubblev/bubble/pulls/18
4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. # Run Bubble server or CLI commands. A wrapper for starting a JVM to run Bubble programs.
  7. #
  8. # Usage: run.sh [debug [debug-port]] [command] [args]
  9. #
  10. # All arguments are optional:
  11. #
  12. # debug : if the first argument is the literal string 'debug' then immediately after starting,
  13. # the Java process will wait for a debugger to attach. Default is not to enable debugging.
  14. # debug-port : the port that will be listened on for the debugger. Default port is 5005
  15. # command : the CLI command to run, or 'server' to run BUBBLE API server. Default is to run Bubble API server
  16. # args : depends on the command. Use '-h' to request help for a command
  17. #
  18. # Environment variables
  19. #
  20. # BUBBLE_ENV : env file to load, used when performing handlebars substitutions on entities marked
  21. # with `"_subst": true` JSON attribute. Default is ~/.bubble.env
  22. # BUBBLE_JVM_OPTS : Java options. Defaults to either "-Xmx512m -Xms512m" when no command is set, else "-Xmx64m -Xms2m"
  23. # BUBBLE_JAR : location of bubble uberjar. Default is to assume there is exactly one bubble-server*.jar file in a
  24. # directory named "target" that is in the same directory as this script
  25. #
  26. # Environment variables for API commands
  27. #
  28. # BUBBLE_API : which API to use. Default is local (http://127.0.0.1:PORT, where PORT is found in .bubble.env)
  29. # BUBBLE_USER : account to use. Default is root
  30. # BUBBLE_PASS : password for account. Default is root
  31. #
  32. #
  33. SCRIPT="${0}"
  34. SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd)
  35. . ${SCRIPT_DIR}/bubble_common
  36. # fail on any command error
  37. set -e
  38. BASE=$(cd $(dirname $0) && pwd)
  39. if [[ $(basename ${BASE}) != "bubble-server" && -d "${BASE}/bubble-server" ]] ; then
  40. BASE="${BASE}/bubble-server"
  41. fi
  42. if [[ $(basename ${BASE}) == "bin" && -d "${BASE}/../bubble-server" ]] ; then
  43. BASE="$(cd ${BASE}/../bubble-server && pwd)"
  44. fi
  45. # save explicitly set key, if we have one
  46. SAVED_DB_KEY=""
  47. if [[ ! -z "${BUBBLE_DB_ENCRYPTION_KEY}" ]] ; then
  48. SAVED_DB_KEY="${BUBBLE_DB_ENCRYPTION_KEY}"
  49. fi
  50. if [[ -z "${BUBBLE_ENV}" ]] ; then
  51. BUBBLE_ENV="${HOME}/.bubble.env"
  52. if [[ ! -f "${BUBBLE_ENV}" ]] ; then
  53. BUBBLE_ENV="/home/bubble/api/bubble.env"
  54. fi
  55. fi
  56. if [[ -f ${BUBBLE_ENV} ]] ; then
  57. if [[ -z "${BUBBLE_QUIET}" || ${BUBBLE_QUIET} != 1 ]] ; then
  58. echo 1>&2 "Loading env: ${BUBBLE_ENV}"
  59. fi
  60. . ${BUBBLE_ENV}
  61. fi
  62. if [[ ! -z "${SAVED_DB_KEY}" ]] ; then
  63. export BUBBLE_DB_ENCRYPTION_KEY="${SAVED_DB_KEY}"
  64. fi
  65. debug="${1}"
  66. if [[ "x${debug}" == "xdebug" ]] ; then
  67. shift
  68. ARG_LEN=$(echo -n "${1}" | wc -c)
  69. ARG_NUMERIC_LEN=$(echo -n "${1}" | tr -dc [:digit:] | wc -c) # strip all non-digits
  70. if [[ ! -z "${ARG_NUMERIC_LEN}" && ${ARG_LEN} -eq ${ARG_NUMERIC_LEN} ]] ; then
  71. # Second arg is the debug port
  72. DEBUG_PORT="${1}"
  73. shift || :
  74. fi
  75. if [[ -z "${DEBUG_PORT}" ]] ; then
  76. DEBUG_PORT=5005
  77. fi
  78. debug="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=${DEBUG_PORT}"
  79. else
  80. debug=""
  81. fi
  82. command="${1}"
  83. server=0
  84. DEFAULT_JVM_OPTS=""
  85. if [[ -z "${command}" ]] ; then
  86. server=1
  87. CLASS=bubble.server.BubbleServer
  88. DEFAULT_JVM_OPTS="-Xmx512m -Xms512m"
  89. else
  90. CLASS=bubble.main.BubbleMain
  91. DEFAULT_JVM_OPTS="-Xmx64m -Xms2m"
  92. shift
  93. fi
  94. if [[ -z "${BUBBLE_JAR}" ]] ; then
  95. die "API jar file not found"
  96. fi
  97. if [[ -z "${BUBBLE_JVM_OPTS}" ]] ; then
  98. BUBBLE_JVM_OPTS="${DEFAULT_JVM_OPTS}"
  99. fi
  100. BUBBLE_JVM_OPTS="${BUBBLE_JVM_OPTS} -Djava.net.preferIPv4Stack=true"
  101. # Choose appropriate log config
  102. if [[ ${server} -eq 1 ]] ; then
  103. LOG_CONFIG="-Dlogback.configurationFile=logback.xml"
  104. if [[ -f ${BUBBLE_ENV} ]] ; then
  105. command="${BUBBLE_ENV}"
  106. fi
  107. else
  108. LOG_CONFIG="-Dlogback.configurationFile=logback-client.xml"
  109. fi
  110. if [[ -z "${BUBBLE_ADDITIONAL_CLASSPATH}" ]] ; then
  111. BUBBLE_CP="${BUBBLE_JAR}"
  112. else
  113. BUBBLE_CP="${BUBBLE_JAR}:${BUBBLE_ADDITIONAL_CLASSPATH}"
  114. fi
  115. # Run!
  116. BUBBLE_JAR="${BUBBLE_JAR}" java ${LOG_CONFIG} ${BUBBLE_JVM_OPTS} ${debug} -server -cp "${BUBBLE_CP}" ${CLASS} ${command} "${@}"