Home / Emergency Rescue / Deploy Failed Mid-Way
Lesson 4 of 5

Deploy Failed Mid-Way

Concept

Your deploy script has built-in rollback. If the health check fails after deploy, it automatically restores app.bak. But if something breaks before that, you may need to manually intervene.
m3shdup/deploy-node.sh
# Automatic rollback (deploy script does this)
# If health check fails → restores app.bak → rebuilds

# Manual rollback
./deploy-node.sh --rollback

# Manual SSH rescue
ssh -p 64295 root@204.168.250.88
cd /opt/m3shd

# Check what's there
ls -la app.bak/    # old code backup
ls -la app/        # current (possibly broken) code

# Manual restore
rm -rf app && mv app.bak app
docker compose down && docker compose up -d --build

# Verify
docker logs --tail 20 m3shd-commander
curl localhost:8000/api/health

What's happening

The deploy script snapshots app/ to app.bak/ before syncing new code. If anything goes wrong, you can always restore the backup. The key recovery pattern: restore old code, rebuild container, check health.

Quick Check — 3 questions

1. What does ./deploy-node.sh --rollback do?

2. After restoring old code, what must you do next?

3. How do you verify the service is healthy after a fix?