feat:增加k8s部署

This commit is contained in:
zerosaturation 2026-07-06 13:27:24 +08:00
parent 58cada6f59
commit 440a7ad7d2
2 changed files with 38 additions and 2 deletions

18
.gitignore vendored
View File

@ -53,3 +53,21 @@ backend/services/statisticService/**/logs/*.log
.superpowers
# 编辑器临时文件(vim/IDE 备份)
*~
# ============================================================
# K8s / Helm (Phase 1 部署, 见 docs/superpowers/specs/2026-06-08-docker-to-k8s-migration-design.md)
# ============================================================
# Helm values 真值文件 (含 DB 密码 / API Key, 不进 git)
k8s/helm/**/values-prod.yaml
k8s/helm/**/values-*.real.yaml
# SOPS 加密后的真值文件可以提交 (加密的), 上面对应 .sops.yaml 也加进来按需解
# 当前未启用 SOPS, 先全不放
k8s/helm/**/values-secrets.sops.yaml
# helm 安装后生成的 real-secrets (运维临时导出, 不要入 git)
k8s/secrets-rendered/
k8s/manifests-rendered/
# operator / kind 本地集群产物 (Phase 1 验收用)
kubeconfig.local
.kube/

View File

@ -1,6 +1,13 @@
#!/bin/bash
# ===================================================================
# TopFans 打包上传部署脚本
# TopFans 打包上传部署脚本 (Docker / 单 VM 部署)
# ===================================================================
# ⚠️ 生产环境已迁移到 K8s (Phase 1, 见 docs/superpowers/specs/2026-06-08-docker-to-k8s-migration-design.md)
# ⚠️ 本脚本保留仅供:
# - 本地开发 (docker-compose.local.yml 起一套完整环境)
# - 旧 VM 上 101.132.250.62 的过渡期 (短期)
# ⚠️ 生产部署请改用: k8s/deploy.sh (helm install/upgrade/rollback)
# ===================================================================
# 功能:
# - 本地:构建镜像 → 推送到镜像仓库
# - 远程:拉取镜像 → 启动服务
@ -54,6 +61,17 @@
set -e
# ==================== Deprecation 提醒 ====================
# 任何 'deploy' / 'all' / 'rollback' 命令都建议改走 K8s, 但不强制 abort —
# 留过渡期, 灰度切换期间可能还要用本脚本部署新镜像到旧 VM。
warn_k8s_path() {
if [[ "${1:-}" =~ ^(deploy|rollback|all)$ ]]; then
echo -e "${YELLOW}⚠️ 提示: 生产部署已建议改走 K8s: ./k8s/deploy.sh${NC}" >&2
echo -e "${YELLOW} 本脚本仅作过渡, 走旧 VM docker-compose 路径${NC}" >&2
fi
}
warn_k8s_path "${1:-}" || true
# ==================== 颜色定义 ====================
RED='\033[0;31m'
GREEN='\033[0;32m'
@ -137,7 +155,7 @@ print_msg() {
# ==================== 帮助信息 ====================
show_help() {
cat << EOF
${MAGENTA}TopFans 部署脚本${NC}
${MAGENTA}TopFans 部署脚本 (Docker 单 VM, 见顶部 deprecation 提示)${NC}
${YELLOW}用法:${NC}
$0 <命令> [版本号] [选项]