| # Whether to print SQL, default is false. | # Whether to print SQL, default is false. | ||||
| SQLALCHEMY_ECHO=false | SQLALCHEMY_ECHO=false | ||||
| # Maximum number of connections to the database | |||||
| # Default is 100 | |||||
| # | |||||
| # Reference: https://www.postgresql.org/docs/current/runtime-config-connection.html#GUC-MAX-CONNECTIONS | |||||
| POSTGRES_MAX_CONNECTIONS=100 | |||||
| # Sets the amount of shared memory used for postgres's shared buffers. | |||||
| # Default is 128MB | |||||
| # Recommended value: 25% of available memory | |||||
| # Reference: https://www.postgresql.org/docs/current/runtime-config-resource.html#GUC-SHARED-BUFFERS | |||||
| POSTGRES_SHARED_BUFFERS=128MB | |||||
| # Sets the amount of memory used by each database worker for working space. | |||||
| # Default is 4MB | |||||
| # | |||||
| # Reference: https://www.postgresql.org/docs/current/runtime-config-resource.html#GUC-WORK-MEM | |||||
| POSTGRES_WORK_MEM=4MB | |||||
| # Sets the amount of memory reserved for maintenance activities. | |||||
| # Default is 64MB | |||||
| # | |||||
| # Reference: https://www.postgresql.org/docs/current/runtime-config-resource.html#GUC-MAINTENANCE-WORK-MEM | |||||
| POSTGRES_MAINTENANCE_WORK_MEM=64MB | |||||
| # Sets the planner's assumption about the effective cache size. | |||||
| # Default is 4096MB | |||||
| # | |||||
| # Reference: https://www.postgresql.org/docs/current/runtime-config-query.html#GUC-EFFECTIVE-CACHE-SIZE | |||||
| POSTGRES_EFFECTIVE_CACHE_SIZE=4096MB | |||||
| # ------------------------------ | # ------------------------------ | ||||
| # Redis Configuration | # Redis Configuration | ||||
| # This Redis configuration is used for caching and for pub/sub during conversation. | # This Redis configuration is used for caching and for pub/sub during conversation. |
| POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-difyai123456} | POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-difyai123456} | ||||
| POSTGRES_DB: ${POSTGRES_DB:-dify} | POSTGRES_DB: ${POSTGRES_DB:-dify} | ||||
| PGDATA: ${PGDATA:-/var/lib/postgresql/data/pgdata} | PGDATA: ${PGDATA:-/var/lib/postgresql/data/pgdata} | ||||
| command: > | |||||
| postgres -c 'max_connections=${POSTGRES_MAX_CONNECTIONS:-100}' | |||||
| -c 'shared_buffers=${POSTGRES_SHARED_BUFFERS:-128MB}' | |||||
| -c 'work_mem=${POSTGRES_WORK_MEM:-4MB}' | |||||
| -c 'maintenance_work_mem=${POSTGRES_MAINTENANCE_WORK_MEM:-64MB}' | |||||
| -c 'effective_cache_size=${POSTGRES_EFFECTIVE_CACHE_SIZE:-4096MB}' | |||||
| volumes: | volumes: | ||||
| - ./volumes/db/data:/var/lib/postgresql/data | - ./volumes/db/data:/var/lib/postgresql/data | ||||
| ports: | ports: |
| SQLALCHEMY_POOL_SIZE: ${SQLALCHEMY_POOL_SIZE:-30} | SQLALCHEMY_POOL_SIZE: ${SQLALCHEMY_POOL_SIZE:-30} | ||||
| SQLALCHEMY_POOL_RECYCLE: ${SQLALCHEMY_POOL_RECYCLE:-3600} | SQLALCHEMY_POOL_RECYCLE: ${SQLALCHEMY_POOL_RECYCLE:-3600} | ||||
| SQLALCHEMY_ECHO: ${SQLALCHEMY_ECHO:-false} | SQLALCHEMY_ECHO: ${SQLALCHEMY_ECHO:-false} | ||||
| POSTGRES_MAX_CONNECTIONS: ${POSTGRES_MAX_CONNECTIONS:-100} | |||||
| POSTGRES_SHARED_BUFFERS: ${POSTGRES_SHARED_BUFFERS:-128MB} | |||||
| POSTGRES_WORK_MEM: ${POSTGRES_WORK_MEM:-4MB} | |||||
| POSTGRES_MAINTENANCE_WORK_MEM: ${POSTGRES_MAINTENANCE_WORK_MEM:-64MB} | |||||
| POSTGRES_EFFECTIVE_CACHE_SIZE: ${POSTGRES_EFFECTIVE_CACHE_SIZE:-4096MB} | |||||
| REDIS_HOST: ${REDIS_HOST:-redis} | REDIS_HOST: ${REDIS_HOST:-redis} | ||||
| REDIS_PORT: ${REDIS_PORT:-6379} | REDIS_PORT: ${REDIS_PORT:-6379} | ||||
| REDIS_USERNAME: ${REDIS_USERNAME:-} | REDIS_USERNAME: ${REDIS_USERNAME:-} | ||||
| POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-difyai123456} | POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-difyai123456} | ||||
| POSTGRES_DB: ${POSTGRES_DB:-dify} | POSTGRES_DB: ${POSTGRES_DB:-dify} | ||||
| PGDATA: ${PGDATA:-/var/lib/postgresql/data/pgdata} | PGDATA: ${PGDATA:-/var/lib/postgresql/data/pgdata} | ||||
| command: > | |||||
| postgres -c 'max_connections=${POSTGRES_MAX_CONNECTIONS:-100}' | |||||
| -c 'shared_buffers=${POSTGRES_SHARED_BUFFERS:-128MB}' | |||||
| -c 'work_mem=${POSTGRES_WORK_MEM:-4MB}' | |||||
| -c 'maintenance_work_mem=${POSTGRES_MAINTENANCE_WORK_MEM:-64MB}' | |||||
| -c 'effective_cache_size=${POSTGRES_EFFECTIVE_CACHE_SIZE:-4096MB}' | |||||
| volumes: | volumes: | ||||
| - ./volumes/db/data:/var/lib/postgresql/data | - ./volumes/db/data:/var/lib/postgresql/data | ||||
| healthcheck: | healthcheck: |
| # postgres data directory | # postgres data directory | ||||
| PGDATA=/var/lib/postgresql/data/pgdata | PGDATA=/var/lib/postgresql/data/pgdata | ||||
| # Maximum number of connections to the database | |||||
| # Default is 100 | |||||
| # | |||||
| # Reference: https://www.postgresql.org/docs/current/runtime-config-connection.html#GUC-MAX-CONNECTIONS | |||||
| POSTGRES_MAX_CONNECTIONS=100 | |||||
| # Sets the amount of shared memory used for postgres's shared buffers. | |||||
| # Default is 128MB | |||||
| # Recommended value: 25% of available memory | |||||
| # Reference: https://www.postgresql.org/docs/current/runtime-config-resource.html#GUC-SHARED-BUFFERS | |||||
| POSTGRES_SHARED_BUFFERS=128MB | |||||
| # Sets the amount of memory used by each database worker for working space. | |||||
| # Default is 4MB | |||||
| # | |||||
| # Reference: https://www.postgresql.org/docs/current/runtime-config-resource.html#GUC-WORK-MEM | |||||
| POSTGRES_WORK_MEM=4MB | |||||
| # Sets the amount of memory reserved for maintenance activities. | |||||
| # Default is 64MB | |||||
| # | |||||
| # Reference: https://www.postgresql.org/docs/current/runtime-config-resource.html#GUC-MAINTENANCE-WORK-MEM | |||||
| POSTGRES_MAINTENANCE_WORK_MEM=64MB | |||||
| # Sets the planner's assumption about the effective cache size. | |||||
| # Default is 4096MB | |||||
| # | |||||
| # Reference: https://www.postgresql.org/docs/current/runtime-config-query.html#GUC-EFFECTIVE-CACHE-SIZE | |||||
| POSTGRES_EFFECTIVE_CACHE_SIZE=4096MB | |||||
| # ------------------------------ | # ------------------------------ | ||||
| # Environment Variables for sandbox Service | # Environment Variables for sandbox Service |