Skip to content

Commit

Permalink
feat(install): Single command install with curl (#64)
Browse files Browse the repository at this point in the history
Co-authored-by: Addon Factory template <[email protected]>
  • Loading branch information
Ryan Faircloth and Addon Factory template authored Apr 29, 2021
1 parent ccd2ccb commit 7ccd01f
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 76 deletions.
25 changes: 25 additions & 0 deletions deploy/install.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

BRANCH=${BRANCH:=install-from-url}
echo using $BRANCH
URL=https://raw.githubusercontent.com/splunk/splunk-connect-for-snmp/${BRANCH}/deploy/install_full.bash

function download {
scratch="$(mktemp -d -t tmp.XXXXXXXXXX)" || exit
script_file="$scratch/install_full.bash"

echo "Downloading SC4SNMP Install Script: $URL"
curl -s -# "$URL" > "$script_file" || exit
chmod 775 "$script_file"

echo "Running install script from: $script_file"
bash "$script_file" "$@"
}

if { command true < /dev/tty; } > /dev/null 2>&1; then
# Grab prompt input from the tty.
download "$@" < /dev/tty
else
download "$@"
fi

37 changes: 26 additions & 11 deletions deploy/deploy.sh → deploy/install_full.bash
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,17 @@ install_dependencies() {
fi
}


###MAIN


if [ "$USER" != "root" ];
then
echo "must be root try sudo"
exit
fi


BRANCH=${BRANCH:-main}
K8S=${K8S:-mk8s}
if [ "$K8S" = "mk8s" ]; then

Expand Down Expand Up @@ -164,7 +168,7 @@ if [ ! -n "$MODE" ]; then
echo "MODE Both"
;;
*)
echo "MODE invalid"
echo "MODE invalid =$MODE"
exit 1
;;
esac
Expand Down Expand Up @@ -192,7 +196,7 @@ then

while [ ! -n "$PORT" ]
do
read -p 'PORT of Splunk HEC Inputs 443 (default): ' PROTO
read -p 'PORT of Splunk HEC Inputs 443 (default): ' PORT
PORT=${PORT:-443}
done
URI_PORT=":$PORT"
Expand Down Expand Up @@ -278,7 +282,9 @@ then

$HCMD repo add splunk https://splunk.github.io/splunk-connect-for-kubernetes/ >/dev/null
$HCMD uninstall -n sck sck
cat deploy/sck/sck_145.yaml \

if [ -f "deploy/sck/sck_145.yaml" ]; then sck_values="cat deploy/sck/sck_145.yaml"; else sck_values="curl -s https://raw.githubusercontent.com/splunk/splunk-connect-for-snmp/$BRANCH/deploy/sck/sck_145.yaml"; fi
$sck_values \
| sed "s/##INSECURE_SSL##/${INSECURE_SSL}/g" \
| sed "s/##PROTO##/${PROTO}/g" \
| sed "s/##PORT##/${PORT}/g" \
Expand Down Expand Up @@ -332,21 +338,30 @@ then
--from-literal=SIGNALFX_REALM=$SIMREALM
fi



$KCMD -n sc4snmp create -f deploy/sc4snmp/ftr 2>/dev/null
files=( "deploy/sc4snmp/ftr/scheduler-config.yaml" "deploy/sc4snmp/ftr/scheduler-inventory.yaml" "deploy/sc4snmp/ftr/traps-server-config.yaml")
for i in "${files[@]}"
do
if [ -f $i ]; then f=$i; else f=https://raw.githubusercontent.com/splunk/splunk-connect-for-snmp/$BRANCH/$i; fi
$KCMD -n sc4snmp create -f $f
done

while [ ! -n "$SHAREDIP" ]
do
read -p 'SHAREDIP for HA installations this is in addition to the member addresses for single instance this is the host ip: ' SHAREDIP

read -p 'SHAREDIP for HA installations this is in addition to the member addresses for single instance this is the host ip: ' SHAREDIP
done
svcip=$(echo $SHAREDIP | cut -d '/' -f 1)
cat deploy/sc4snmp/external/traps-service.yaml \

if [ -f "deploy/sc4snmp/external/traps-service.yaml" ]; then svc_values="cat deploy/sc4snmp/external/traps-service.yaml"; else svc_values="curl -s https://raw.githubusercontent.com/splunk/splunk-connect-for-snmp/$BRANCH/deploy/sc4snmp/external/traps-service.yaml"; fi
$svc_values \
| sed "s/##SHAREDIP##/${svcip}/g" \
| $KCMD -n sc4snmp apply -f -

$KCMD -n sc4snmp apply -f deploy/sc4snmp/internal
files=( "deploy/sc4snmp/internal/mib-server-deployment.yaml" "deploy/sc4snmp/internal/mongo-deployment.yaml" "deploy/sc4snmp/internal/otel-config.yaml" "deploy/sc4snmp/internal/otel-service.yaml" "deploy/sc4snmp/internal/rq-service.yaml" "deploy/sc4snmp/internal/traps-deployment.yaml" "deploy/sc4snmp/internal/mib-server-service.yaml" "deploy/sc4snmp/internal/mongo-service.yaml" "deploy/sc4snmp/internal/otel-deployment.yaml" "deploy/sc4snmp/internal/rq-deployment.yaml" "deploy/sc4snmp/internal/scheduler-deployment.yaml" "deploy/sc4snmp/internal/worker-deployment.yaml" )
for i in "${files[@]}"
do
if [ -f $i ]; then f=$i; else f=https://raw.githubusercontent.com/splunk/splunk-connect-for-snmp/$BRANCH/$i; fi
$KCMD -n sc4snmp create -f $f
done

echo ""
echo done
52 changes: 0 additions & 52 deletions deploy/sck/deploy_sck.sh

This file was deleted.

16 changes: 3 additions & 13 deletions docs/source/gettingstarted.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,12 @@ Obtain the correct realm and token.
Deploy
**************************************************

Get current deployment scripts
===================================================

.. code-block:: bash
git clone https://github.com/splunk/splunk-connect-for-snmp.git
cd splunk-connect-for-snmp
Deploy SC4SNMP Interactive
===================================================

.. code-block:: bash
./deploy/deploy.sh
curl -sfL https://raw.githubusercontent.com/splunk/splunk-connect-for-snmp/main/deploy/install.bash | sudo -E bash -
Deploy SC4SNMP non-interactive
Expand All @@ -63,7 +53,7 @@ This script has been tested with Centos 7, Centos 8, Redhat 8, and Ubuntu 20.04

.. code-block:: bash
sudo \
curl -sfL https://raw.githubusercontent.com/splunk/splunk-connect-for-snmp/install-from-url/deploy/install.bash | \
MODE=splunk \
PROTO=https \
INSECURE_SSL=true \
Expand All @@ -76,7 +66,7 @@ This script has been tested with Centos 7, Centos 8, Redhat 8, and Ubuntu 20.04
CLUSTER_NAME=foo \
SHAREDIP=10.202.18.166/32 \
RESOLVERIP=8.8.4.4 \
./deploy/deploy.sh
sudo -E bash -
* Confirm deployment using ``kubectl get svc -n sc4snmp`` confirm the value of external-ip in the row below matches IP used above
Expand Down

0 comments on commit 7ccd01f

Please sign in to comment.