The user wants a plan for a "site move rehearsal," which sounds like a dry run or practice session for migrating a website (likely from one host to another, or from staging to production, or re-platforming).
The key components requested are:
- Staging cutover drill: Simulating the actual switch from old to new.
- Redirect shadow traffic: Testing redirection rules without affecting real users (using "shadow" or test traffic).
- Cache warming: Pre-populating the cache to ensure performance is good immediately upon launch.
- Monitoring guardrails: Setting up alerts and thresholds to detect issues quickly.
- Rollback: Planning how to revert if things go wrong.
Structure of the Response:
I should structure this as a comprehensive operational runbook or a step-by-step rehearsal plan. It needs to be actionable, technical, and clear.
- Introduction: Define the scope and objectives of the rehearsal.
- Phase 1: Pre-Rehearsal Setup: What needs to be in place before the drill starts? (DNS, Configs, Shadow Env).
- Phase 2: Staging Cutover Drill (The Simulation): Executing the switch in a controlled environment.
- Phase 3: Redirect & Shadow Traffic: Testing the routing logic.
- Phase 4: Cache Warming: Stress testing and pre-loading.
- Phase 5: Monitoring Guardrails: Verification and alerting checks.
- Phase 6: Rollback Drill: Practicing the "Oh no!" moment.
- Post-Mortem/Report: What did we learn?
Drafting Content - Specific Details:
- Staging Cutover: This implies we are testing the process of cutting over. Are we lowering TTLs? Are we swapping load balancers?
- Redirect Shadow Traffic: How do we do this? Hosts file modifications, internal DNS overrides, or mirroring traffic to the new stack. I should suggest a "Dark Launch" or internal testing approach.
- Cache Warming: Tools like
wget, squid, or custom scripts. Need to hit the sitemap.xml.
- Monitoring: Synthetic monitoring (Pingdom, Datadog) vs Real User Monitoring (RUM). Error rates, Latency (p95/p99).
- Rollback: DNS flip back, code revert, database restore (if applicable).
Refining the Tone:
The tone should be professional, operational, and structured like a checklist or runbook. Use headings, bullet points, and bold text for emphasis.
Step-by-Step Expansion:
-
Objective: Zero data loss, minimal downtime, performance validation.
-
Prerequisites: The new environment is up. The team is assembled (war room).
-
Section 1: The Cutover Drill:
- Simulate the DNS update (don't actually do it publicly).
- Verify "Maintenance Mode" toggles.
-
Section 2: Redirect Shadow Traffic:
- Use a canary release or a specific header/route to send internal traffic to the new site.
- Check HTTP status codes (301 vs 302).
-
Section 3: Cache Warming:
- Crawl the top 1000 pages.
- Measure Time To First Byte (TTFB) before and after.
-
Section 4: Monitoring Guardrails:
- Define "Stop the line" metrics (e.g., 5xx rate > 1%).
- Check dashboard visibility.
-
Section 5: The Rollback:
- Time how long it takes to revert.
- Verify the "old" site is still accessible.
Self-Correction/Review during drafting:
- Initial thought: Just list the steps.
- Correction: The prompt asks for a rehearsal. This implies simulating the event, not just doing the event. I need to frame it as "Simulate X" or "Test Y" rather than "Execute X".
Final Polish:
Add a "Go/No-Go" decision point. Add a "Communication Plan" (who talks to stakeholders).
Let's organize this into a Technical Runbook format.
- Phase 0: Readiness.
- Phase 1: The Drill (Cutover).
- Phase 2: Shadow Traffic & Redirects.
- Phase 3: Cache Warming.
- Phase 4: Guardrails & Monitoring.
- Phase 5: The Panic Button (Rollback).
(Proceed to generate the detailed response based on this structure.)
This is a comprehensive operational runbook for a Site Move Rehearsal. The goal of this drill is to simulate the production migration in a controlled environment to identify failure points, measure timing, and validate the rollback strategy before the actual event.
0. Pre-Requisites & Setup
- Team: Incident Commander, DBA, Infra Lead, Dev Lead, Communications Lead.
- Environment: Staging (or a "Pre-Prod" environment) that mirrors Production specs as closely as possible.
- Tools: Load testing tool (e.g., k6, Locust), Traffic Replayer (e.g., Gorush, Diffy, or Nginx mirror), Monitoring Dashboard (Grafana/Datadog).
Phase 1: Staging Cutover Drill (The "Mock" Migration)
Objective: Validate the deployment scripts, DNS switching mechanism, and database migration steps without user impact.
Duration: 60 Minutes
| Step | Action | Expected Outcome | Pass/Fail |
|---|
| 1.1 | Code Freeze & Backup: Freeze the Staging branch. Take a snapshot of the Staging DB. | Snapshot ID recorded. | |
| 1.2 | Maintenance Mode: Enable "Maintenance Mode" on the legacy Staging environment to stop new writes. | Users see 503 Service Unavailable. | |
| 1.3 | Data Sync: Run the final data migration/sync script. | Script exits with 0 errors. Data integrity check passes. | |
| 1.4 | Cutover Execution: Execute the switch. This could be flipping a Load Balancer target or updating a DNS record (simulate via /etc/hosts or internal DNS). | Traffic stops hitting Legacy and starts hitting New Stack. | |
| 1.5 | Smoke Test: Run a suite of critical path tests (Login, Search, Checkout). | All critical paths return HTTP 200. | |
| 1.6 | DNS Propagation: Verify internal DNS caches have flushed and point to the new IP/CNAME. | dig or nslookup confirms new IP. | |
Phase 2: Redirect Shadow Traffic
Objective: Test the redirection logic and the new stack's ability to handle routing rules before real users hit it.
Duration: 30 Minutes
- Configure Nginx/LB Mirror:
- Enable
mirror directive (Nginx) or Traffic Mirroring (AWS LB).
- Configuration: Mirror 10% of live Production traffic (sanitized of PII if necessary) to the New Staging Stack.
- Validate Redirects:
- Ensure the New Stack handles the
Host header of the production traffic correctly or re-writes it.
- Check that old URL structures (e.g.,
site.com/old-category/item) trigger the correct 301/308 redirects to the new structure.
- Log Verification:
- Inspect New Stack access logs. Do you see the shadow requests?
- Check for 404s or 500s specifically caused by the redirect logic.
Phase 3: Cache Warming
Objective: Populate the new stack's cache (Redis/CDN) to prevent a "Thundering Herd" scenario immediately upon launch.
Duration: 20 Minutes
- Sitemap Crawl:
- Execute a script to curl the top 10,000 URLs from the sitemap (prioritizing Home, Category, and Top Product pages).
- Command:
wget --spider -i top-urls.txt (or a custom script).
- Database Buffer:
- Run a read-heavy script to pull popular data into the DB memory/swap.
- CDN Pre-fetch:
- If using a CDN (Cloudflare, Fastly), trigger a "Prefetch" or "Cache Fill" command via API for critical assets.
- Metric Check:
- Verify that the Cache Hit Rate on the new stack is > 90% for the warmed content before proceeding.
Phase 4: Monitoring Guardrails
Objective: Define the "Stop the Line" criteria. If these thresholds are breached during the real migration, we initiate Rollback immediately.
Configuration:
- Latency (p95): Must remain < 500ms.
- Error Rate (5xx): Must remain < 0.5%.
- DB Connections: Must stay < 70% of pool limit.
- SSL Certificates: Validity check (No expiry, correct domain).
Drill Action:
- Synthetic Load: Increase load on the Staging environment to 200% of expected peak traffic.
- Alert Tuning: Verify that the monitoring tools (PagerDuty/OpsGenie) actually fire alerts when thresholds are crossed.
- Test: Kill a backend container. Did the alert fire within 60 seconds?
- Test: Inject 500ms latency. Did the latency alert fire?
Phase 5: The Rollback (The Most Important Part)
Objective: Prove we can return to the legacy system quickly without data loss.
Duration: 15 Minutes (Target)
Procedure:
- Stop Writes: Halt all incoming traffic to the New Stack.
- Data Divergence Check:
- Scenario: Users placed orders on the NEW system during the test.
- Action: Identify records created in the
new_db during the test window. Script a migration of only those records back to legacy_db.
- Switch Back: Flip the Load Balancer/DNS back to Legacy.
- Verification: Access the Legacy site. Confirm the "Test Order" created on the New site now appears on the Legacy site.
- Timing: Record the total time from "Rollback Command" to "Legacy Site Live."
Rehearsal Report Template
Date: YYYY-MM-DD
Facilitator: [Name]
Timing Analysis
- Planned Cutover Duration: 15m
- Actual Cutover Duration: 23m
- Discrepancy Reason: DB migration script hung on row 400k.
Anomalies Found
- Redirect Loop: The
/blog path redirected to /blog/index which redirected back to /blog.
- Cache Miss: Images were not caching because the S3 bucket permissions were private.
- Rollback Data Loss: The rollback script failed to port User Profile updates back to the legacy DB.
Go/No-Go Decision