forked from erp-dev/erp
fix: replace pgbouncer setting
This commit is contained in:
4
.env
4
.env
@@ -1,8 +1,8 @@
|
||||
SECRET_KEY=testing_$weak_secret_is_allowd
|
||||
DEBUG=True
|
||||
ALLOWED_HOSTS=yuwenerp.yuwen.cloud,localhost,
|
||||
DB_HOST=localhost
|
||||
DB_PORT=5432
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=6432
|
||||
DB_NAME=flower
|
||||
DB_USER=postgres
|
||||
DB_PASSWORD=postgres
|
||||
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -3,5 +3,6 @@
|
||||
"."
|
||||
],
|
||||
"python.testing.unittestEnabled": false,
|
||||
"python.testing.pytestEnabled": true
|
||||
"python.testing.pytestEnabled": true,
|
||||
"python-envs.pythonProjects": []
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
17
deploy/pgbouncer/pgbouncer.ini
Normal file
17
deploy/pgbouncer/pgbouncer.ini
Normal file
@@ -0,0 +1,17 @@
|
||||
[databases]
|
||||
# 主业务库,经 PgBouncer 转发到 Postgres
|
||||
flower = host=postgres port=5432 dbname=flower pool_mode=session
|
||||
|
||||
[pgbouncer]
|
||||
listen_addr = 0.0.0.0
|
||||
listen_port = 6432
|
||||
auth_type = md5
|
||||
auth_file = /etc/pgbouncer/userlist.txt
|
||||
pool_mode = session
|
||||
max_client_conn = 800
|
||||
default_pool_size = 40
|
||||
reserve_pool_size = 10
|
||||
stats_users = pgbouncer_stats
|
||||
ignore_startup_parameters = extra_float_digits
|
||||
log_connections = 0
|
||||
log_disconnections = 0
|
||||
2
deploy/pgbouncer/userlist.txt
Normal file
2
deploy/pgbouncer/userlist.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
"postgres" "md53175bce1d3201d16594cebf9d7eb3f9d"
|
||||
"pgbouncer_stats" "md5020ee831c95741b96bf72786eed800c1"
|
||||
@@ -14,6 +14,18 @@ services:
|
||||
- db_data:/var/lib/postgresql/data
|
||||
restart: unless-stopped
|
||||
|
||||
pgbouncer:
|
||||
image: edoburu/pgbouncer:latest
|
||||
container_name: pgbouncer
|
||||
ports:
|
||||
- "6432:6432"
|
||||
volumes:
|
||||
- ./deploy/pgbouncer/pgbouncer.ini:/etc/pgbouncer/pgbouncer.ini
|
||||
- ./deploy/pgbouncer/userlist.txt:/etc/pgbouncer/userlist.txt
|
||||
depends_on:
|
||||
- postgres
|
||||
restart: unless-stopped
|
||||
|
||||
pgadmin:
|
||||
image: dpage/pgadmin4:latest
|
||||
container_name: pgadmin
|
||||
@@ -68,13 +80,13 @@ services:
|
||||
PYTHONPATH: /app
|
||||
DEBUG: "1"
|
||||
ALLOWED_HOSTS: "localhost,127.0.0.1,0.0.0.0,8.148.215.233,yuwenerp.yuwen.cloud"
|
||||
DB_HOST: postgres
|
||||
DB_PORT: "5432"
|
||||
DB_HOST: pgbouncer
|
||||
DB_PORT: "6432"
|
||||
DB_NAME: flower
|
||||
DB_USER: postgres
|
||||
DB_PASSWORD: postgres
|
||||
depends_on:
|
||||
- postgres
|
||||
- pgbouncer
|
||||
- redis
|
||||
- rabbitmq
|
||||
restart: unless-stopped
|
||||
@@ -96,6 +108,7 @@ services:
|
||||
volumes:
|
||||
- .:/app
|
||||
depends_on:
|
||||
- pgbouncer
|
||||
- postgres
|
||||
- redis
|
||||
- rabbitmq
|
||||
@@ -103,8 +116,8 @@ services:
|
||||
CELERY_BROKER_URL: amqp://guest:guest@rabbitmq:5672//
|
||||
CELERY_RESULT_BACKEND: redis://redis:6379/0
|
||||
PYTHONPATH: /app
|
||||
DB_HOST: postgres
|
||||
DB_PORT: "5432"
|
||||
DB_HOST: pgbouncer
|
||||
DB_PORT: "6432"
|
||||
DB_NAME: flower
|
||||
DB_USER: postgres
|
||||
DB_PASSWORD: postgres
|
||||
@@ -125,14 +138,15 @@ services:
|
||||
volumes:
|
||||
- .:/app
|
||||
depends_on:
|
||||
- pgbouncer
|
||||
- postgres
|
||||
- redis
|
||||
- rabbitmq
|
||||
environment:
|
||||
DJANGO_SETTINGS_MODULE: flower.settings
|
||||
PYTHONPATH: /app
|
||||
DB_HOST: postgres
|
||||
DB_PORT: "5432"
|
||||
DB_HOST: pgbouncer
|
||||
DB_PORT: "6432"
|
||||
DB_NAME: flower
|
||||
DB_USER: postgres
|
||||
DB_PASSWORD: postgres
|
||||
|
||||
@@ -194,9 +194,9 @@ DATABASES = {
|
||||
'USER': env('DB_USER'),
|
||||
'PASSWORD': env('DB_PASSWORD'),
|
||||
'HOST': env('DB_HOST', default='localhost'),
|
||||
'PORT': env('DB_PORT', default='5432'),
|
||||
'PORT': env('DB_PORT', default='6432'),
|
||||
'CONN_HEALTH_CHECK': True,
|
||||
'CONN_MAX_AGE': 60,
|
||||
'CONN_MAX_AGE': env.int('CONN_MAX_AGE', default=0),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user