-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathdeploy.sh
27 lines (20 loc) · 988 Bytes
/
deploy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
# Define Silos and Deployment Details
SILOS=("silo1.example.com" "silo2.example.com" "silo3.example.com" ... "silo300.example.com")
INSTALL_DIR="/opt/pmll"
DEPLOY_DIR="path/to/binaries"
# Function to Deploy to a Single Silo
deploy_to_silo() {
local silo=$1
echo "Deploying to $silo..."
# Ensure the installation directory exists on the remote silo
ssh $silo "mkdir -p $INSTALL_DIR" || { echo "Failed to create directory on $silo"; return 1; }
# Copy binaries to the remote silo
scp $DEPLOY_DIR/* $silo:$INSTALL_DIR/ || { echo "Failed to copy to $silo"; return 1; }
# Start services on the remote silo
ssh $silo "cd $INSTALL_DIR && nohup ./silo_manager &> silo_manager.log & nohup ./api &> api.log & nohup ./logic_loop &> logic_loop.log &" || { echo "Failed to start services on $silo"; return 1; }
echo "Deployment successful on $silo"
}
# Deploy to All Silos
for silo in "${SILOS[@]}"; do
deploy_to_silo $silo &