new deployablility enhancements
This commit is contained in:
Executable
+37
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Ensure we are in the project root
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
if [ ! -d "customers" ]; then
|
||||
echo "Error: 'customers/' directory not found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Starting mass deployment for all customers..."
|
||||
echo "--------------------------------------------------"
|
||||
|
||||
# Iterate through .env.* files in the customers/ directory
|
||||
for env_file in customers/.env.*; do
|
||||
# Check if it's a regular file and not just the pattern itself (if no matches found)
|
||||
[ -e "$env_file" ] || continue
|
||||
|
||||
# Extract customer name from the filename (e.g., customers/.env.kmtn -> kmtn)
|
||||
# We remove the 'customers/.env.' prefix to get the name
|
||||
customer_name=$(basename "$env_file" | sed 's/\.env\.//')
|
||||
|
||||
echo "[$(date +'%H:%M:%S')] Deploying: $customer_name"
|
||||
echo "Using configuration: $env_file"
|
||||
|
||||
# Run docker compose. We use -p for the project name to isolate them correctly.
|
||||
docker compose --env-file "$env_file" -p "$customer_name" up -d --build
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "[$(date +'%H:%M:%S')] ✅ SUCCESS: $customer_name"
|
||||
else
|
||||
echo "[$(date +'%H:%M:%S')] ❌ FAILED: $customer_name"
|
||||
fi
|
||||
echo "--------------------------------------------------"
|
||||
done
|
||||
|
||||
echo "Mass deployment process completed."
|
||||
Reference in New Issue
Block a user