From 2b1c68b2d5aa003fa9fe1c0e27561b0deb7166e6 Mon Sep 17 00:00:00 2001 From: GengY Date: Tue, 5 Mar 2024 10:22:33 +0800 Subject: [PATCH] modify(dbs-postgres): modify posrgres stack --- dev-dbs/postgres/env.cfg | 4 +++- dev-dbs/postgres/prod.stack.yml | 20 ++++++++++++++++++++ dev-dbs/postgres/stack.yml | 20 -------------------- dev-dbs/postgres/test.stack.yml | 23 +++++++++++++++++++++++ 4 files changed, 46 insertions(+), 21 deletions(-) create mode 100644 dev-dbs/postgres/prod.stack.yml delete mode 100644 dev-dbs/postgres/stack.yml create mode 100644 dev-dbs/postgres/test.stack.yml diff --git a/dev-dbs/postgres/env.cfg b/dev-dbs/postgres/env.cfg index d9eb097..6abdd59 100644 --- a/dev-dbs/postgres/env.cfg +++ b/dev-dbs/postgres/env.cfg @@ -1,3 +1,5 @@ #IMAGE_TAG=postgres:14.11-bookworm #IMAGE_TAG=postgres:15.6-bookworm -IMAGE_TAG=postgres:16.2-bookworm \ No newline at end of file +IMAGE_TAG=postgres:16.2-bookworm +POSTGRES_PASSWORD=Kevin0412PgSql +POSTGRES_HOST_AUTH_METHOD=scram-sha-256 \ No newline at end of file diff --git a/dev-dbs/postgres/prod.stack.yml b/dev-dbs/postgres/prod.stack.yml new file mode 100644 index 0000000..389733c --- /dev/null +++ b/dev-dbs/postgres/prod.stack.yml @@ -0,0 +1,20 @@ +#mkdir -pv /data/volumes/postgres/data +#pull:: docker compose --env-file ./dev-dbs/postgres/env.cfg -f ./dev-dbs/postgres/prod.stack.yml pull +#run:: docker compose -p prod-dbs --env-file ./dev-dbs/postgres/env.cfg -f ./dev-dbs/postgres/prod.stack.yml up -d +services: + + postgres: + image: ${IMAGE_TAG} + container_name: prod-postgre + restart: always + environment: + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} + - POSTGRES_HOST_AUTH_METHOD=${POSTGRES_HOST_AUTH_METHOD} + - POSTGRES_INITDB_ARGS=--auth-host==${POSTGRES_HOST_AUTH_METHOD} + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + - TZ=Asia/Shanghai + volumes: + - /data/volumes/postgres/data:/var/lib/postgresql/data + ports: + - "5432:5432" \ No newline at end of file diff --git a/dev-dbs/postgres/stack.yml b/dev-dbs/postgres/stack.yml deleted file mode 100644 index b0d63b3..0000000 --- a/dev-dbs/postgres/stack.yml +++ /dev/null @@ -1,20 +0,0 @@ -#pull:: docker compose --env-file ./dev-dbs/postgres/env.cfg -f ./dev-dbs/postgres/stack.yml pull -#run:: docker compose -p dev-dbs --env-file ./dev-dbs/postgres/env.cfg -f ./dev-dbs/postgres/stack.yml up -d -services: - - postgres: - image: ${IMAGE_TAG} - container_name: Dev-postgre - restart: always - environment: - - POSTGRES_PASSWORD=Kevin0412PgSql - - POSTGRES_HOST_AUTH_METHOD=scram-sha-256 - - POSTGRES_INITDB_ARGS=--auth-host=scram-sha-256 - - TZ=Asia/Shanghai - volumes: - - postgresql_data:/var/lib/postgresql/data - ports: - - "5432:5432" - -volumes: - postgresql_data: \ No newline at end of file diff --git a/dev-dbs/postgres/test.stack.yml b/dev-dbs/postgres/test.stack.yml new file mode 100644 index 0000000..a481bc1 --- /dev/null +++ b/dev-dbs/postgres/test.stack.yml @@ -0,0 +1,23 @@ +#pull:: docker compose --env-file ./dev-dbs/postgres/env.cfg -f ./dev-dbs/postgres/test.stack.yml pull +#run:: docker compose -p test-dbs --env-file ./dev-dbs/postgres/env.cfg -f ./dev-dbs/postgres/test.stack.yml up -d + +services: + + postgres: + image: ${IMAGE_TAG} + container_name: prod-postgre + restart: always + environment: + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} + - POSTGRES_HOST_AUTH_METHOD=${POSTGRES_HOST_AUTH_METHOD} + - POSTGRES_INITDB_ARGS=--auth-host==${POSTGRES_HOST_AUTH_METHOD} + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + - TZ=Asia/Shanghai + volumes: + - data:/var/lib/postgresql/data + ports: + - "5432:5432" + +volumes: + data: \ No newline at end of file