5.2 KiB
Chapter 6 — Safe Cleanup Runbook
- Purpose
Document the safe removal of Chapter 6 application resources after the assignment has been graded and cleanup has been authorized.
Cleanup must preserve all existing infrastructure established in Chapters 3, 4, and 5.
Do not execute these procedures before grading or without team authorization.
- Infrastructure That Must Be Preserved
The following resources must remain operational:
- Gitea and its repositories.
- Jenkins and its existing pipelines.
- Caddy and its existing HTTPS routes.
- Prometheus and its existing monitoring configuration.
- Grafana, dashboards, and persistent data.
- Node Exporter.
- Blackbox Exporter.
- Existing Docker volumes and networks.
- Previous assignment evidence and documentation.
Chapter 6 cleanup must never involve stopping the Docker daemon or deleting shared infrastructure.
- Resources Eligible for Cleanup
Only resources created specifically for Chapter 6 may be removed:
| Resource | Cleanup Condition |
|---|---|
pricing-staging Compose project |
After grading and authorization |
pricing-production Compose project |
After grading and authorization |
/opt/startup/pricing-staging |
After deployment records are preserved |
/opt/startup/pricing-production |
After deployment records are preserved |
| Chapter 6-specific Caddy routes | After application containers are removed |
| Chapter 6-specific monitoring targets | After monitoring evidence is preserved |
| Chapter 6-specific Jenkins credentials | After confirming they are not shared |
| Chapter 6-specific registry images | Only when retention is no longer required |
Do not assume a resource is exclusive to Chapter 6 without verifying ownership.
- Preconditions
Before cleanup:
-
Confirm that Chapter 6 grading is complete.
-
Obtain authorization from the team.
-
Preserve the final IT manual PDF.
-
Preserve Jenkins build logs and security scan reports.
-
Preserve release traceability records.
-
Preserve approval evidence.
-
Preserve staging and production verification screenshots.
-
Preserve rollback and failed-deployment evidence.
-
Record the current Docker containers, networks, and volumes.
-
Confirm which resources belong exclusively to Chapter 6.
-
Application Container Cleanup
Identify the actual Chapter 6 Compose project names and deployment directories.
Expected project names:
- pricing-staging
- pricing-production
Verify the running containers before proceeding.
Stop and remove only the containers associated with the selected Chapter 6 application projects.
Do not remove shared networks or volumes.
Never use:
docker compose down -v docker system prune -a docker volume prune
Do not use broad cleanup commands that could affect unrelated services.
- Deployment Directory Cleanup
After confirming that the application containers have been removed and evidence has been preserved, remove only the verified Chapter 6 deployment directories.
Expected directories:
/opt/startup/pricing-staging /opt/startup/pricing-production
Verify the exact paths before deletion.
Never recursively delete the parent /opt/startup directory.
- Reverse Proxy Cleanup
Remove only the Chapter 6 staging and production application routes from the existing Caddy configuration.
Preserve all existing Gitea, Jenkins, Grafana, and monitoring routes.
Validate the updated Caddy configuration before applying it.
After applying the change, verify that existing HTTPS services remain reachable.
- Monitoring Cleanup
Remove only the Chapter 6 production application probe from the existing monitoring configuration.
Preserve all previously configured monitoring targets.
Validate the Prometheus configuration before applying changes.
Confirm that existing dashboards and monitoring targets remain operational.
- Registry and Credentials
Before removing any registry images or Jenkins credentials:
- Confirm that they belong exclusively to Chapter 6.
- Confirm that they are not referenced by another deployment.
- Preserve required release records.
- Confirm that image retention is no longer necessary.
- Obtain authorization for deletion.
Never delete shared registry credentials or Jenkins credentials used by earlier chapters.
- Post-Cleanup Verification
After cleanup, confirm:
Component Expected Result Gitea Operational Jenkins Operational Caddy Existing HTTPS routes operational Prometheus Operational Grafana Existing dashboards available Node Exporter Metrics available Blackbox Exporter Existing probes operational Chapter 6 staging application Removed Chapter 6 production application Removed Shared Docker volumes Preserved Shared Docker networks Preserved
Record the verification results and cleanup timestamp.
- Evidence Requirements
Preserve:
- Cleanup authorization.
- Date and time of cleanup.
- Operator identity.
- List of removed resources.
- Relevant commands and outputs.
- Before-and-after container inventory.
- Verification that existing services remain operational.
- Any unexpected issues and their resolution.
Do not claim cleanup was successful without actual verification.
- Status
This cleanup runbook has been prepared for future use.
No Chapter 6 resources have been removed as part of preparing this document.
Actual cleanup must occur only after grading and explicit authorization.