From 71946f38c494dd8e86350388be6892b8a30a28ee Mon Sep 17 00:00:00 2001 From: cnphpbb Date: Sun, 20 Sep 2026 22:58:45 +0800 Subject: [PATCH] =?UTF-8?q?fix(postgres):=20=E6=98=BE=E5=BC=8F=E6=8C=87?= =?UTF-8?q?=E5=AE=9A=20Volumes=5FPath=20=E5=92=8C=20initdb=20=E7=BC=96?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - env.cfg.example 新增 Volumes_Path=/data/volumes/postgres - prod.stack.yml 卷路径改用 ${Volumes_Path} 变量 - pgvector.stack.yml 补充部署命令注释并设置默认认证方式 - redis env.cfg.example 补充数据目录创建说明 --- dbSer/postgres/env.cfg.example | 3 +++ dbSer/postgres/pgvector.stack.yml | 10 ++++++++-- dbSer/postgres/prod.stack.yml | 2 +- dbSer/redis/env.cfg.example | 2 ++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/dbSer/postgres/env.cfg.example b/dbSer/postgres/env.cfg.example index 4d1a8a0..a2cc69d 100644 --- a/dbSer/postgres/env.cfg.example +++ b/dbSer/postgres/env.cfg.example @@ -23,6 +23,9 @@ IMAGE_TAG_V18=postgres:18.6 IMAGE_TAG_PGVECTOR_PG18=pgvector/pgvector:pg18-trixie POSTGRES_USER=postgres + POSTGRES_PASSWORD= POSTGRES_HOST_AUTH_METHOD=scram-sha-256 + +Volumes_Path=/data/volumes/postgres diff --git a/dbSer/postgres/pgvector.stack.yml b/dbSer/postgres/pgvector.stack.yml index 90841ef..f996b32 100644 --- a/dbSer/postgres/pgvector.stack.yml +++ b/dbSer/postgres/pgvector.stack.yml @@ -1,4 +1,10 @@ +# mkdir -pv /data/volumes/postgres/pgdata +# pull:: docker compose --env-file ./dbSer/postgres/env.cfg -f ./dbSer/postgres/prod.stack.yml pull +#run:: docker compose -p prod-dbs --env-file ./dbSer/postgres/env.cfg -f ./dbSer/postgres/prod.stack.yml up -d + + services: + pgvector: image: ${IMAGE_TAG_PGVECTOR_PG18} container_name: dbs_pgvector @@ -8,8 +14,8 @@ services: - "5432:5432" environment: - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} - - POSTGRES_HOST_AUTH_METHOD=${POSTGRES_HOST_AUTH_METHOD} - - POSTGRES_INITDB_ARGS=--auth-host=${POSTGRES_HOST_AUTH_METHOD} + - POSTGRES_HOST_AUTH_METHOD=${POSTGRES_HOST_AUTH_METHOD:-scram-sha-256} + - POSTGRES_INITDB_ARGS=--encoding=UTF8 --locale=C --auth-host=${POSTGRES_HOST_AUTH_METHOD:-scram-sha-256} - PGDATA=/var/lib/postgresql/data/pgdata volumes: - ${Volumes_Path}/pgdata:/var/lib/postgresql/data diff --git a/dbSer/postgres/prod.stack.yml b/dbSer/postgres/prod.stack.yml index a762f52..8d2a52c 100644 --- a/dbSer/postgres/prod.stack.yml +++ b/dbSer/postgres/prod.stack.yml @@ -16,7 +16,7 @@ services: volumes: # >=17 版本,数据目录为 /var/lib/postgresql # <=16 版本,数据目录为 /var/lib/postgresql/data - - /data/volumes/postgres/data:/var/lib/postgresql + - ${Volumes_Path}/data:/var/lib/postgresql # 时区配置 - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro diff --git a/dbSer/redis/env.cfg.example b/dbSer/redis/env.cfg.example index 0dff399..ad2f934 100644 --- a/dbSer/redis/env.cfg.example +++ b/dbSer/redis/env.cfg.example @@ -4,6 +4,8 @@ # ============================================================ # # 使用方式: +# mkdir -pv /data/volumes/redis/redis_data # redis.stack.yml (redis 子目录) +# mkdir -pv /data/volumes/redis/valkey_data # valkey.stack.yml (valkey 子目录) # cp env.cfg.example env.cfg # $EDITOR env.cfg # 填入真实密码/密钥后保存 # docker compose -p redis --env-file ./env.cfg -f ./stack.yml up -d