Selaa lähdekoodia

updates for local launcher to work properly on mac osx

tags/v1.4.0
Jonathan Cobb 3 vuotta sitten
vanhempi
commit
d75720499f
11 muutettua tiedostoa jossa 127 lisäystä ja 54 poistoa
  1. +0
    -32
      bin/first_time_macosx.md
  2. +6
    -2
      bin/first_time_macosx.sh
  3. +18
    -6
      bin/install_packer.sh
  4. +49
    -0
      bin/pack_bubble
  5. +8
    -9
      bin/reset_bubble_full
  6. +32
    -1
      bubble-server/pom.xml
  7. +8
    -1
      bubble-server/src/main/java/bubble/main/BubbleScriptMain.java
  8. +3
    -0
      bubble-server/src/main/java/bubble/service/packer/PackerJob.java
  9. +1
    -1
      bubble-server/src/main/resources/META-INF/bubble/bubble.properties
  10. +1
    -1
      utils/cobbzilla-parent
  11. +1
    -1
      utils/cobbzilla-utils

+ 0
- 32
bin/first_time_macosx.md Näytä tiedosto

@@ -1,32 +0,0 @@
#!/bin/bash
#
# Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/
#
function die {
echo 1>&2 "${1}"
exit 1
}

# Ensure system is current

# Install homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

# Install emacs
brew cask install emacs

# Install AdoptOpenJDK 11
install from https://adoptopenjdk.net/index.html?variant=openjdk11&jvmVariant=hotspot

# Install packages
brew install maven
brew install postgresql@10 && brew services start postgresql@10
brew install redis && brew services start redis
brew install jq
brew install python@3.8

# Create DB user 'bubble', with the ability to create databases
createuser -U postgres --createdb bubble || die "Error creating bubble DB user"

# Create bubble database
createdb --encoding=UTF-8 bubble || die "Error creating bubble DB"

+ 6
- 2
bin/first_time_macosx.sh Näytä tiedosto

