From 6392512428b65a442fd030ce8d25602cd7d3b27c Mon Sep 17 00:00:00 2001 From: zly <644706215@qq.com> Date: Thu, 18 Dec 2025 16:39:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9postgres=E5=AE=B9=E5=99=A8?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 12 ++++++++++++ web/ws/docker-compose.yml | 6 ++++-- 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 0000000..f3a4ce2 --- /dev/null +++ b/.env @@ -0,0 +1,12 @@ +POSTGRES_USER=ABM_DB_user +POSTGRES_PASSWORD=4FynWQfy0AEotP1dgyimrGF7PSDJh1nDYnDwg4hN +POSTGRES_DB=ABM_DB + +PGHOST=postgres +PGPORT=5432 +PGUSER=ABM_DB_user +PGPASSWORD=4FynWQfy0AEotP1dgyimrGF7PSDJh1nDYnDwg4hN +PGDATABASE=ABM_DB + +# 如果你要用 DATABASE_URL,也要 $$: +# DATABASE_URL=postgresql+asyncpg://ABM_DB_user:4FynWQfy0AEotP1dgyimrGF7PSDJh1nDYnDwg4hN@postgres:5432/ABM_DB diff --git a/web/ws/docker-compose.yml b/web/ws/docker-compose.yml index 8cc01ad..42b6eb9 100644 --- a/web/ws/docker-compose.yml +++ b/web/ws/docker-compose.yml @@ -45,8 +45,10 @@ services: - ./postgres_data:/var/lib/postgresql/data networks: - frontend + ports: + - 5433:5432 healthcheck: - test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"] + test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d postgres"] interval: 10s timeout: 5s retries: 5 @@ -57,4 +59,4 @@ volumes: networks: frontend: - external: true \ No newline at end of file + external: true