diff --git a/Vagrantfile b/Vagrantfile index d9ffb641..1399d92b 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -12,7 +12,7 @@ # After a box is launched, use `vagrant ssh` to log in. # - the code is in ${HOME}/bubble # - API environment file is ${HOME}/.bubble.env -# - start the API server (local launcher) with `run.sh` +# - start the API server (local launcher) with run.sh # # There are a few environment variables that determine how the box is initialized, # described below. @@ -104,7 +104,7 @@ Vagrant.configure("2") do |config| Once logged in: - the code is in ${HOME}/bubble - API environment file is ${HOME}/.bubble.env - - start the API server (local launcher) with \`run.sh\` + - start the API server (local launcher) with run.sh Enjoy! ================================================================== diff --git a/bin/bactivate b/bin/bactivate index 5594d2b6..52942903 100755 --- a/bin/bactivate +++ b/bin/bactivate @@ -16,12 +16,12 @@ # BUBBLE_PASS : password for account. Default is password # SCRIPT="${0}" -SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) -. ${SCRIPT_DIR}/bubble_common +SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)" +. "${SCRIPT_DIR}"/bubble_common if [[ -z "${BUBBLE_JAR}" ]] ; then die "BUBBLE_JAR env var not set and no jar file found" fi ACTIVATION_JSON="${1:?no activation json file provided}" -${SCRIPT_DIR}/bput <"${ACTIVATION_JSON}" auth/activate - --no-login +"${SCRIPT_DIR}"/bput <"${ACTIVATION_JSON}" auth/activate - --no-login diff --git a/bin/bbuild b/bin/bbuild new file mode 100755 index 00000000..93c262ac --- /dev/null +++ b/bin/bbuild @@ -0,0 +1,42 @@ +#!/bin/bash +# +# Build the bubble jar +# +# Usage: +# +# bbuild [no-clean] [debug|full|prod] +# +# no-clean : if present, do not clean the `target` directory before building +# +# debug : a debug build, does not include anything else in the jar +# full : a production build, creates a fat jar in `bubble-server/target/bubble-server-VERSION-full.jar` +# prod : a production build, creates a slimmer jar in `bubble-server/target/bubble-server-VERSION-prod.jar` +# +# If debug/full/prod is not specified, the default is prod. +# +SCRIPT="${0}" +SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)" +. "${SCRIPT_DIR}"/bubble_common + +CLEAN="clean" +PROFILE="" +if [[ -n "${1}" ]] ; then + if [[ "${1}" == "no-clean" ]] ; then + CLEAN="" + shift + fi + if [[ "${1}" == "debug" ]] ; then + PROFILE="" + elif [[ "${1}" == "full" ]] ; then + PROFILE="-Pproduction-full" + elif [[ "${1}" == "prod" ]] ; then + PROFILE="-Pproduction" + else + die "Invalid argument: ${1}" + fi +else + # default + PROFILE="-Pproduction" +fi + +mvn -DskipTests=true -Dcheckstyle.skip=true ${PROFILE} ${CLEAN} package diff --git a/bin/bconst b/bin/bconst index a59c6be9..7bb29798 100755 --- a/bin/bconst +++ b/bin/bconst @@ -19,17 +19,9 @@ # # bconst bubble.ApiConstants.ROOT_NETWORK_UUID # -# Environment variables -# -# BUBBLE_API : which API to use. Default is local (http://127.0.0.1:PORT, where PORT is found in .bubble.env) -# BUBBLE_USER : account to use. Default is root@local.local -# BUBBLE_PASS : password for account. Default is password -# BUBBLE_INCLUDE : path to look for JSON include files. default value is to assume we are being run from -# bubble repo, bubble-models repo, or bubble-client and use include files from minimal model. -# SCRIPT="${0}" -SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) -. ${SCRIPT_DIR}/bubble_common +SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)" +. "${SCRIPT_DIR}"/bubble_common CLASS_AND_MEMBER="${1:?sole param should be something like: bubble.pkg.SomeClass.SOME_CONSTANT}" shift diff --git a/bin/bdecrypt b/bin/bdecrypt index 2b3a3212..94631eae 100755 --- a/bin/bdecrypt +++ b/bin/bdecrypt @@ -5,8 +5,8 @@ # Decrypt data using the Bubble database's encryption key # SCRIPT="${0}" -SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) -. ${SCRIPT_DIR}/bubble_common +SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)" +. "${SCRIPT_DIR}"/bubble_common if [[ -z "${BUBBLE_DB_ENCRYPTION_KEY}" ]] ; then if [[ -f "${HOME}/.BUBBLE_DB_ENCRYPTION_KEY" ]] ; then @@ -18,4 +18,4 @@ if [[ -z "${BUBBLE_DB_ENCRYPTION_KEY}" ]] ; then fi fi -BUBBLE_DB_ENCRYPTION_KEY=${BUBBLE_DB_ENCRYPTION_KEY} exec ${SCRIPT_DIR}/bubble crypt -f decrypt "${@}" +BUBBLE_DB_ENCRYPTION_KEY=${BUBBLE_DB_ENCRYPTION_KEY} exec "${SCRIPT_DIR}"/bubble crypt -f decrypt "${@}" diff --git a/bin/bdelete b/bin/bdelete index 710b7fad..87c70292 100755 --- a/bin/bdelete +++ b/bin/bdelete @@ -20,8 +20,8 @@ # bubble repo, bubble-models repo, or bubble-client and use include files from minimal model. # SCRIPT="${0}" -SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) -. ${SCRIPT_DIR}/bubble_common +SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)" +. "${SCRIPT_DIR}"/bubble_common URL="${1:?no URL provided}" shift diff --git a/bin/bdocker b/bin/bdocker index 18ecc077..49fcbdc1 100755 --- a/bin/bdocker +++ b/bin/bdocker @@ -31,14 +31,11 @@ # If you want to run this unattended, set the LETSENCRYPT_EMAIL environment variable # in your ~/.bubble.env file or in your shell environment. # +SCRIPT="${0}" +SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)" +. "${SCRIPT_DIR}"/bubble_common -function die { - echo 1>&2 "${1}" - exit 1 -} - -THISDIR="$(cd "$(dirname "${0}")" && pwd)" -BUBBLE_DIR="$(cd "${THISDIR}/.." && pwd)" +BUBBLE_DIR="$(cd "${SCRIPT_DIR}"/.. && pwd)" MODE=${1:?no mode specified, use build or run} diff --git a/bin/bencrypt b/bin/bencrypt index 1f1b9dc4..374122c2 100755 --- a/bin/bencrypt +++ b/bin/bencrypt @@ -5,8 +5,8 @@ # Encrypt data using the Bubble database's encryption key # SCRIPT="${0}" -SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) -. ${SCRIPT_DIR}/bubble_common +SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)" +. "${SCRIPT_DIR}"/bubble_common if [[ -z "${BUBBLE_DB_ENCRYPTION_KEY}" ]] ; then if [[ -f "${HOME}/.BUBBLE_DB_ENCRYPTION_KEY" ]] ; then diff --git a/bin/bget b/bin/bget index 2d598ed7..858dd55e 100755 --- a/bin/bget +++ b/bin/bget @@ -20,8 +20,8 @@ # bubble repo, bubble-models repo, or bubble-client and use include files from minimal model. # SCRIPT="${0}" -SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) -. ${SCRIPT_DIR}/bubble_common +SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)" +. "${SCRIPT_DIR}"/bubble_common URL="${1:?no URL provided}" shift diff --git a/bin/bgeti b/bin/bgeti index 730b02a5..bf781c00 100755 --- a/bin/bgeti +++ b/bin/bgeti @@ -20,8 +20,8 @@ # bubble repo, bubble-models repo, or bubble-client and use include files from minimal model. # SCRIPT="${0}" -SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) -. ${SCRIPT_DIR}/bubble_common +SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)" +. "${SCRIPT_DIR}"/bubble_common URL="${1:?no URL provided}" shift diff --git a/bin/bgeti1 b/bin/bgeti1 index c4688b3e..270b1a47 100755 --- a/bin/bgeti1 +++ b/bin/bgeti1 @@ -20,8 +20,8 @@ # bubble repo, bubble-models repo, or bubble-client and use include files from minimal model. # SCRIPT="${0}" -SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) -. ${SCRIPT_DIR}/bubble_common +SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)" +. "${SCRIPT_DIR}"/bubble_common URL="${1:?no URL provided}" shift diff --git a/bin/bgetn b/bin/bgetn index 8877aa51..e842ebb6 100755 --- a/bin/bgetn +++ b/bin/bgetn @@ -20,8 +20,8 @@ # bubble repo, bubble-models repo, or bubble-client and use include files from minimal model. # SCRIPT="${0}" -SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) -. ${SCRIPT_DIR}/bubble_common +SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)" +. "${SCRIPT_DIR}"/bubble_common URL="${1:?no URL provided}" shift diff --git a/bin/bgetn1 b/bin/bgetn1 index d43e32f7..4ca59553 100755 --- a/bin/bgetn1 +++ b/bin/bgetn1 @@ -20,8 +20,8 @@ # bubble repo, bubble-models repo, or bubble-client and use include files from minimal model. # SCRIPT="${0}" -SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) -. ${SCRIPT_DIR}/bubble_common +SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)" +. "${SCRIPT_DIR}"/bubble_common URL="${1:?no URL provided}" shift diff --git a/bin/bmodel b/bin/bmodel index d97983b2..f8d99a5d 100755 --- a/bin/bmodel +++ b/bin/bmodel @@ -17,8 +17,8 @@ # BUBBLE_SCRIPTS : location of run.sh script. Default is to assume it is in the same directory containing this script # SCRIPT="${0}" -SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) -. ${SCRIPT_DIR}/bubble_common +SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)" +. "${SCRIPT_DIR}"/bubble_common UPDATE_OPT="" if [[ -n "${1}" && ( "${1}" == "-u" || "${1}" == "--update-all" ) ]] ; then diff --git a/bin/bpost b/bin/bpost index 85a4af58..e3e82003 100755 --- a/bin/bpost +++ b/bin/bpost @@ -22,8 +22,8 @@ # bubble repo, bubble-models repo, or bubble-client and use include files from minimal model. # SCRIPT="${0}" -SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) -. ${SCRIPT_DIR}/bubble_common +SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)" +. "${SCRIPT_DIR}"/bubble_common URL="${1:?no URL provided}" shift diff --git a/bin/bposte b/bin/bposte index b8f8515a..efcc8121 100755 --- a/bin/bposte +++ b/bin/bposte @@ -21,8 +21,8 @@ # bubble repo, bubble-models repo, or bubble-client and use include files from minimal model. # SCRIPT="${0}" -SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) -. ${SCRIPT_DIR}/bubble_common +SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)" +. "${SCRIPT_DIR}"/bubble_common URL="${1:?no URL provided}" shift diff --git a/bin/bput b/bin/bput index 1046e5a3..e1604b85 100755 --- a/bin/bput +++ b/bin/bput @@ -22,8 +22,8 @@ # bubble repo, bubble-models repo, or bubble-client and use include files from minimal model. # SCRIPT="${0}" -SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) -. ${SCRIPT_DIR}/bubble_common +SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)" +. "${SCRIPT_DIR}"/bubble_common URL="${1:?no URL provided}" shift diff --git a/bin/bpute b/bin/bpute index ca11508e..6d6633ea 100755 --- a/bin/bpute +++ b/bin/bpute @@ -21,8 +21,8 @@ # bubble repo, bubble-models repo, or bubble-client and use include files from minimal model. # SCRIPT="${0}" -SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) -. ${SCRIPT_DIR}/bubble_common +SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)" +. "${SCRIPT_DIR}"/bubble_common URL="${1:?no URL provided}" shift diff --git a/bin/bpyvenv.sh b/bin/bpyvenv.sh index d91ccf30..3eceffbe 100755 --- a/bin/bpyvenv.sh +++ b/bin/bpyvenv.sh @@ -9,14 +9,14 @@ function die { exit 1 } -BUBBLE_HOME="$(cd $(dirname ${0})/.. && pwd)" +BUBBLE_HOME="$(cd "$(dirname "${0}")"/.. && pwd)" -cd ${BUBBLE_HOME} || die "Error changing to ${BUBBLE_HOME} dir" +cd "${BUBBLE_HOME}" || die "Error changing to ${BUBBLE_HOME} dir" if [[ ! -d "${BUBBLE_HOME}/.venv" ]] ; then python3 -m venv ./.venv || die "Error creating venv" fi -. ${BUBBLE_HOME}/.venv/bin/activate || die "Error activating bubble venv" +. "${BUBBLE_HOME}"/.venv/bin/activate || die "Error activating bubble venv" python3 -m pip install requests || die "Error installing pip packages" if [[ -n "${1}" ]] ; then diff --git a/bin/brsync b/bin/brsync index 05917e72..a275f5f3 100755 --- a/bin/brsync +++ b/bin/brsync @@ -9,17 +9,14 @@ # # BUBBLE_SSH_PORT : If set, this port will be used instead of 1202 # +SCRIPT="${0}" +SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)" +. "${SCRIPT_DIR}"/bubble_common if [[ -z "${BUBBLE_SSH_PORT}" ]] ; then BUBBLE_SSH_PORT="1202" fi -function die() { - echo 1>&2 "${1}" - exit 1 -} - - if [[ $(echo "${@}" | grep -c -- "-e ") -gt 0 || $(echo "${@}" | grep -c -- "--rsh") -gt 0 ]] ; then die "$0 does not work correctly when -e or --rsh is used, since it sets its own: ${@}" fi diff --git a/bin/bscp b/bin/bscp index 3d78707b..c73d5563 100755 --- a/bin/bscp +++ b/bin/bscp @@ -8,6 +8,9 @@ # # BUBBLE_SSH_PORT : If set, this port will be used instead of 1202 # +SCRIPT="${0}" +SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)" +. "${SCRIPT_DIR}"/bubble_common if [[ -z "${BUBBLE_SSH_PORT}" ]] ; then BUBBLE_SSH_PORT="1202" diff --git a/bin/bscript b/bin/bscript index 20857037..dc0ebe68 100755 --- a/bin/bscript +++ b/bin/bscript @@ -21,10 +21,10 @@ # bubble repo, bubble-models repo, or bubble-client and use include files from minimal model. # SCRIPT="${0}" -SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) -. ${SCRIPT_DIR}/bubble_common +SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)" +. "${SCRIPT_DIR}"/bubble_common -BUBBLE_SERVER=$(cd $(dirname ${0})/.. && pwd) +BUBBLE_SERVER="$(cd "$(dirname "${0}")"/.. && pwd)" CANDIDATE_INCLUDES=" ${BUBBLE_SERVER}/src/test/resources/models/minimal/tests diff --git a/bin/bssh b/bin/bssh index 1e34e065..3db3fcbe 100755 --- a/bin/bssh +++ b/bin/bssh @@ -8,6 +8,9 @@ # # BUBBLE_SSH_PORT : If set, this port will be used instead of 1202 # +SCRIPT="${0}" +SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)" +. "${SCRIPT_DIR}"/bubble_common if [[ -z "${BUBBLE_SSH_PORT}" ]] ; then BUBBLE_SSH_PORT="1202" diff --git a/bin/bubble b/bin/bubble index 34a8c577..93877de5 100755 --- a/bin/bubble +++ b/bin/bubble @@ -24,8 +24,8 @@ # BUBBLE_SCRIPTS : location of run.sh script. Default is to assume it is in the same directory containing this script # SCRIPT="${0}" -SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) -. ${SCRIPT_DIR}/bubble_common +SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)" +. "${SCRIPT_DIR}"/bubble_common function is_api_command { case "${1}" in diff --git a/bin/bunlock b/bin/bunlock index f56fb198..bf7b521c 100755 --- a/bin/bunlock +++ b/bin/bunlock @@ -17,16 +17,16 @@ # BUBBLE_PASS : password for account. Default is password # SCRIPT="${0}" -SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) +SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)" -REQUIRE_BUBBLE_USER=1 -REQUIRE_BUBBLE_PASS=1 -. ${SCRIPT_DIR}/bubble_common +export REQUIRE_BUBBLE_USER=1 +export REQUIRE_BUBBLE_PASS=1 +. "${SCRIPT_DIR}"/bubble_common if [[ -z "${BUBBLE_API}" ]] ; then die "No BUBBLE_API env var defined" fi -UNLOCK_KEY=${1:?no unlock-key provided} +UNLOCK_KEY="${1:?no unlock-key provided}" echo "{\"name\":\"${BUBBLE_USER}\",\"password\":\"${BUBBLE_PASS}\"}" | \ - ${SCRIPT_DIR}/bpost 'auth/login?k='"${UNLOCK_KEY}"'' - --no-login + "${SCRIPT_DIR}"/bpost 'auth/login?k='"${UNLOCK_KEY}"'' - --no-login diff --git a/bin/bvagrant.sh b/bin/bvagrant.sh deleted file mode 100644 index 7c91dd1e..00000000 --- a/bin/bvagrant.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -vagrant box add ubuntu/focal64 diff --git a/bin/jq-all-vals b/bin/jq-all-vals index 503a6737..a5ce3d59 100755 --- a/bin/jq-all-vals +++ b/bin/jq-all-vals @@ -16,8 +16,8 @@ # prop-name : a property name # SCRIPT="${0}" -SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) -. ${SCRIPT_DIR}/bubble_common +SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)" +. "${SCRIPT_DIR}"/bubble_common -ARG=${1:?no property provided} +ARG="${1:?no property provided}" jq -r 'getpath(path(.. | select(.'"${ARG}"' != null))) | .'"${ARG}"'' 2> /dev/null diff --git a/bin/mitm_pid b/bin/mitm_pid index 8832b405..cb769f4e 100755 --- a/bin/mitm_pid +++ b/bin/mitm_pid @@ -5,4 +5,4 @@ # Print PID of currently-active mitmproxy # Note: this command only works on a running bubble node # -ps auxwww | grep /home/mitmproxy/mitmproxy/venv/bin/mitmdump | grep $(cat /home/mitmproxy/mitmproxy_port) | grep -v grep | awk '{print $2}' +ps auxwww | grep /home/mitmproxy/mitmproxy/venv/bin/mitmdump | grep "$(cat /home/mitmproxy/mitmproxy_port)" | grep -v grep | awk '{print $2}' diff --git a/bin/pack_bubble b/bin/pack_bubble index 135e167d..c1050e99 100755 --- a/bin/pack_bubble +++ b/bin/pack_bubble @@ -13,8 +13,8 @@ # cloud CloudName : only pack for CloudName compute cloud, do not pack for all clouds # SCRIPT="${0}" -SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) -. ${SCRIPT_DIR}/bubble_common +SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)" +. "${SCRIPT_DIR}"/bubble_common if [[ -z "${1}" ]] ; then IMAGES="node sage" diff --git a/bin/pack_status b/bin/pack_status index 835324c4..abb8b411 100755 --- a/bin/pack_status +++ b/bin/pack_status @@ -36,8 +36,8 @@ # If you pass the 'completed' argument, only the map of cloud->image[] will be printed # SCRIPT="${0}" -SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) -. ${SCRIPT_DIR}/bubble_common +SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)" +. "${SCRIPT_DIR}"/bubble_common if [[ -z "${1}" ]] ; then bget me/packer diff --git a/bin/prep_bubble_jar b/bin/prep_bubble_jar index 0a24e988..f531cc47 100755 --- a/bin/prep_bubble_jar +++ b/bin/prep_bubble_jar @@ -21,7 +21,7 @@ # SCRIPT="${0}" SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)" -. "${SCRIPT_DIR}/bubble_common" +. "${SCRIPT_DIR}"/bubble_common if [[ -n "${DEBUG_BUILD}" && "${DEBUG_BUILD}" == "debug" ]] ; then echo "DEBUG_BUILD is set, not doing anything further" diff --git a/bin/reset_bubble_db b/bin/reset_bubble_db index be811911..a04ff561 100755 --- a/bin/reset_bubble_db +++ b/bin/reset_bubble_db @@ -10,7 +10,7 @@ # SCRIPT="${0}" SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)" -. "${SCRIPT_DIR}/bubble_common" +. "${SCRIPT_DIR}"/bubble_common DEBUG=${1} if [[ -n "${DEBUG}" && "${DEBUG}" == "debug" ]] ; then diff --git a/bin/reset_bubble_full b/bin/reset_bubble_full index df5fc86b..173011c3 100755 --- a/bin/reset_bubble_full +++ b/bin/reset_bubble_full @@ -8,7 +8,7 @@ # SCRIPT="${0}" SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)" -. "${SCRIPT_DIR}/bubble_common" +. "${SCRIPT_DIR}"/bubble_common SELF_NODE_JSON="${HOME}/self_node.json" BUBBLE_VERSIONS_FILE="${HOME}/bubble_versions.properties" diff --git a/bin/run.sh b/bin/run.sh index 93096579..38c549a4 100755 --- a/bin/run.sh +++ b/bin/run.sh @@ -30,8 +30,8 @@ # # SCRIPT="${0}" -SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) -. ${SCRIPT_DIR}/bubble_common +SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)" +. "${SCRIPT_DIR}"/bubble_common # fail on any command error set -e diff --git a/bubble-server/src/main/java/bubble/main/BubbleMain.java b/bubble-server/src/main/java/bubble/main/BubbleMain.java index e2507b4b..771533ba 100644 --- a/bubble-server/src/main/java/bubble/main/BubbleMain.java +++ b/bubble-server/src/main/java/bubble/main/BubbleMain.java @@ -21,6 +21,8 @@ import java.util.Map; import java.util.TreeSet; import static org.cobbzilla.util.collection.ArrayUtil.shift; +import static org.cobbzilla.util.main.BaseMainOptions.LONGOPT_HELP; +import static org.cobbzilla.util.main.BaseMainOptions.OPT_HELP; public class BubbleMain { @@ -43,7 +45,11 @@ public class BubbleMain { public static void main(String[] args) throws Exception { - if (args.length == 0) die(noCommandProvided()); + if (args.length == 0 || ( + args.length == 1 && ( args[0].equals(OPT_HELP) || args[0].equals(LONGOPT_HELP) ) + )) { + die(noCommandProvided()); + } SLF4JBridgeHandler.removeHandlersForRootLogger(); SLF4JBridgeHandler.install(); diff --git a/docs/dev_manual.md b/docs/dev_manual.md index b729b1bf..02f8bcfe 100644 --- a/docs/dev_manual.md +++ b/docs/dev_manual.md @@ -42,5 +42,8 @@ cd ${HOME} && ln -s .bubble.env .bubble-test.env The `.bubble-test.env` file is used by the test suite. ## What's Next -Continue reading the [Bubble Developer Guide](dev.md) for information -on how to update the source code, reset the database, and more. +Read [Bubble Developer Tasks](dev_tasks.md) to understand how to keep the code +up to date, run the API server, rebuild the jar, and more. + +If you've started the Bubble API already using `run.sh`, and want to launch a Bubble, +continue with [activation](activation.md). diff --git a/docs/dev_tasks.md b/docs/dev_tasks.md index 2cded654..7acb0757 100644 --- a/docs/dev_tasks.md +++ b/docs/dev_tasks.md @@ -3,15 +3,52 @@ Bubble Developer Tasks How to update the codebase, how to run the API server, how to reset the database. ## Updating the Code -If you want to grab the latest code, and ensure that all git submodules are properly in sync with the main repository, run: +You can use normal git tools just fine with Bubble. Be aware that the bubble git +repository makes extensive use of git submodules. So we provide some tools to +make simple things simple. Everything is still git, there is no magic here. + +If you want to grab the latest code and ensure that all git submodules are properly +in sync with the main repository: + * First, ensure that you have no locally modified files (or `git stash` your changes) + * Then run: ```shell script ./bin/git_update_bubble.sh ``` - This will update and rebuild all submodules, and the main bubble jar file. +## Building +If you've changed files in `bubble-server/src/`, and you want to see those changes live, +you'll need to rebuild: +```shell script +bbuild +``` + +## Rebuilding Utilities +If you change source files in one of the submodules under `utils`, you'll need to +rebuild (and `mvn install`) those submodules, **and then** run `bbuild` to incorporate +the changed libraries into the Bubble jar. + +## Rebuilding the Web Site +If you change files in `bubble-web`, you don't need to run a full `bbuild`. +Instead you can run the much faster `webpack`. + +Run this from the `bubble-web` directory: +```shell script +rm -f ./dist/* && webpack +``` +This will remove all previous site files and have webpack regenerate the HTML/CSS/JS for the +Bubble web UI. + +If you look in `${HOME}/.bubble.env`, you'll see that the `BUBBLE_ASSETS_DIR` variable points +to `${HOME}/bubble/bubble-web/dist`. Thus, when you run `webpack` to update the files in `dist`, +the "live" site is updated. + ## Running the API server -Run the `./bin/run.sh` script to start the Bubble server. +To start the Bubble server: +```shell script +./bin/run.sh +``` +This will run the server in the foreground. Hit Control-C to stop it. ## Reset everything If you want to "start over", run: @@ -22,3 +59,8 @@ If you want to "start over", run: This will remove local files stored by Bubble, and drop the bubble database. If you run `./bin/run.sh` again, it will be like running it for the first time. + +## Other tools +There are many other tools in the `bin` directory. + +Most tools accept a `-h` / `--help` option and will print usage information. diff --git a/docs/dev_vagrant.md b/docs/dev_vagrant.md index bf913cb4..e0efa82a 100644 --- a/docs/dev_vagrant.md +++ b/docs/dev_vagrant.md @@ -38,8 +38,10 @@ LETSENCRYPT_EMAIL=someone@example.com BUBBLE_PORT=8080 vagrant up ``` The first time `vagrant up` runs it will take a long time to complete, since it needs to -download and build a lot of stuff. For future runs of `vagrant up`, startup times will be -much faster. +download and build a lot of stuff. Depending on the speed of your computer and internet, +it could take anywhere from 5 to 20 or more minutes. + +For future runs of `vagrant up`, startup times will be much faster. When the command completes, you'll have a Vagrant box with the Bubble source code and all dependencies fully built and ready to run a local launcher. @@ -94,5 +96,8 @@ rsync -avzc /vagrant/* /vagrant/.* ${HOME}/bubble/ ``` ## What's Next -Continue reading the [Bubble Developer Guide](dev.md) for information -on how to update the source code, reset the database, and more. +Read [Bubble Developer Tasks](dev_tasks.md) to understand how to keep the code +up to date, run the API server, rebuild the jar, and more. + +If you've started the Bubble API already using `run.sh`, and want to launch a Bubble, +continue with [activation](activation.md).