From 2ff4ba253bf7af87655c842f0236f64d9265e6be Mon Sep 17 00:00:00 2001 From: Orie Steele Date: Tue, 26 Jun 2018 18:41:41 -0500 Subject: [PATCH] More CLI Bootstrap fixes for macOS (#152) * remove sudo from minikube start, only needed when vmdriver is none: * test * test * publish cli version 0.2.4 * clean up w8 * attempt to fix path error for bash scripts * test debug command * more cleanup * published transmute-cli@0.2.5 * implement feedback * update readme --- .travis.yml | 6 +- README.md | 10 ++ bootstrap | 117 +++++++----------- packages/transmute-cli/package-lock.json | 2 +- packages/transmute-cli/package.json | 2 +- packages/transmute-cli/scripts/w8s/ready.w8 | 56 +-------- .../src/commands/debug/README.md | 3 + .../transmute-cli/src/commands/debug/debug | 8 ++ .../transmute-cli/src/commands/debug/debug_1 | 6 + .../transmute-cli/src/commands/debug/index.js | 8 ++ .../src/commands/init/initializer | 20 ++- .../src/commands/provision/index.js | 17 ++- packages/transmute-cli/src/index.js | 15 +++ packages/transmute-dashboard/production | 2 +- 14 files changed, 124 insertions(+), 148 deletions(-) create mode 100644 packages/transmute-cli/src/commands/debug/README.md create mode 100755 packages/transmute-cli/src/commands/debug/debug create mode 100755 packages/transmute-cli/src/commands/debug/debug_1 create mode 100644 packages/transmute-cli/src/commands/debug/index.js diff --git a/.travis.yml b/.travis.yml index 9ef18cf78..2705ec862 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,11 +34,7 @@ before_script: - cd $TRAVIS_BUILD_DIR - transmute k8s provision-minikube travis_test_cluster --vmdriver none - transmute k8s init travis_test_cluster - # TODO: These commands should be moved to the cli - - kubectl get pods --all-namespaces - - kubectl get svc --all-namespaces - - kubectl describe pod $(kubectl get pod --all-namespaces|grep gateway-kong-migrations|awk '{print $2}') - - kubectl describe pod $(kubectl get pod --all-namespaces|grep -v gateway-kong-migrations|grep gateway-kong|awk '{print $2}') + - transmute debug script: - lerna bootstrap diff --git a/README.md b/README.md index f135abbc9..942981b38 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,16 @@ Setup First step is to install the development dependencies. Review this bootstrap script before running it: +``` +curl -Ls https://git.io/transmute_bootstrap > transmute_bootstrap +chmod +x transmute_bootstrap +./transmute_bootstrap +# cleanup +rm -rf ./transmute_bootstrap +``` + +Or if you like to live dangerously... + ``` source <(curl -Ls https://git.io/transmute_bootstrap) ``` diff --git a/bootstrap b/bootstrap index 350fc6efc..ed5e16e83 100755 --- a/bootstrap +++ b/bootstrap @@ -15,45 +15,16 @@ export CWD=$(pwd) export PATH=$TRANSMUTE_BIN:$PATH -squawk () { - # This function simplifies error reporting and verbosity - # call it by preceding your message with a verbosity level - # e.g. `squawk 3 "This is a squawk"` - # if the current verbosity level is greater than or equal to - # the number given then this function will echo out your message - # and pad it with # to let you now how verbose that message was - squawk_lvl=$1 - shift - squawk=$1 - shift - squawk_opt=$@ - - if [[ "$TRANSMUTE_VERBOSITY" -ge "$squawk_lvl" ]] ; then - count_squawk=0 - while [[ "$count_squawk" -lt "$squawk_lvl" ]]; do - printf "#" - count_squawk=`expr $count_squawk + 1` - done - printf " $squawk \n" - fi -} - -errror () { - printf "-------------------------------------------------------------\n" - printf "ERROR!!! -- " -} - # Check if a command exists check_cmd () { if ! type "$1" > /dev/null; then - errror echo "$1 was not found in your path!" echo "To proceed please install $1 to your path and try again!" exit 1 fi } -warrrn () { +warn_user_of_global_install () { sleep 1 printf "(ctrl-c now to stop if this is not what you intend)!" sleep 1; printf "!"; sleep 1; printf "!" @@ -69,7 +40,6 @@ chkdir () { sudo chown $USER $1 fi if [ ! -w $1 ] ; then - errror echo "Cannot write to $1, please check your permissions" exit 2 fi @@ -81,13 +51,13 @@ TARGET_FILE_FOR_ADD=~/.profile check_if_line_exists() { - squawk 3 "Checking for '$LINE_TO_ADD' in $TARGET_FILE_FOR_ADD" + echo "Checking for '$LINE_TO_ADD' in $TARGET_FILE_FOR_ADD" grep -qsFx "$LINE_TO_ADD" $TARGET_FILE_FOR_ADD } add_line_to() { - squawk 3 "Adding '$LINE_TO_ADD' to $TARGET_FILE_FOR_ADD" + echo "Adding '$LINE_TO_ADD' to $TARGET_FILE_FOR_ADD" TARGET_FILE=$TARGET_FILE_FOR_ADD [ -w "$TARGET_FILE" ] || TARGET_FILE=$TARGET_FILE_FOR_ADD printf "%s\n" "$LINE_TO_ADD" >> "$TARGET_FILE" @@ -99,7 +69,7 @@ macminikube () { printf "minikube installed, skipping.\n" else # The package is not installed - squawk 3 'Installing minikube' + echo 'Installing minikube' brew cask install minikube fi } @@ -110,7 +80,7 @@ mackubectl () { printf "kubectl installed, skipping.\n" else # The package is not installed - squawk 3 'Installing kubectl' + echo 'Installing kubectl' brew install kubectl brew link kubernetes-cli fi @@ -122,7 +92,7 @@ install_mac_virtualbox () { printf "virtualbox installed, skipping.\n" else # The package is not installed - squawk 3 'Installing virtualbox' + echo 'Installing virtualbox' brew cask install virtualbox fi } @@ -134,13 +104,13 @@ machelm () { printf "helm installed, skipping.\n" else # The package is not installed - squawk 3 'Installing helm' + echo 'Installing helm' brew install kubernetes-helm fi } macnsenter () { - squawk 3 'NOT Installing nsenter' + echo 'NOT Installing nsenter' #brew install kubernetes-nsenter } @@ -152,28 +122,28 @@ macreadlink () { else # The package is not installed #Installs 'greadlink' tool - squawk 3 'Installing coreutils' + echo 'Installing coreutils' brew install coreutils fi } windowsminikube () { - squawk 3 'Installing minikube' + echo 'Installing minikube' choco install minikube } windowskubectl () { - squawk 3 'Installing kubectl' + echo 'Installing kubectl' choco install kubernetes-cli } windowshelm () { - squawk 3 'Installing helm' + echo 'Installing helm' choco install helm } windowsnsenter () { - squawk 3 'Installing nsenter' + echo 'Installing nsenter' choco install nsenter } @@ -191,7 +161,7 @@ install_nsenter_linux (){ install_kubectl_linux () { if ! type "kubectl" >/dev/null 2>/dev/null; then - squawk 3 'Installing kubectl' + echo 'Installing kubectl' TMP=$(mktemp -d --suffix=KUBECTLTMP) cd $TMP curl -LO https://storage.googleapis.com/kubernetes-release/release/$TRANSMUTE_KUBE_VERSION/bin/linux/amd64/kubectl @@ -204,7 +174,7 @@ install_kubectl_linux () { install_minikube_linux () { if ! type "minikube" >/dev/null 2>/dev/null; then - squawk 3 'Installing minikube' + echo 'Installing minikube' curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.25.2/minikube-linux-amd64 chmod +x minikube @@ -246,7 +216,7 @@ nvm_dir_adds () { dotfiles_install () { if [[ $TRANSMUTE_VERBOSITY -gt '1' ]]; then - squawk 3 'Adjusting dotfiles' + echo 'Adjusting dotfiles' fi touch $HOME/.zshrc touch $HOME/.bashrc @@ -261,6 +231,7 @@ dotfiles_install () { } install_certbot () { + echo 'Install certbot for Lets Encrypt. This may hang for a bit.' if ! type "certbot-auto" >/dev/null 2>/dev/null; then curl -O https://dl.eff.org/certbot-auto chmod a+x ./certbot-auto @@ -290,12 +261,12 @@ install_certbot () { set -e cd else - squawk 3 'certbot-auto already installed skipping' + echo 'certbot-auto already installed skipping' fi } install_nvm () { - squawk 5 "install_nvm" + echo "Install NVM" set +e export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm @@ -305,7 +276,7 @@ install_nvm () { set -e if [ "$this_output" = "$NVM_VERSION" ]; then - squawk 3 "NVM $NVM_VERSION is already installed skipping" + echo "NVM $NVM_VERSION is already installed skipping" else touch ~/.profile @@ -326,7 +297,7 @@ install_lerna_npm () { if ! type "lerna" >/dev/null 2>/dev/null; then npm i -g lerna@2.9.0 else - squawk 3 'lerna already installed skipping' + echo 'lerna already installed skipping' fi } @@ -334,7 +305,7 @@ install_truffle_npm () { if ! type "truffle" >/dev/null 2>/dev/null; then npm i -g truffle@4.1.8 else - squawk 3 'truffle already installed skipping' + echo 'truffle already installed skipping' fi } @@ -342,14 +313,14 @@ install_ngrok_npm () { if ! type "ngrok" >/dev/null 2>/dev/null; then npm i -g ngrok else - squawk 3 'ngrok already installed skipping' + echo 'ngrok already installed skipping' fi } lts_install () { if ! type "npm" >/dev/null 2>/dev/null; then if [[ $TRANSMUTE_VERBOSITY -gt '2' ]]; then - squawk 3 'Installing Node 8 LTS/carbon' + echo 'Installing Node 8 LTS/carbon' fi export NVM_DIR="$HOME/.nvm" @@ -359,17 +330,17 @@ lts_install () { set +e nvm ls-remote --lts=carbon if [[ $TRANSMUTE_VERBOSITY -gt '2' ]]; then - squawk 3 "Engage nvm to install lts/carbon" + echo "Engage nvm to install lts/carbon" fi nvm install --lts=carbon if [[ $TRANSMUTE_VERBOSITY -gt '2' ]]; then - squawk 3 "Engage nvm to alias lts/carbon to default" + echo "Engage nvm to alias lts/carbon to default" fi nvm alias default lts/carbon nvm use default set -e else - squawk 3 'npm already installed skipping' + echo 'npm already installed skipping' fi } @@ -392,7 +363,7 @@ install_socat () { exit 1 fi else - squawk 3 'socat already installed skipping' + echo 'socat already installed skipping' fi } @@ -415,7 +386,7 @@ install_curl () { exit 1 fi else - squawk 3 'curl already installed skipping' + echo 'curl already installed skipping' fi } @@ -438,7 +409,7 @@ install_git () { exit 1 fi else - squawk 3 'git already installed skipping' + echo 'git already installed skipping' fi } @@ -461,7 +432,7 @@ install_jq () { exit 1 fi else - squawk 3 'jq already installed skipping' + echo 'jq already installed skipping' fi } @@ -560,7 +531,7 @@ exec 1>&2 UNAME=$(uname) if [ "$UNAME" = "Linux" -o "$UNAME" = "Darwin" ] ; then - squawk 3 " $UNAME is a Supported OS" + echo " $UNAME is a Supported OS" elif [ "$UNAME" ">" "MINGW" -a "$UNAME" "<" "MINGX" ] ; then echo " $UNAME is not a Supported OS" exit 1 @@ -573,7 +544,7 @@ fi if [ "$UNAME" = "Darwin" ] ; then check_cmd brew ### OSX ### - squawk 3 'Checking arch' + echo 'Checking arch' if [ "i386" != "$(uname -p)" -o "1" != "$(sysctl -n hw.cpu64bit_capable 2>/dev/null || echo 0)" ] ; then # Can't just test uname -m = x86_64, because Snow Leopard can # return other values. @@ -601,18 +572,16 @@ sleep 1 echo "This script will install minikube, kubectl and helm, and then install transmute." if [[ "$TRANSMUTE_USE_WARN" == 'y' ]]; then - warrrn + warn_user_of_global_install fi -squawk 3 "Checking $TRANSMUTE_DIR" -mkdir -p $TRANSMUTE_DIR/git +echo "Checking $TRANSMUTE_DIR" mkdir -p $TRANSMUTE_BIN if [ -e "$TRANSMUTE_DIR/git" ]; then - squawk 3 "$TRANSMUTE_DIR/git exists already, proceeding" + echo "$TRANSMUTE_DIR/git exists already, proceeding" else - squawk 3 "$TRANSMUTE_DIR/git does not exist already, proceeding" - cd $TRANSMUTE_DIR + echo "$TRANSMUTE_DIR/git does not exist already, proceeding" mkdir -p $TRANSMUTE_DIR/git fi @@ -627,8 +596,7 @@ if [ "$TRAVIS" = 'true' ]; then ln -s $TRAVIS_BUILD_DIR transmute elif [ -e "$TRANSMUTE_REPO" ]; then - squawk 3 "$TRANSMUTE_REPO exists already, proceeding" - squawk 3 'Updating the transmute repo' + echo 'Updating the transmute repo' cd $TRANSMUTE_REPO git fetch --tags git checkout $TRANSMUTE_RELEASE @@ -636,7 +604,7 @@ elif [ -e "$TRANSMUTE_REPO" ]; then cd $CWD else cd $TRANSMUTE_DIR/git - squawk 3 'Cloning the latest transmute repo' + echo 'Cloning the latest transmute repo' git clone --depth=1 \ https://github.com/transmute-industries/transmute.git cd $TRANSMUTE_REPO @@ -650,7 +618,6 @@ if [ "$FIX_DOTFILES" = "true" ]; then dotfiles_install fi -squawk 5 ' make reqs' if [ "$PLATFORM" = "os.linux.x86_64" ] ; then linuxreqs elif [ "$PLATFORM" = "os.osx.x86_64" ] ; then @@ -659,11 +626,11 @@ elif [ "$PLATFORM" = "os.windows.x86_64" ] ; then windowsreqs fi -squawk 3 'check helm' +echo 'check helm' check_cmd helm -squawk 3 'check kubectl' +echo 'check kubectl' check_cmd kubectl -squawk 3 'check minikube' +echo 'check minikube' check_cmd minikube echo 'The bootstrap has finished' diff --git a/packages/transmute-cli/package-lock.json b/packages/transmute-cli/package-lock.json index add7d3d4c..3dfd36464 100644 --- a/packages/transmute-cli/package-lock.json +++ b/packages/transmute-cli/package-lock.json @@ -1,6 +1,6 @@ { "name": "transmute-cli", - "version": "0.2.3", + "version": "0.2.4", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/transmute-cli/package.json b/packages/transmute-cli/package.json index 2bdbf9736..0db41484e 100644 --- a/packages/transmute-cli/package.json +++ b/packages/transmute-cli/package.json @@ -1,6 +1,6 @@ { "name": "transmute-cli", - "version": "0.2.3", + "version": "0.2.5", "description": "transmute cli", "scripts": { "transmute": "./src/index.js", diff --git a/packages/transmute-cli/scripts/w8s/ready.w8 b/packages/transmute-cli/scripts/w8s/ready.w8 index 103fc228a..504e09b17 100755 --- a/packages/transmute-cli/scripts/w8s/ready.w8 +++ b/packages/transmute-cli/scripts/w8s/ready.w8 @@ -1,31 +1,5 @@ #!/bin/bash -: ${TRANSMUTE_DIR:=$HOME/.transmute} -source $TRANSMUTE_DIR/.env - -squawk () { - # This function simplifies error reporting and verbosity - # call it by preceding your message with a verbosity level - # e.g. `squawk 3 "This is a squawk"` - # if the current verbosity level is greater than or equal to - # the number given then this function will echo out your message - # and pad it with # to let you now how verbose that message was - squawk_lvl=$1 - shift - squawk=$1 - shift - squawk_opt=$@ - - if [[ "$TRANSMUTE_VERBOSITY" -ge "$squawk_lvl" ]] ; then - count_squawk=0 - while [[ "$count_squawk" -lt "$squawk_lvl" ]]; do - printf "#" - count_squawk=`expr $count_squawk + 1` - done - echo " $squawk" - fi -} - if [ $# -ne 2 ]; then # Print usage echo 'Error! wrong number of arguments' @@ -43,13 +17,8 @@ qrunning () { RESULT=$(kubectl get --namespace=$2 -o template pod --template={{.status.phase}} $1 2>/dev/null | grep Running) if [ "$RESULT" ]; then echo '.' - squawk 1 "$1 is now running" break fi - if [ "$TRANSMUTE_VERBOSITY" -ge 14 ] ; then - squawk 3 "$2" - kubectl get pods --namespace $2 - fi countone=`expr $countone + 1` sleep 3 done @@ -65,51 +34,36 @@ qready () { '. | select(.status.phase = ([ .status.conditions[] | select(.type == "Ready" and .state == true) ] | length ) == 1 ) | .metadata.namespace + "/" + .metadata.name' ) if [ "$RESULT" ]; then if [[ $USE_STRICT_W8 == 'true' ]]; then - # Calculate the number of pods not ready - # by awking out the ready column which usually looks like '1/1' - # but is sometimes '0/1' or '1/3', etc - # Then use cut to split that field using '/' as a delimiter - # Next use awk again to transpose the two numbers and stick a ' - ' in between them - # And feed the whole string to `bc` which can do some basic caclulcations on the cli - # If the answer is zero and the above has passed then I am fairly certain this pod is up and ready - NOT_READY_PODS=$(kubectl get pods -n $2 |grep $1|awk '{print $2}'|cut -f1,2 -d'/' --output-delimiter=' '|awk '{print $2 " - " $1}'|bc) + # Ready column can look like '0/1' or '1/3', this hacky bash checks if the fraction = 1 + NOT_READY_PODS=$(kubectl get pods -n $2 | grep $1| awk '{print $2}'| sed 's,/, ,g' | awk '{print $2 " - " $1}'| bc) if [[ $NOT_READY_PODS -eq 0 ]]; then echo '.' - squawk 1 "$1 is now ready" break fi else - READY_PODS=$(kubectl get pods -n $2 |grep $1|awk '{print $2}'|cut -f1,2 -d'/' --output-delimiter=' '|awk '{print $1}') + READY_PODS=$(kubectl get pods -n $2 | grep $1 | awk '{print $2}' | sed 's,/, ,g' | awk '{print $1}') if [[ $READY_PODS -gt 0 ]]; then echo '.' - squawk 1 "$1 is now ready" break fi fi fi - if [ "$TRANSMUTE_VERBOSITY" -ge 14 ] ; then - squawk 3 "$2" - kubectl get pods --namespace $2 - fi countone=`expr $countone + 1` sleep 3 done } main () { - squawk 9 'Ready.w8' + echo 'Ready.w8' if [[ $EXCLUDE_POD ]]; then KUBE_SELECTED_PODS=$(kubectl get pods --namespace=$2 2>/dev/null |awk '{print $1}'|grep $1 |grep -v $EXCLUDE_POD |tr '\n' ' ') else KUBE_SELECTED_PODS=$(kubectl get pods --namespace=$2 2>/dev/null |awk '{print $1}'|grep $1 |tr '\n' ' ') fi for this_pod in $KUBE_SELECTED_PODS; do - squawk 9 "testing $this_pod in the namespace $2 for running and readiness" + echo "testing $this_pod in the namespace $2 for running and readiness" qrunning $this_pod $2 qready $this_pod $2 - if [ "$TRANSMUTE_VERBOSITY" -ge 15 ] ; then - kubectl get pods --namespace $2 - fi done } diff --git a/packages/transmute-cli/src/commands/debug/README.md b/packages/transmute-cli/src/commands/debug/README.md new file mode 100644 index 000000000..fce71805d --- /dev/null +++ b/packages/transmute-cli/src/commands/debug/README.md @@ -0,0 +1,3 @@ +This command is a template for more complex commands. + +It shows how to call bash from JS, and how to call bash from bash, rooted in node_modules. \ No newline at end of file diff --git a/packages/transmute-cli/src/commands/debug/debug b/packages/transmute-cli/src/commands/debug/debug new file mode 100755 index 000000000..6d8f910c8 --- /dev/null +++ b/packages/transmute-cli/src/commands/debug/debug @@ -0,0 +1,8 @@ +echo 'DEBUG: CLI Details' + +# These are example commands that can run in bash +echo $(whoami) +echo $PWD + +# Here is now to call another bash script, relative to this global npm package +$(npm root -g)/transmute-cli/src/commands/debug/debug_1 \ No newline at end of file diff --git a/packages/transmute-cli/src/commands/debug/debug_1 b/packages/transmute-cli/src/commands/debug/debug_1 new file mode 100755 index 000000000..10067e8ce --- /dev/null +++ b/packages/transmute-cli/src/commands/debug/debug_1 @@ -0,0 +1,6 @@ +echo 'DEBUG: Cluster Details' + +kubectl get pods --all-namespaces +kubectl get svc --all-namespaces +kubectl describe pod $(kubectl get pod --all-namespaces|grep gateway-kong-migrations|awk '{print $2}') +kubectl describe pod $(kubectl get pod --all-namespaces|grep -v gateway-kong-migrations|grep gateway-kong|awk '{print $2}') diff --git a/packages/transmute-cli/src/commands/debug/index.js b/packages/transmute-cli/src/commands/debug/index.js new file mode 100644 index 000000000..71deea386 --- /dev/null +++ b/packages/transmute-cli/src/commands/debug/index.js @@ -0,0 +1,8 @@ +const run = require('../runner'); + +const path = require('path'); + +module.exports.debug = () => { + let command = path.join(__dirname, './debug '); + run.shellExec(command); +}; diff --git a/packages/transmute-cli/src/commands/init/initializer b/packages/transmute-cli/src/commands/init/initializer index 0614d3a66..9fae85937 100755 --- a/packages/transmute-cli/src/commands/init/initializer +++ b/packages/transmute-cli/src/commands/init/initializer @@ -20,8 +20,6 @@ exiter () { echo $DEBUG_MESSAGES } -trap exiter EXIT - squawk () { # This function simplifies error reporting and verbosity # call it by preceding your message with a verbosity level @@ -72,7 +70,7 @@ add_line_to() [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion # Wait for kubectl and kube-dns to be initialized -$TRANSMUTE_REPO/packages/transmute-cli/scripts/w8s/ready.w8 kube-dns kube-system +$(npm root -g)/transmute-cli/scripts/w8s/ready.w8 kube-dns kube-system sleep 5 @@ -80,7 +78,7 @@ sleep 5 squawk 5 'create tiller service account' kubectl create --save-config serviceaccount tiller --namespace kube-system squawk 5 'create tiller rbac config' -kubectl apply -f $TRANSMUTE_REPO/packages/transmute-cli/components/helm/rbac-tiller-config.yaml +kubectl apply -f $(npm root -g)/transmute-cli/components/helm/rbac-tiller-config.yaml sleep 5 if [[ "$TRANSMUTE_VERBOSITY" -ge "111" ]] ; then @@ -94,7 +92,7 @@ kubectl get pods squawk 5 "Install helm" helm init --service-account tiller -USE_STRICT_W8=true $TRANSMUTE_REPO/packages/transmute-cli/scripts/w8s/ready.w8 tiller-deploy kube-system +USE_STRICT_W8=true $(npm root -g)/transmute-cli/scripts/w8s/ready.w8 tiller-deploy kube-system sleep 1 kubectl get pods -n kube-system @@ -102,9 +100,9 @@ kubectl get pods -n kube-system squawk 5 "Ganache-cli" helm install \ --name=ganache \ - $TRANSMUTE_REPO/packages/transmute-cli/components/ganache/charts/ganache-cli/ + $(npm root -g)/transmute-cli/components/ganache/charts/ganache-cli/ -$TRANSMUTE_REPO/packages/transmute-cli/scripts/w8s/ready.w8 ganache default +$(npm root -g)/transmute-cli/scripts/w8s/ready.w8 ganache default squawk 5 "ipfs" #squawk 6 "Storage class for ipfs" @@ -114,7 +112,7 @@ helm install \ stable/ipfs \ --name decentralized-storage -$TRANSMUTE_REPO/packages/transmute-cli/scripts/w8s/ready.w8 decentralized-storage-ipfs default +$(npm root -g)/transmute-cli/scripts/w8s/ready.w8 decentralized-storage-ipfs default if [[ "$DO_FAAS" == 'y' ]]; then squawk 5 "OpenFaaS" @@ -124,7 +122,7 @@ if [[ "$DO_FAAS" == 'y' ]]; then #squawk 5 "OpenFaas RBAC" #kubectl apply -f https://raw.githubusercontent.com/openfaas/faas-netes/master/yaml/rbac.yml squawk 5 "OpenFaas Helmchart" - cd $TRANSMUTE_REPO/packages/transmute-cli/components/openfaas/faas-netes/chart + cd $(npm root -g)/transmute-cli/components/openfaas/faas-netes/chart helm upgrade --install openfaas openfaas/ \ --namespace openfaas \ --set functionNamespace=openfaas-fn @@ -134,8 +132,8 @@ fi helm install stable/kong --name gateway squawk 5 "spin up" -$TRANSMUTE_REPO/packages/transmute-cli/scripts/w8s/ready.w8 gateway-postgresql default -EXCLUDE_POD=gateway-kong-migration $TRANSMUTE_REPO/packages/transmute-cli/scripts/w8s/ready.w8 gateway-kong default +$(npm root -g)/transmute-cli/scripts/w8s/ready.w8 gateway-postgresql default +EXCLUDE_POD=gateway-kong-migration $(npm root -g)/transmute-cli/scripts/w8s/ready.w8 gateway-kong default export MINIKUBE_IP=$(minikube ip) export KONG_ADMIN_URL=$(PATH=$HOME/.transmute/bin:$PATH minikube service gateway-kong-admin --url | sed 's,http://,https://,g') export KONG_PROXY_URL=$(PATH=$HOME/.transmute/bin:$PATH minikube service gateway-kong-proxy --url | sed 's,http://,https://,g') diff --git a/packages/transmute-cli/src/commands/provision/index.js b/packages/transmute-cli/src/commands/provision/index.js index 235a5d382..7612d093f 100755 --- a/packages/transmute-cli/src/commands/provision/index.js +++ b/packages/transmute-cli/src/commands/provision/index.js @@ -1,4 +1,5 @@ const run = require('../runner'); +const logger = require('../../logger'); const TRANSMUTE_KUBE_VERSION = process.env.TRANSMUTE_KUBE_VERSION || 'v1.9.0'; const MINIKUBE_CPU = process.env.MINIKUBE_CPU || '4'; const MINIKUBE_MEMORY = process.env.MINIKUBE_MEMORY || '4096'; @@ -6,8 +7,8 @@ const MINIKUBE_DISK = process.env.MINIKUBE_DISK || '100g'; const MINIKUBE_PROFILE = process.env.MINIKUBE_PROFILE || 'transmute-k8s'; module.exports.minikube = (dryrun, clusterName, minikubeDriver) => { - const minikube_start = - 'sudo minikube start ' + + let minikube_start = + 'minikube start ' + ' --kubernetes-version ' + TRANSMUTE_KUBE_VERSION + ' --disk-size ' + @@ -17,7 +18,17 @@ module.exports.minikube = (dryrun, clusterName, minikubeDriver) => { ' --memory ' + MINIKUBE_MEMORY; +' --profile ' + MINIKUBE_PROFILE; - let prov_cmd = minikube_start + ' --vm-driver=virtualbox'; + + if (minikubeDriver == 'none') { + logger.log({ + level: 'info', + message: `VMDriver=None requires minikube to run as root!` + }); + minikube_start = 'sudo ' + minikube_start; + } + + let prov_cmd; + if (minikubeDriver == undefined) { prov_cmd = minikube_start + ' --vm-driver=virtualbox'; } else if (minikubeDriver == 'virtualbox') { diff --git a/packages/transmute-cli/src/index.js b/packages/transmute-cli/src/index.js index f30775a2d..bcc40490f 100755 --- a/packages/transmute-cli/src/index.js +++ b/packages/transmute-cli/src/index.js @@ -24,6 +24,8 @@ const telemetry = require('./commands/telemetry'); const login = require('./commands/login'); +const debug = require('./commands/debug'); + const logger = require('./logger'); // Mixpanel @@ -215,6 +217,19 @@ vorpal callback(); }); +/** transmute debug + * @name transmute debug + * @example transmute debug + * */ +vorpal + .command( + 'debug', + 'used for debugging the cli and cluster configuration via js / bash.' + ) + .action(async (args, callback) => { + debug.debug(); + }); + vorpal .delimiter('✨ $') .parse(process.argv) diff --git a/packages/transmute-dashboard/production b/packages/transmute-dashboard/production index 5b3d8ad5f..ea4167531 160000 --- a/packages/transmute-dashboard/production +++ b/packages/transmute-dashboard/production @@ -1 +1 @@ -Subproject commit 5b3d8ad5f684d3f30230531341786d87f308a0cb +Subproject commit ea416753186c0a86e5f5a2404d77525a82939063