Algo Docker
Please copy the following script to a file and execute the files.
readUserInputs() {
variable=""
eval input="$1"
eval length="$2"
while true
do
read -p "$input" variable
if [ ${#variable} -lt $length ]
then
echo "Input is not valid minimun $2 characters required"
else
break
fi
done
eval "$3=$variable"
}
function ConfigureComposefile() {
echo '
version: "3"
services:
algoagent:
container_name: algoAgent
privileged: true
image: "algosaas/algo_agent"
network_mode: host
# environment:
# LOG_LEVEL: "debug"
restart: always
volumes:
- "/opt/AlgoAgent/logs:/opt/AlgoAgent/logs"
- "/opt/AlgoAgent/salt:/etc/salt"
- "/opt/AlgoAgent/minion:/var/lib/salt/pki/minion"
- "/opt/AlgoAgent/cache:/var/cache/salt"
' > /opt/AlgoAgent/docker-compose.yaml
}
function ConfigureAgent() {
secret_key=""
secret_key_confirm=""
domain=""
echo "*****************************************"
readUserInputs "Please\ enter\ your\ Domain\ Without\ https:-\ " 6 domain
readUserInputs "Please\ enter\ your\ SecretKey:-\ " 6 secret_key
readUserInputs "Please\ confirm\ your\ SecretKey:-\ " 6 secret_key_confirm
echo "*****************************************"
if [ "$secret_key" != "$secret_key_confirm" ]; then
echo "Secret Key is not matching with confirm SecretKey"
exit
fi
mkdir -p /opt/AlgoAgent/{logs,salt,minion,cache,salt/minion.d}
echo 'id: '$secret_key > /opt/AlgoAgent/salt/minion.d/minion.conf
echo 'master: '$domain >> /opt/AlgoAgent/salt/minion.d/minion.conf
echo '
grains_cache: True
grains_cache_expiration: 86400
random_reauth_delay: 60
recon_default: 1000
recon_max: 59000
recon_randomize: True
' >> /opt/AlgoAgent/salt/minion.d/minion.conf
}
dock_exists=`which docker`
if [ $? == 0 ]; then
ConfigureAgent
ConfigureComposefile
cd /opt/AlgoAgent/
docker-compose pull
echo "Please change directory to /opt/AlgoAgent/ and run docker-compose up -d for starting docker service"
else
echo "Docker Not Installed In The System"
echo "For Debian/Ubuntu install using apt command install docker.io docker-compose"
echo "For RPM based install using command yum install docker docker-compose"
fi
Â