File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88# BACKEND_PORT=127.0.0.1:5000
99# DB_PORT=127.0.0.1:5432
1010
11+ # PostgreSQL image/data overrides.
12+ # Default compose now uses postgres:18.3-alpine with PGDATA=/var/lib/postgresql/18/docker.
13+ # To reuse an existing 1Panel PostgreSQL 18 data directory, stop the old DB first,
14+ # then point POSTGRES_DATA_SOURCE to the host directory that contains PG_VERSION.
15+ # Example for 1Panel PostgreSQL with:
16+ # host mount: /opt/1panel/apps/postgresql/postgresql/data -> /var/lib/postgresql
17+ # PGDATA: /var/lib/postgresql/18/docker
18+ # use:
19+ # POSTGRES_IMAGE=postgres:18.3-alpine
20+ # POSTGRES_DATA_SOURCE=/opt/1panel/apps/postgresql/postgresql/data/18/docker
21+ # POSTGRES_PGDATA=/var/lib/postgresql/18/docker
22+ # POSTGRES_USER=user_from_old_container
23+ # POSTGRES_PASSWORD=password_from_old_container
24+ # POSTGRES_DB=quantdinger
25+
1126# Global image source switch
1227# Leave empty for official Docker Hub:
1328# IMAGE_PREFIX=
Original file line number Diff line number Diff line change 3838
3939services :
4040 postgres :
41- image : ${IMAGE_PREFIX:-}postgres:16 -alpine
41+ image : ${POSTGRES_IMAGE:-${ IMAGE_PREFIX:-}postgres:18.3 -alpine}
4242 container_name : quantdinger-db
4343 restart : unless-stopped
4444 environment :
4545 POSTGRES_DB : ${POSTGRES_DB:-quantdinger}
4646 POSTGRES_USER : ${POSTGRES_USER:-quantdinger}
4747 POSTGRES_PASSWORD : ${POSTGRES_PASSWORD:-quantdinger123}
48+ PGDATA : ${POSTGRES_PGDATA:-/var/lib/postgresql/18/docker}
4849 TZ : ${TZ:-Asia/Shanghai}
4950 command :
5051 - " postgres"
@@ -53,7 +54,7 @@ services:
5354 - " -c"
5455 - " shared_buffers=${PG_SHARED_BUFFERS:-256MB}"
5556 volumes :
56- - postgres_data: /var/lib/postgresql/data
57+ - ${POSTGRES_DATA_SOURCE:- postgres_data}:${POSTGRES_PGDATA:- /var/lib/postgresql/18/docker}
5758 ports :
5859 - " ${DB_PORT:-127.0.0.1:5432}:5432"
5960 networks :
Original file line number Diff line number Diff line change @@ -29,13 +29,14 @@ services:
2929 # PostgreSQL Database
3030 # ========================
3131 postgres :
32- image : ${IMAGE_PREFIX:-}postgres:16 -alpine
32+ image : ${POSTGRES_IMAGE:-${ IMAGE_PREFIX:-}postgres:18.3 -alpine}
3333 container_name : quantdinger-db
3434 restart : unless-stopped
3535 environment :
3636 POSTGRES_DB : ${POSTGRES_DB:-quantdinger}
3737 POSTGRES_USER : ${POSTGRES_USER:-quantdinger}
3838 POSTGRES_PASSWORD : ${POSTGRES_PASSWORD:-quantdinger123}
39+ PGDATA : ${POSTGRES_PGDATA:-/var/lib/postgresql/18/docker}
3940 TZ : ${TZ:-Asia/Shanghai}
4041 # Raise PostgreSQL's max_connections so the backend pool (default
4142 # DB_POOL_MAX=50) plus psql/admin connections never exceed PG's own
@@ -47,7 +48,7 @@ services:
4748 - " -c"
4849 - " shared_buffers=${PG_SHARED_BUFFERS:-256MB}"
4950 volumes :
50- - postgres_data: /var/lib/postgresql/data
51+ - ${POSTGRES_DATA_SOURCE:- postgres_data}:${POSTGRES_PGDATA:- /var/lib/postgresql/18/docker}
5152 - ./backend_api_python/migrations/init.sql:/docker-entrypoint-initdb.d/01-init.sql
5253 ports :
5354 - " ${DB_PORT:-127.0.0.1:5432}:5432"
You can’t perform that action at this time.
0 commit comments