From 44a3804f9c2c66763d8aa88dc5d855cc6c08f352 Mon Sep 17 00:00:00 2001 From: Jonathan Cobb Date: Sun, 15 Nov 2020 22:09:00 -0500 Subject: [PATCH] defaults for support and app links, get letsencrypt email from user --- .../META-INF/bubble/bubble.properties | 2 +- .../src/main/resources/bubble-config.yml | 32 +++++++++---------- docker/bubble.sh | 19 ++++++++++- docker/launcher.sh | 15 ++++++++- 4 files changed, 49 insertions(+), 19 deletions(-) diff --git a/bubble-server/src/main/resources/META-INF/bubble/bubble.properties b/bubble-server/src/main/resources/META-INF/bubble/bubble.properties index d809148c..6dba39e5 100644 --- a/bubble-server/src/main/resources/META-INF/bubble/bubble.properties +++ b/bubble-server/src/main/resources/META-INF/bubble/bubble.properties @@ -1 +1 @@ -bubble.version=Adventure 1.4.13 +bubble.version=Adventure 1.4.14 diff --git a/bubble-server/src/main/resources/bubble-config.yml b/bubble-server/src/main/resources/bubble-config.yml index dafdec99..2dd88d93 100644 --- a/bubble-server/src/main/resources/bubble-config.yml +++ b/bubble-server/src/main/resources/bubble-config.yml @@ -74,7 +74,7 @@ errorApi: localNotificationStrategy: {{#exists BUBBLE_LOCAL_NOTIFY}}{{BUBBLE_LOCAL_NOTIFY}}{{else}}inline{{/exists}} -letsencryptEmail: {{LETSENCRYPT_EMAIL}} +letsencryptEmail: {{#required LETSENCRYPT_EMAIL}} localStorageDir: {{LOCALSTORAGE_BASE_DIR}} releaseUrlBase: {{#exists BUBBLE_RELEASE_URL_BASE}}{{BUBBLE_RELEASE_URL_BASE}}{{else}}https://jenkins.bubblev.org/public/releases{{/exists}} @@ -91,25 +91,25 @@ rateLimits: - { limit: 100000, interval: 6h, block: 96h } support: - email: {{SUPPORT_EMAIL}} - site: {{SUPPORT_SITE}} + email: {{#exists SUPPORT_EMAIL}}{{{SUPPORT_EMAIL}}}{{else}}support@getbubblenow.com{{/exists}} + site: {{#exists SUPPORT_SITE}}{{{SUPPORT_SITE}}}{{else}}https://support.getbubblenow.com/{{/exists}} locale: en_US: - email: {{SUPPORT_EMAIL}} - site: {{SUPPORT_SITE}} + email: {{#exists SUPPORT_EMAIL}}{{{SUPPORT_EMAIL}}}{{else}}support@getbubblenow.com{{/exists}} + site: {{#exists SUPPORT_SITE}}{{{SUPPORT_SITE}}}{{else}}https://support.getbubblenow.com/{{/exists}} appLinks: - ios: {{APP_LINK_IOS}} - android: {{APP_LINK_ANDROID}} - windows: {{APP_LINK_WINDOWS}} - macosx: {{APP_LINK_MACOSX}} - linux: {{APP_LINK_LINUX}} + ios: {{#exists APP_LINK_IOS}}{{{APP_LINK_IOS}}}{{else}}https://support.getbubblenow.com/hc/en-us/articles/360051573613-Connect-an-Apple-iOS-device-to-your-Bubble{{/exists}} + android: {{#exists APP_LINK_ANDROID}}{{{APP_LINK_ANDROID}}}{{else}}https://support.getbubblenow.com/hc/en-us/articles/360050800074-Connect-an-Android-device-to-your-Bubble{{/exists}} + windows: {{#exists APP_LINK_WINDOWS}}{{{APP_LINK_WINDOWS}}}{{else}}https://support.getbubblenow.com/hc/en-us/articles/360051349493-Connect-a-Windows-system-to-your-Bubble{{/exists}} + macosx: {{#exists APP_LINK_MACOSX}}{{{APP_LINK_MACOSX}}}{{else}}https://support.getbubblenow.com/hc/en-us/articles/360051573753-Connect-an-Apple-Mac-OS-X-system-to-your-Bubble{{/exists}} + linux: {{#exists APP_LINK_LINUX}}{{{APP_LINK_LINUX}}}{{else}}https://support.getbubblenow.com/hc/en-us/articles/360050799434-Connect-a-Linux-system-to-your-Bubble{{/exists}} locale: en_US: - ios: {{APP_LINK_IOS}} - android: {{APP_LINK_ANDROID}} - windows: {{APP_LINK_WINDOWS}} - macosx: {{APP_LINK_MACOSX}} - linux: {{APP_LINK_LINUX}} + ios: {{#exists APP_LINK_IOS}}{{{APP_LINK_IOS}}}{{else}}https://support.getbubblenow.com/hc/en-us/articles/360051573613-Connect-an-Apple-iOS-device-to-your-Bubble{{/exists}} + android: {{#exists APP_LINK_ANDROID}}{{{APP_LINK_ANDROID}}}{{else}}https://support.getbubblenow.com/hc/en-us/articles/360050800074-Connect-an-Android-device-to-your-Bubble{{/exists}} + windows: {{#exists APP_LINK_WINDOWS}}{{{APP_LINK_WINDOWS}}}{{else}}https://support.getbubblenow.com/hc/en-us/articles/360051349493-Connect-a-Windows-system-to-your-Bubble{{/exists}} + macosx: {{#exists APP_LINK_MACOSX}}{{{APP_LINK_MACOSX}}}{{else}}https://support.getbubblenow.com/hc/en-us/articles/360051573753-Connect-an-Apple-Mac-OS-X-system-to-your-Bubble{{/exists}} + linux: {{#exists APP_LINK_LINUX}}{{{APP_LINK_LINUX}}}{{else}}https://support.getbubblenow.com/hc/en-us/articles/360050799434-Connect-a-Linux-system-to-your-Bubble{{/exists}} -certificateValidationHost: {{CERT_VALIDATION_HOST}} +certificateValidationHost: {{#exists CERT_VALIDATION_HOST}}{{CERT_VALIDATION_HOST}}{{else}}example.com{{/exists}} diff --git a/docker/bubble.sh b/docker/bubble.sh index 0e7a0fc2..24b59a21 100755 --- a/docker/bubble.sh +++ b/docker/bubble.sh @@ -15,6 +15,12 @@ # # The docker tag used will be getbubble/launcher:version # +# When using the 'run' mode, you'll be asked for an email address to associate with any LetsEncrypt +# certificates that will be created. +# +# If you want to run this unattended, set the LETSENCRYPT_EMAIL environment variable +# in your ~/.bubble.env file. +# function die { echo 1>&2 "${1}" @@ -33,6 +39,8 @@ if [[ -z "${VERSION}" ]] ; then fi BUBBLE_TAG="getbubble/launcher:${VERSION}" +BUBBLE_ENV="${HOME}/.bubble.env" + if [[ "${MODE}" == "build" ]] ; then if [[ $(find bubble-server/target -type f -name "bubble-server-*.jar" | wc -l | tr -d ' ') -eq 0 ]] ; then die "No bubble jar found in $(pwd)/bubble-server/target" @@ -40,7 +48,16 @@ if [[ "${MODE}" == "build" ]] ; then docker build -t ${BUBBLE_TAG} . || die "Error building docker image" elif [[ "${MODE}" == "run" ]] ; then - docker run --env-file <(cat "${HOME}/.bubble.env" | sed -e 's/export //' | tr -d '"' | tr -d "'") -p 8090:8090 -t ${BUBBLE_TAG} || die "Error running docker container" + if [[ $(cat "${BUBBLE_ENV}" | grep -v '^#' | grep -c LETSENCRYPT_EMAIL) -eq 0 ]] ; then + if [[ -z "${LETSENCRYPT_EMAIL}" ]] ; then + echo ; echo -n "Email address for LetsEncrypt certificates: " + read -r LETSENCRYPT_EMAIL + fi + echo " +export LETSENCRYPT_EMAIL=${LETSENCRYPT_EMAIL} +" >> "${BUBBLE_ENV}" + fi + docker run --env-file <(cat "${BUBBLE_ENV}" | sed -e 's/export //' | tr -d '"' | tr -d "'") -p 8090:8090 -t ${BUBBLE_TAG} || die "Error running docker container" elif [[ "${MODE}" == "push" ]] ; then docker push ${BUBBLE_TAG} || die "Error pushing docker image" diff --git a/docker/launcher.sh b/docker/launcher.sh index 7bfc58be..85bf89fb 100644 --- a/docker/launcher.sh +++ b/docker/launcher.sh @@ -11,6 +11,10 @@ # - pull bubble launcher docker image # - run bubble launcher docker image # +# You'll be asked for an email address to associate with any LetsEncrypt certificates that will be created. +# +# If you want to run this unattended, set the LETSENCRYPT_EMAIL environment variable. +# # Upon successful startup, the bubble launcher will be listening on port 8090 # # Open http://127.0.0.1:8090/ in a web browser to continue with activation. @@ -146,8 +150,17 @@ Then re-run this script # Pull bubble docker image docker pull ${BUBBLE_TAG} || die "Error pulling docker image: ${BUBBLE_TAG}" + # Determine email for LetsEncrypt certs + if [[ -z "${LETSENCRYPT_EMAIL}" ]] ; then + echo ; echo -n "Email address for LetsEncrypt certificates: " + read -r LETSENCRYPT_EMAIL + fi + # Run bubble docker image - docker run -p 8090:8090 -t ${BUBBLE_TAG} + docker run \ + -p 8090:8090 \ + -e LETSENCRYPT_EMAIL="${LETSENCRYPT_EMAIL}" \ + -t ${BUBBLE_TAG} } run_launcher