学生资料设置、头像与自动备份恢复。
首页卡片支持修改/删除;详情页设置 Tab 可维护学校、年级与头像;系统设置新增数据备份下载与恢复;备份默认存 /root/grade-archive-backups,详见 docs/BACKUP.md。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+17
-1
@@ -149,6 +149,9 @@ POSTGRES_PASSWORD=${pg_pass}
|
||||
POSTGRES_DB=student_archive
|
||||
DATABASE_URL=postgresql://${pg_user}:${pg_pass}@127.0.0.1:5432/student_archive
|
||||
UPLOAD_DIR=${INSTALL_DIR}/uploads
|
||||
BACKUP_DIR=/root/grade-archive-backups
|
||||
BACKUP_RETENTION_DAYS=30
|
||||
AUTO_BACKUP_INTERVAL_HOURS=24
|
||||
CORS_ORIGINS=http://${server_ip}:${WEB_PORT},http://127.0.0.1:${WEB_PORT},http://localhost:${WEB_PORT}
|
||||
# OCR 同机 GPU Worker(screen 常驻)
|
||||
OCR_SERVICE_URL=http://127.0.0.1:${OCR_PORT}
|
||||
@@ -237,10 +240,21 @@ setup_systemd() {
|
||||
start_service() {
|
||||
log_info "启动主程序…"
|
||||
cd "${INSTALL_DIR}"
|
||||
mkdir -p uploads backups
|
||||
mkdir -p uploads backups /root/grade-archive-backups
|
||||
chmod +x deploy/backup.sh deploy/restore.sh 2>/dev/null || true
|
||||
systemctl restart grade-archive
|
||||
}
|
||||
|
||||
setup_backup_cron() {
|
||||
log_info "配置每日自动备份(/root/grade-archive-backups)…"
|
||||
cat > /etc/cron.d/grade-archive-backup <<EOF
|
||||
SHELL=/bin/bash
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||
0 3 * * * root INSTALL_DIR=${INSTALL_DIR} BACKUP_DIR=/root/grade-archive-backups bash ${INSTALL_DIR}/deploy/backup.sh >> /var/log/grade-archive-backup.log 2>&1
|
||||
EOF
|
||||
chmod 644 /etc/cron.d/grade-archive-backup
|
||||
}
|
||||
|
||||
wait_healthy() {
|
||||
local i
|
||||
log_info "等待主程序就绪(最多 2 分钟)…"
|
||||
@@ -285,6 +299,7 @@ print_summary() {
|
||||
echo ""
|
||||
echo " 主程序: systemctl status grade-archive"
|
||||
echo " 更新: sudo bash ${INSTALL_DIR}/deploy/update.sh"
|
||||
echo " 备份说明: docs/BACKUP.md"
|
||||
echo " 卸载: sudo bash ${INSTALL_DIR}/deploy/uninstall.sh"
|
||||
echo " 微信 dekun03 手机 18364911125"
|
||||
echo "=========================================="
|
||||
@@ -305,6 +320,7 @@ main() {
|
||||
setup_ocr_gpu
|
||||
stop_legacy_pm2
|
||||
setup_systemd
|
||||
setup_backup_cron
|
||||
start_service
|
||||
wait_healthy
|
||||
print_summary
|
||||
|
||||
Reference in New Issue
Block a user