Skip to content

Instantly share code, notes, and snippets.

@MikeLarned
Last active December 16, 2022 19:51
Show Gist options
  • Save MikeLarned/fa8e27c4301214b854115af29bb67929 to your computer and use it in GitHub Desktop.
Save MikeLarned/fa8e27c4301214b854115af29bb67929 to your computer and use it in GitHub Desktop.
Octo Deploy Debian Worker Shell Script
#!/bin/sh
export DEBIAN_FRONTEND=noninteractive
SERVER_URL=$1
APIKEY=$2
SPACE_NAME=$3
TENTACLE_NAME=$4
WORKER_POOL=$5
CONFIG_FILE_PATH="/etc/octopus/default/tentacle-default.config"
APPLICATION_PATH="/home/Octopus/Applications/"
PUBLIC_IP=$(curl -s https://ifconfig.info)
THUMBPRINT="EMPTY"
echo
echo "Register Octo Linux Worker /w Azure CLI"
echo
echo "SERVER_URL : $SERVER_URL"
echo "SPACE_NAME : $SPACE_NAME"
echo "TENTACLE_NAME : $TENTACLE_NAME"
echo "WORKER_POOL : $WORKER_POOL"
echo "PUBLIC_IP : $PUBLIC_IP"
echo ""
echo "Install Octo Tentacle"
echo
sudo apt-get update
sudo apt-get install -y software-properties-common
sudo apt install zip unzip
sudo apt-key adv --fetch-keys https://apt.octopus.com/public.key
sudo add-apt-repository "deb https://apt.octopus.com/ stretch main"
sudo apt-get update
sudo apt-get install -y tentacle
echo
echo "Register Octo Tentacle"
sudo /opt/octopus/tentacle/Tentacle create-instance --config "$CONFIG_FILE_PATH"
sudo /opt/octopus/tentacle/Tentacle new-certificate --if-blank
sudo /opt/octopus/tentacle/Tentacle configure --port 10933 --noListen False --reset-trust --app "$APPLICATION_PATH"
THUMBPRINT="$(/opt/octopus/tentacle/Tentacle show-thumbprint)"
echo "THUMBPRINT : $THUMBPRINT"
sudo /opt/octopus/tentacle/Tentacle configure --trust $THUMBPRINT
sudo /opt/octopus/tentacle/Tentacle register-worker --server "$SERVER_URL" --apiKey "$APIKEY" --space "$SPACE_NAME" --name "$TENTACLE_NAME" --workerPool "$WORKER_POOL" --publicHostname "$PUBLIC_IP"
sudo /opt/octopus/tentacle/Tentacle service --install --start
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment