mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-28 22:55:41 +00:00
Remove redundant S3 backup from deploy script (#5296)
Eagle server already persists to S3 on every game save via CompoundPersister when S3Credentials.isEnabled. The deploy script's s3cmd backup was redundant and caused warnings when s3cmd wasn't installed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -249,20 +249,6 @@ main() {
|
||||
log_warn "JIT will be cold on first requests"
|
||||
fi
|
||||
|
||||
# Backup games.e0es BEFORE stopping the active instance
|
||||
local backup_timestamp
|
||||
backup_timestamp=$(date +%Y%m%d_%H%M%S)
|
||||
log_info "Creating S3 backup of games.e0es (backup_${backup_timestamp})..."
|
||||
if command -v s3cmd &> /dev/null; then
|
||||
if s3cmd put "${SAVES_DIR}/games.e0es" "s3://eagle0/eagle/save/backups/games.e0es.${backup_timestamp}" 2>/dev/null; then
|
||||
log_info "Backup created: s3://eagle0/eagle/save/backups/games.e0es.${backup_timestamp}"
|
||||
else
|
||||
log_warn "S3 backup failed (s3cmd put), continuing deployment"
|
||||
fi
|
||||
else
|
||||
log_warn "s3cmd not found, skipping S3 backup"
|
||||
fi
|
||||
|
||||
# Step 4: Switch nginx to staging BEFORE stopping active
|
||||
# This achieves zero downtime - users immediately route to staging.
|
||||
# Any lazy-loads will wait for the flush marker (created in step 6).
|
||||
@@ -357,59 +343,6 @@ main() {
|
||||
log_info "========================================="
|
||||
}
|
||||
|
||||
# Ensure s3cmd is installed and configured for S3 backups
|
||||
ensure_s3cmd() {
|
||||
# Install s3cmd if not present
|
||||
if ! command -v s3cmd &> /dev/null; then
|
||||
log_info "Installing s3cmd for S3 backups..."
|
||||
if command -v pip3 &> /dev/null; then
|
||||
pip3 install --quiet s3cmd
|
||||
elif command -v pip &> /dev/null; then
|
||||
pip install --quiet s3cmd
|
||||
elif command -v apt-get &> /dev/null; then
|
||||
sudo apt-get update -qq && sudo apt-get install -y -qq s3cmd
|
||||
else
|
||||
log_warn "Cannot install s3cmd (no pip or apt-get), S3 backups will be skipped"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! command -v s3cmd &> /dev/null; then
|
||||
log_warn "s3cmd installation failed, S3 backups will be skipped"
|
||||
return 1
|
||||
fi
|
||||
log_info "s3cmd installed successfully"
|
||||
fi
|
||||
|
||||
# Configure s3cmd for DigitalOcean Spaces if not already configured
|
||||
local s3cfg="${HOME}/.s3cfg"
|
||||
if [ ! -f "${s3cfg}" ]; then
|
||||
# Load credentials from .env
|
||||
local env_file="${APP_DIR}/.env"
|
||||
if [ -f "${env_file}" ]; then
|
||||
# shellcheck source=/dev/null
|
||||
source "${env_file}"
|
||||
fi
|
||||
|
||||
if [ -z "${DO_SPACES_ACCESS_KEY:-}" ] || [ -z "${DO_SPACES_SECRET_KEY:-}" ]; then
|
||||
log_warn "DO_SPACES_ACCESS_KEY or DO_SPACES_SECRET_KEY not set, S3 backups will be skipped"
|
||||
return 1
|
||||
fi
|
||||
|
||||
log_info "Configuring s3cmd for DigitalOcean Spaces..."
|
||||
cat > "${s3cfg}" << EOF
|
||||
[default]
|
||||
access_key = ${DO_SPACES_ACCESS_KEY}
|
||||
secret_key = ${DO_SPACES_SECRET_KEY}
|
||||
host_base = sfo3.digitaloceanspaces.com
|
||||
host_bucket = %(bucket)s.sfo3.digitaloceanspaces.com
|
||||
use_https = True
|
||||
EOF
|
||||
log_info "s3cmd configured successfully"
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# Check for required tools
|
||||
check_requirements() {
|
||||
if ! command -v docker &> /dev/null; then
|
||||
@@ -438,9 +371,6 @@ check_requirements() {
|
||||
mkdir -p "${SAVES_DIR}"
|
||||
fi
|
||||
|
||||
# Ensure s3cmd is available for backups (non-fatal if it fails)
|
||||
ensure_s3cmd || true
|
||||
|
||||
# Clean up any stale deployment-in-progress marker from a previous failed deploy
|
||||
if [ -f "${DEPLOYMENT_IN_PROGRESS}" ]; then
|
||||
log_warn "Found stale deployment-in-progress marker, removing it"
|
||||
|
||||
Reference in New Issue
Block a user