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 文档更新
This commit is contained in:
2026-08-06 06:49:14 +08:00
parent 6192ae0a38
commit 4bef241544
29 changed files with 1320 additions and 354 deletions
+87
View File
@@ -0,0 +1,87 @@
# =========================================================
# Arcticnewone 可选生产数据库 - PostgreSQL StatefulSet
#
# 说明:
# - 仅当生产环境没有可用的 PostgreSQL(如华为云 RDS)时才使用本文件
# - 建议优先使用云托管数据库(RDS),自带备份/高可用,运维成本更低
# - 数据保存在 PVC(8Gi 本地存储类),如需扩容请先调整 storage
# - 部署后创建 Secret 提供连接信息(见 deploy/README.md)
# =========================================================
apiVersion: v1
kind: Service
metadata:
name: arcticnewone-postgres
namespace: arcticnewone
labels:
app: arcticnewone-postgres
spec:
clusterIP: None
ports:
- name: postgres
port: 5432
targetPort: 5432
selector:
app: arcticnewone-postgres
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: arcticnewone-postgres
namespace: arcticnewone
labels:
app: arcticnewone-postgres
spec:
serviceName: arcticnewone-postgres
replicas: 1
selector:
matchLabels:
app: arcticnewone-postgres
template:
metadata:
labels:
app: arcticnewone-postgres
spec:
containers:
- name: postgres
image: docker.m.daocloud.io/library/postgres:16-alpine
ports:
- name: postgres
containerPort: 5432
env:
- name: POSTGRES_DB
value: "arcticnewone"
- name: POSTGRES_USER
value: "arcticnewone"
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: arcticnewone-secrets
key: postgres-password
volumeMounts:
- name: data
mountPath: /var/lib/postgresql/data
resources:
requests:
cpu: 100m
memory: 256Mi
limits:
cpu: 500m
memory: 1Gi
readinessProbe:
exec:
command: ["pg_isready", "-U", "arcticnewone", "-d", "arcticnewone"]
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
exec:
command: ["pg_isready", "-U", "arcticnewone", "-d", "arcticnewone"]
initialDelaySeconds: 15
periodSeconds: 20
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 8Gi