deploy(M00-E): 补充备份恢复检查模板
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"version": "0.1.4-m00-backup-check",
|
||||
"retention": {
|
||||
"daily": 7,
|
||||
"weekly": 4,
|
||||
"monthly": 3
|
||||
},
|
||||
"targets": {
|
||||
"mysql": {
|
||||
"enabled": false,
|
||||
"database": "qipai",
|
||||
"output": "/opt/apps/backups/mysql",
|
||||
"command": "mysqldump --single-transaction --routines --triggers --events qipai"
|
||||
},
|
||||
"emqx": {
|
||||
"enabled": false,
|
||||
"output": "/opt/apps/backups/emqx",
|
||||
"command": "emqx ctl data export"
|
||||
},
|
||||
"uploads": {
|
||||
"enabled": false,
|
||||
"source": "/opt/apps/uploads",
|
||||
"output": "/opt/apps/backups/files"
|
||||
}
|
||||
},
|
||||
"notes": [
|
||||
"This template contains no real passwords or production paths outside /opt/apps.",
|
||||
"Enable targets only on production Ubuntu after credentials and retention policy are confirmed."
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
# Backup And Restore Runbook
|
||||
|
||||
M00 provides checks and templates only. Production backups must be enabled by the Ubuntu administrator after database credentials, upload paths and EMQX configuration are confirmed.
|
||||
|
||||
## Backup Targets
|
||||
|
||||
- MySQL logical dump: `/opt/apps/backups/mysql`
|
||||
- EMQX data export: `/opt/apps/backups/emqx`
|
||||
- Uploaded files archive: `/opt/apps/backups/files`
|
||||
- Manual manifests: `/opt/apps/backups/manual`
|
||||
|
||||
## Backup Check
|
||||
|
||||
```bash
|
||||
/opt/apps/setup.sh --backup-status
|
||||
```
|
||||
|
||||
## Manual Commands
|
||||
|
||||
The commands below are examples for the production administrator. Do not store real credentials in Git.
|
||||
|
||||
```bash
|
||||
mysqldump --single-transaction --routines --triggers --events qipai > /opt/apps/backups/mysql/qipai-YYYYmmddHHMMSS.sql
|
||||
emqx ctl data export
|
||||
tar -C /opt/apps -czf /opt/apps/backups/files/uploads-YYYYmmddHHMMSS.tgz uploads
|
||||
```
|
||||
|
||||
## Restore Outline
|
||||
|
||||
1. Stop the backend process through PM2 after confirming a maintenance window.
|
||||
2. Verify the selected backup files and hashes.
|
||||
3. Restore MySQL into a staging database before production.
|
||||
4. Restore EMQX export and restart EMQX.
|
||||
5. Restore uploads into `/opt/apps/uploads`.
|
||||
6. Run API, admin, miniapp and MQTT smoke checks.
|
||||
|
||||
Automatic production restore is intentionally disabled in M00.
|
||||
Reference in New Issue
Block a user