Files
arcticnewone/deploy/postgres.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

88 lines
2.4 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# =========================================================
# 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