Files
arcticnewone/deploy/deployment.yaml
T
virtheart 4bef241544 feat: 新增 Nitro Server API 与 PostgreSQL 后端,接入用户系统/联系表单/资讯订阅
- server/api: 注册/登录/登出/会话恢复(JWT + httpOnly Cookie, bcrypt 密码哈希)
- server/api: 联系表单与资讯订阅入库,支持 SMTP 邮件通知(可选)
- 应用启动自动建表(幂等),docker-compose 新增 PostgreSQL 16 服务
- 前端移除全部 mock:user store、登录注册弹窗、联系表单、页脚订阅接入真实接口
- i18n 补充服务端错误码中英文案,移除 demoHint
- deploy: Deployment 环境变量(Secret 引用)、可选集群内 PostgreSQL(postgres.yaml)
- 新增 .env.example 与 README/deploy 文档更新
2026-08-06 06:49:14 +08:00

121 lines
3.7 KiB
YAML

# =========================================================
# Arcticnewone 生产部署 - Deployment
#
# 镜像: 华为云 SWR swr.cn-north-4.myhuaweicloud.com/virtheart/arcticnewone:latest
# 副本数: 1(团队规范)
#
# 私有镜像拉取说明:
# 集群中需预先创建 docker-registry 类型的 Secret(凭据从环境变量读取,不写入仓库):
# kubectl create secret docker-registry huawei-swr-secret \
# --docker-server="$SWR_REGISTRY" \
# --docker-username="$SWR_USERNAME" \
# --docker-password="$SWR_PASSWORD" \
# --dry-run=client -o yaml | kubectl apply -f -
# 详见 deploy/README.md
# =========================================================
apiVersion: apps/v1
kind: Deployment
metadata:
name: arcticnewone
namespace: arcticnewone
labels:
app: arcticnewone
spec:
replicas: 1
selector:
matchLabels:
app: arcticnewone
template:
metadata:
labels:
app: arcticnewone
spec:
imagePullSecrets:
- name: huawei-swr-secret
containers:
- name: arcticnewone
image: swr.cn-north-4.myhuaweicloud.com/virtheart/arcticnewone:latest
imagePullPolicy: Always
ports:
- name: http
containerPort: 3000
env:
- name: NODE_ENV
value: "production"
- name: HOST
value: "0.0.0.0"
- name: PORT
value: "3000"
# 数据库连接(必填)
- name: NUXT_DATABASE_URL
valueFrom:
secretKeyRef:
name: arcticnewone-secrets
key: database-url
# JWT 签名密钥(必填)
- name: NUXT_JWT_SECRET
valueFrom:
secretKeyRef:
name: arcticnewone-secrets
key: jwt-secret
# SMTP 邮件通知(可选;不配置时表单/订阅仅入库)
- name: NUXT_SMTP_HOST
valueFrom:
secretKeyRef:
name: arcticnewone-secrets
key: smtp-host
optional: true
- name: NUXT_SMTP_PORT
valueFrom:
secretKeyRef:
name: arcticnewone-secrets
key: smtp-port
optional: true
- name: NUXT_SMTP_USER
valueFrom:
secretKeyRef:
name: arcticnewone-secrets
key: smtp-user
optional: true
- name: NUXT_SMTP_PASS
valueFrom:
secretKeyRef:
name: arcticnewone-secrets
key: smtp-pass
optional: true
- name: NUXT_SMTP_FROM
valueFrom:
secretKeyRef:
name: arcticnewone-secrets
key: smtp-from
optional: true
- name: NUXT_SMTP_CONTACT_TO
valueFrom:
secretKeyRef:
name: arcticnewone-secrets
key: smtp-contact-to
optional: true
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
readinessProbe:
httpGet:
path: /
port: 3000
initialDelaySeconds: 5
periodSeconds: 10
timeoutSeconds: 3
failureThreshold: 3
livenessProbe:
httpGet:
path: /
port: 3000
initialDelaySeconds: 15
periodSeconds: 20
timeoutSeconds: 3
failureThreshold: 3