| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- #!/bin/bash
- # CelestiaTrace Backend Deployment Script
- # Usage: ./deploy.sh
- set -e
- SERVER_IP="47.93.193.127"
- PEM_KEY="../ccdw-meishi-1.pem"
- REMOTE_DIR="/opt/celestia-trace"
- SSH_USER="root"
- echo "🚀 Deploying CelestiaTrace Backend..."
- # Ensure PEM key has correct permissions
- chmod 400 "$PEM_KEY"
- # Create remote directory
- ssh -i "$PEM_KEY" -o StrictHostKeyChecking=no "$SSH_USER@$SERVER_IP" "mkdir -p $REMOTE_DIR"
- # Sync backend files to server
- rsync -avz --exclude '.git' --exclude 'vendor' \
- -e "ssh -i $PEM_KEY -o StrictHostKeyChecking=no" \
- ./ "$SSH_USER@$SERVER_IP:$REMOTE_DIR/"
- # SSH into server and deploy with Docker Compose
- ssh -i "$PEM_KEY" -o StrictHostKeyChecking=no "$SSH_USER@$SERVER_IP" << 'REMOTE_CMDS'
- cd /opt/celestia-trace
- # Copy .env from example if not exists
- if [ ! -f .env ]; then
- cp .env.example .env
- echo "⚠️ Created .env from template. Please edit /opt/celestia-trace/.env with secure values!"
- fi
- # Pull latest images and rebuild
- docker compose down
- docker compose up -d --build
- # Show status
- echo ""
- echo "✅ Deployment complete!"
- echo "Services status:"
- docker compose ps
- REMOTE_CMDS
- echo ""
- echo "🎉 Done! Your backend is live at https://celestia-trace.ccdw.life"
|