forked from Nixius/template
Add debugging script for investigating deployment issues
ci/woodpecker/push/woodpecker Pipeline was successful
Details
ci/woodpecker/push/woodpecker Pipeline was successful
Details
This commit is contained in:
parent
63f0651bd9
commit
26d678e499
|
@ -0,0 +1,114 @@
|
|||
#!/bin/bash
|
||||
# Debug script for Easy Appointments deployment issues
|
||||
# Run this on macmini7 to gather diagnostic information
|
||||
|
||||
# Set colors for output
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
RED='\033[0;31m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
echo -e "${BLUE}===== Easy Appointments Deployment Debug =====${NC}"
|
||||
echo "Running on $(hostname) at $(date)"
|
||||
echo
|
||||
|
||||
# Create output directory
|
||||
OUTDIR="debug-output-$(date +%Y%m%d-%H%M%S)"
|
||||
mkdir -p $OUTDIR
|
||||
echo -e "${YELLOW}Saving all output to ${OUTDIR}/${NC}"
|
||||
echo
|
||||
|
||||
# Check Docker and Swarm status
|
||||
echo -e "${GREEN}1. Checking Docker and Swarm status${NC}"
|
||||
echo "Docker version:" > $OUTDIR/docker-info.txt
|
||||
docker version >> $OUTDIR/docker-info.txt 2>&1
|
||||
echo -e "\nDocker info:" >> $OUTDIR/docker-info.txt
|
||||
docker info >> $OUTDIR/docker-info.txt 2>&1
|
||||
echo -e "\nSwarm nodes:" >> $OUTDIR/docker-info.txt
|
||||
docker node ls >> $OUTDIR/docker-info.txt 2>&1
|
||||
echo "Done. See $OUTDIR/docker-info.txt"
|
||||
echo
|
||||
|
||||
# Check services
|
||||
echo -e "${GREEN}2. Checking services${NC}"
|
||||
echo "Service list:" > $OUTDIR/services.txt
|
||||
docker service ls >> $OUTDIR/services.txt 2>&1
|
||||
echo -e "\neasy-appointments service details:" >> $OUTDIR/services.txt
|
||||
docker service ps easy-appointments_easy-appointments --no-trunc >> $OUTDIR/services.txt 2>&1
|
||||
echo -e "\nmariadb service details:" >> $OUTDIR/services.txt
|
||||
docker service ps easy-appointments_mariadb --no-trunc >> $OUTDIR/services.txt 2>&1
|
||||
echo "Done. See $OUTDIR/services.txt"
|
||||
echo
|
||||
|
||||
# Collect logs
|
||||
echo -e "${GREEN}3. Collecting service logs${NC}"
|
||||
echo "Fetching easy-appointments logs..."
|
||||
docker service logs easy-appointments_easy-appointments --tail 1000 > $OUTDIR/easy-appointments.log 2>&1
|
||||
echo "Fetching mariadb logs..."
|
||||
docker service logs easy-appointments_mariadb --tail 1000 > $OUTDIR/mariadb.log 2>&1
|
||||
echo "Fetching traefik logs..."
|
||||
docker service logs traefik --tail 200 > $OUTDIR/traefik.log 2>&1
|
||||
echo "Done. See logs in $OUTDIR/"
|
||||
echo
|
||||
|
||||
# Check volumes
|
||||
echo -e "${GREEN}4. Checking volumes${NC}"
|
||||
echo "Volume list:" > $OUTDIR/volumes.txt
|
||||
docker volume ls >> $OUTDIR/volumes.txt 2>&1
|
||||
echo -e "\nmariadb_data volume:" >> $OUTDIR/volumes.txt
|
||||
docker volume inspect easy-appointments_mariadb_data >> $OUTDIR/volumes.txt 2>&1
|
||||
echo "Done. See $OUTDIR/volumes.txt"
|
||||
echo
|
||||
|
||||
# Check networks
|
||||
echo -e "${GREEN}5. Checking networks${NC}"
|
||||
echo "Network list:" > $OUTDIR/networks.txt
|
||||
docker network ls >> $OUTDIR/networks.txt 2>&1
|
||||
echo -e "\nTraefik network:" >> $OUTDIR/networks.txt
|
||||
docker network inspect traefik >> $OUTDIR/networks.txt 2>&1
|
||||
echo -e "\nDefault network:" >> $OUTDIR/networks.txt
|
||||
docker network inspect easy-appointments_default >> $OUTDIR/networks.txt 2>&1
|
||||
echo "Done. See $OUTDIR/networks.txt"
|
||||
echo
|
||||
|
||||
# Check system resources
|
||||
echo -e "${GREEN}6. Checking system resources${NC}"
|
||||
echo "Disk usage:" > $OUTDIR/resources.txt
|
||||
df -h >> $OUTDIR/resources.txt 2>&1
|
||||
echo -e "\nMemory usage:" >> $OUTDIR/resources.txt
|
||||
free -m >> $OUTDIR/resources.txt 2>&1
|
||||
echo -e "\nCPU info:" >> $OUTDIR/resources.txt
|
||||
top -bn1 | head -20 >> $OUTDIR/resources.txt 2>&1
|
||||
echo "Done. See $OUTDIR/resources.txt"
|
||||
echo
|
||||
|
||||
# Check DNS and connectivity
|
||||
echo -e "${GREEN}7. Checking DNS and connectivity${NC}"
|
||||
echo "cal.colinknapp.com DNS:" > $OUTDIR/connectivity.txt
|
||||
nslookup cal.colinknapp.com >> $OUTDIR/connectivity.txt 2>&1
|
||||
echo -e "\nstaging.cal.colinknapp.com DNS:" >> $OUTDIR/connectivity.txt
|
||||
nslookup staging.cal.colinknapp.com >> $OUTDIR/connectivity.txt 2>&1
|
||||
echo -e "\nHTTP check:" >> $OUTDIR/connectivity.txt
|
||||
curl -I cal.colinknapp.com >> $OUTDIR/connectivity.txt 2>&1
|
||||
echo "Done. See $OUTDIR/connectivity.txt"
|
||||
echo
|
||||
|
||||
# Create a tar archive of all debug info
|
||||
echo -e "${GREEN}8. Creating archive of all debug information${NC}"
|
||||
tar -czf easy-appointments-debug.tar.gz $OUTDIR
|
||||
echo "Archive created: easy-appointments-debug.tar.gz"
|
||||
echo
|
||||
|
||||
echo -e "${BLUE}===== Debug information collection complete =====${NC}"
|
||||
echo "All debug information has been saved to $OUTDIR/"
|
||||
echo "A compressed archive is available at: easy-appointments-debug.tar.gz"
|
||||
echo
|
||||
echo -e "${YELLOW}To analyze the results:${NC}"
|
||||
echo "1. Check service status in $OUTDIR/services.txt"
|
||||
echo "2. Review logs in $OUTDIR/easy-appointments.log and $OUTDIR/mariadb.log"
|
||||
echo "3. Look for any networking issues in $OUTDIR/networks.txt"
|
||||
echo "4. Check system resources in $OUTDIR/resources.txt"
|
||||
echo
|
||||
echo -e "${YELLOW}To transfer the archive:${NC}"
|
||||
echo "scp $(whoami)@$(hostname):$(pwd)/easy-appointments-debug.tar.gz /your/local/directory"
|
Loading…
Reference in New Issue