@@ -9,6 +9,10 @@ function die {

# Ensure system is current

# Install packer
BUBBLE_BIN="$(cd "$(dirname "${0}")" && pwd)"
"${BUBBLE_BIN}/install_packer.sh" || die "Error installing packer"

# Install homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

@@ -16,10 +20,10 @@ function die {
brew cask install emacs

# Install AdoptOpenJDK 11
echo "Install AdoptOpenJDK 11 from https://adoptopenjdk.net/index.html?variant=openjdk11&jvmVariant=hotspot"
echo ">>> Please install AdoptOpenJDK 11 from https://adoptopenjdk.net/index.html?variant=openjdk11&jvmVariant=hotspot"

# Install IntelliJ IDEA
echo "Install IntelliJ IDEA from https://www.jetbrains.com/idea/download/#section=mac"
echo "Consider installing IntelliJ IDEA from https://www.jetbrains.com/idea/download/#section=mac"

# Install packages
brew install maven


+ 18
- 6
bin/install_packer.sh Näytä tiedosto

@@ -9,20 +9,32 @@ function die {

# Install packer
if [[ ! -f ${HOME}/packer/packer ]] ; then
PACKER_VERSION=1.6.2
PACKER_FILE=packer_${PACKER_VERSION}_linux_amd64.zip
PACKER_VERSION=1.6.5
if [[ "$(uname)" == "Darwin" ]] ; then
PACKER_FILE=packer_${PACKER_VERSION}_darwin_amd64.zip
elif [[ "$(uname)" == "Linux" ]] ; then
PACKER_FILE=packer_${PACKER_VERSION}_linux_amd64.zip
else
die "Add packer support to script ${0} for uname $(uname)"
fi
PACKER_URL=https://releases.hashicorp.com/packer/${PACKER_VERSION}/${PACKER_FILE}
mkdir -p ${HOME}/packer && cd ${HOME}/packer && wget ${PACKER_URL} && unzip ${PACKER_FILE} || die "Error installing packer"
mkdir -p ${HOME}/packer && cd ${HOME}/packer && curl -L ${PACKER_URL} -o ${PACKER_FILE} && unzip ${PACKER_FILE} || die "Error installing packer"
else
echo "Packer already installed"
fi

# Install packer Vultr plugin
if [[ ! -f ${HOME}/.packer.d/plugins/packer-builder-vultr ]] ; then
PACKER_VULTR_VERSION=1.0.11
PACKER_VULTR_FILE=packer-builder-vultr_${PACKER_VULTR_VERSION}_linux_64-bit.tar.gz
PACKER_VULTR_VERSION=1.0.15
if [[ "$(uname)" == "Darwin" ]] ; then
PACKER_VULTR_FILE=packer-builder-vultr_${PACKER_VULTR_VERSION}_macOs_64-bit.tar.gz
elif [[ "$(uname)" == "Linux" ]] ; then
PACKER_VULTR_FILE=packer-builder-vultr_${PACKER_VULTR_VERSION}_linux_64-bit.tar.gz
else
die "Add packer vultr support to script ${0} for uname $(uname)"
fi
PACKER_VULTR_URL=https://github.com/vultr/packer-builder-vultr/releases/download/v${PACKER_VULTR_VERSION}/${PACKER_VULTR_FILE}
mkdir -p ${HOME}/.packer.d/plugins && cd ${HOME}/.packer.d/plugins && wget ${PACKER_VULTR_URL} && tar xzf ${PACKER_VULTR_FILE} || die "Error installing packer vultr plugin"
mkdir -p ${HOME}/.packer.d/plugins && cd ${HOME}/.packer.d/plugins && curl -L ${PACKER_VULTR_URL} -o ${PACKER_VULTR_FILE} && tar xzf ${PACKER_VULTR_FILE} || die "Error installing packer vultr plugin"
else
echo "Packer vultr plugin already installed"
fi

+ 49
- 0
bin/pack_bubble Näytä tiedosto

@@ -0,0 +1,49 @@
#!/bin/bash
#
# Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/
#
# Create packer images for sage and/or node
#
# Usage: pack_bubble [-node|-sage] [-cloud CloudName]
#
# -node : only pack the node image, do not pack the sage
# -sage : only pack the sage image, do not pack the node
# -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

if [[ -z "${1}" ]] ; then
IMAGES="node sage"
elif [[ "${1}" == "-node" ]] ; then
IMAGES="node"
shift
elif [[ "${1}" == "-sage" ]] ; then
IMAGES="sage"
shift
fi

if [[ -z "${1}" ]] ; then
CLOUDS_URL="me/clouds?type=compute"
CLOUDS="$("${SCRIPT_DIR}/bgetn" "${CLOUDS_URL}")"
if [[ -z "${CLOUDS}" ]] ; then
die "Error reading compute cloud names from ${CLOUDS_URL}"
fi

elif [[ "${1}" == "-cloud" ]] ; then
CLOUDS="${2}"
if [[ -z "${CLOUDS}" ]] ; then
die "No cloud name specified after -cloud"
fi

else
die ""
fi

for cloud in ${CLOUDS} ; do
for image in ${IMAGES} ; do
echo "Building ${image} image for cloud ${cloud} ..."
"${SCRIPT_DIR}/bpute" "me/clouds/${cloud}/packer/${image}" || die "Error submitting packer build: ${image} / ${cloud}"
done
done

+ 8
- 9
bin/reset_bubble_full Näytä tiedosto

@@ -8,14 +8,14 @@
# Usage: reset_bubble_full
#
SCRIPT="${0}"
SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd)
. ${SCRIPT_DIR}/bubble_common
SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)"
. "${SCRIPT_DIR}/bubble_common"

SELF_NODE_JSON="${HOME}/self_node.json"
BUBBLE_VERSIONS_FILE="${HOME}/bubble_versions.properties"

BUBBLE_LOCAL_STORAGE_DIR_DEFAULT=".bubble_local_storage"
BUBBLE_LOCAL_STORAGE_DIR=$(${SCRIPT_DIR}/bin/bconst bubble.cloud.storage.local.LocalStorageDriver.BUBBLE_LOCAL_STORAGE_DIR)
BUBBLE_LOCAL_STORAGE_DIR="$("${SCRIPT_DIR}/bin/bconst" bubble.cloud.storage.local.LocalStorageDriver.BUBBLE_LOCAL_STORAGE_DIR)"
if [[ -z ${BUBBLE_LOCAL_STORAGE_DIR} ]] ; then
echo "Error determining Bubble LocalStorage directory, using default: ${BUBBLE_LOCAL_STORAGE_DIR_DEFAULT}"
BUBBLE_LOCAL_STORAGE_DIR=${BUBBLE_LOCAL_STORAGE_DIR_DEFAULT}
@@ -23,24 +23,23 @@ fi
BUBBLE_LOCAL_STORAGE_DIR="${HOME}/${BUBBLE_LOCAL_STORAGE_DIR}"

BUBBLE_CLOUD_DATA_DIR_DEFAULT="bubble_cloudServiceData"
BUBBLE_CLOUD_DATA_DIR=$(${SCRIPT_DIR}/bin/bconst bubble.ApiConstants.BUBBLE_CLOUD_SERVICE_DATA)
BUBBLE_CLOUD_DATA_DIR="$("${SCRIPT_DIR}/bin/bconst" bubble.ApiConstants.BUBBLE_CLOUD_SERVICE_DATA)"
if [[ -z ${BUBBLE_CLOUD_DATA_DIR} ]] ; then
echo "Error determining Bubble Cloud Service Data directory, using default: "
BUBBLE_CLOUD_DATA_DIR=${BUBBLE_CLOUD_DATA_DIR_DEFAULT}
fi
BUBBLE_CLOUD_DATA_DIR="${HOME}/${BUBBLE_CLOUD_DATA_DIR}"


rm -f ${SELF_NODE_JSON} || die "Error removing ${SELF_NODE_JSON}"
rm -f "${SELF_NODE_JSON}" || die "Error removing ${SELF_NODE_JSON}"
echo "> removed: ${SELF_NODE_JSON}"

rm -f ${BUBBLE_VERSIONS_FILE} || die "Error removing ${BUBBLE_VERSIONS_FILE}"
rm -f "${BUBBLE_VERSIONS_FILE}" || die "Error removing ${BUBBLE_VERSIONS_FILE}"
echo "> removed: ${BUBBLE_VERSIONS_FILE}"

rm -rf ${BUBBLE_LOCAL_STORAGE_DIR} || die "Error removing ${BUBBLE_LOCAL_STORAGE_DIR}"
rm -rf "${BUBBLE_LOCAL_STORAGE_DIR}" || die "Error removing ${BUBBLE_LOCAL_STORAGE_DIR}"
echo "> removed: ${BUBBLE_LOCAL_STORAGE_DIR}"

rm -rf ${BUBBLE_CLOUD_DATA_DIR} || die "Error removing ${BUBBLE_CLOUD_DATA_DIR}"
rm -rf "${BUBBLE_CLOUD_DATA_DIR}" || die "Error removing ${BUBBLE_CLOUD_DATA_DIR}"
echo "> removed: ${BUBBLE_CLOUD_DATA_DIR}"

dropdb bubble || die "Error dropping bubble database"


+ 32
- 1
bubble-server/pom.xml Näytä tiedosto

@@ -245,11 +245,42 @@
<version>1.11.699</version>
</dependency>

<!-- mailgun driver users this library -->
<!-- mailgun driver user this library -->
<!-- exclude httpclient libs because old version generates warning for AWS lib -->
<!-- add back more recent httpasyncclient lib -->
<dependency>
<groupId>com.mashape.unirest</groupId>
<artifactId>unirest-java</artifactId>
<version>1.4.9</version>
<exclusions>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpasyncclient</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpasyncclient</artifactId>
<version>4.1.4</version>
<exclusions>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>


+ 8
- 1
bubble-server/src/main/java/bubble/main/BubbleScriptMain.java Näytä tiedosto

@@ -5,11 +5,14 @@
package bubble.main;

import bubble.server.BubbleConfiguration;
import lombok.extern.slf4j.Slf4j;

import java.util.Map;

import static bubble.ApiConstants.getBubbleDefaultDomain;
import static org.cobbzilla.util.daemon.ZillaRuntime.shortError;

@Slf4j
public class BubbleScriptMain extends BubbleScriptMainBase<BubbleScriptOptions> {

public static final BubbleConfiguration DEFAULT_BUBBLE_CONFIG = new BubbleConfiguration();
@@ -17,7 +20,11 @@ public class BubbleScriptMain extends BubbleScriptMainBase<BubbleScriptOptions>
public static void main (String[] args) { main(BubbleScriptMain.class, args); }

@Override protected void setScriptContextVars(Map<String, Object> ctx) {
ctx.put("defaultDomain", getBubbleDefaultDomain());
try {
ctx.put("defaultDomain", getBubbleDefaultDomain());
} catch (Exception e) {
log.warn("setScriptContextVars: no default domain found: "+shortError(e));
}
ctx.put("serverConfig", DEFAULT_BUBBLE_CONFIG);
super.setScriptContextVars(ctx);
}


+ 3
- 0
bubble-server/src/main/java/bubble/service/packer/PackerJob.java Näytä tiedosto

@@ -4,6 +4,7 @@
*/
package bubble.service.packer;

import bubble.ApiConstants;
import bubble.cloud.CloudRegion;
import bubble.cloud.CloudRegionRelative;
import bubble.cloud.compute.ComputeConfig;
@@ -40,6 +41,7 @@ import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;

import static bubble.ApiConstants.HOME_DIR;
import static bubble.ApiConstants.copyScripts;
import static bubble.model.cloud.RegionalServiceDriver.findClosestRegions;
import static bubble.server.SoftwareVersions.*;
@@ -155,6 +157,7 @@ public class PackerJob implements Callable<List<PackerImage>> {
for (NameAndValue variable : packerConfig.getVars()) {
env.put(variable.getName(), HandlebarsUtil.apply(configuration.getHandlebars(), variable.getValue(), ctx, '[', ']'));
}
if (!env.containsKey("HOME")) env.put("HOME", HOME_DIR);
ctx.put(VARIABLES_VAR, packerConfig.getVars());

// copy ansible and other packer files to temp dir


+ 1
- 1
bubble-server/src/main/resources/META-INF/bubble/bubble.properties Näytä tiedosto

@@ -1 +1 @@
bubble.version=Adventure 1.3.3
bubble.version=Adventure 1.4.0

+ 1
- 1
utils/cobbzilla-parent

@@ -1 +1 @@
Subproject commit e1517a9194e104c3ae903cd90f89652ab095bec1
Subproject commit e6307fb17534ba2ee2a4fa261e4c958027862265

+ 1
- 1
utils/cobbzilla-utils

@@ -1 +1 @@
Subproject commit 682312ab9a16279db0b078b9ff5802adbb02c23f
Subproject commit 3d8b5a8b74eaf0d5d778db5bc1479593c18838a0

Ladataan…
Peruuta
Tallenna