|
|
@ -33,28 +33,12 @@
|
|
|
|
from_ip: 127.0.0.1
|
|
|
|
from_ip: 127.0.0.1
|
|
|
|
notify: Reload ufw
|
|
|
|
notify: Reload ufw
|
|
|
|
|
|
|
|
|
|
|
|
- name: Allow access from docker
|
|
|
|
|
|
|
|
notify: Reload ufw
|
|
|
|
|
|
|
|
block:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Get docker network
|
|
|
|
|
|
|
|
community.docker.docker_network:
|
|
|
|
|
|
|
|
name: lotus_land_story
|
|
|
|
|
|
|
|
register: docker_network
|
|
|
|
|
|
|
|
- name: Allow access from docker network
|
|
|
|
|
|
|
|
community.general.ufw:
|
|
|
|
|
|
|
|
rule: allow
|
|
|
|
|
|
|
|
port: 5432
|
|
|
|
|
|
|
|
proto: tcp
|
|
|
|
|
|
|
|
from_ip: "{{ docker_network.network.IPAM.Config[0].Subnet }}"
|
|
|
|
|
|
|
|
notify: Reload ufw
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# https://pgtune.leopard.in.ua/
|
|
|
|
# https://pgtune.leopard.in.ua/
|
|
|
|
# DB Version: 15
|
|
|
|
# DB Version: 15
|
|
|
|
# OS Type: linux
|
|
|
|
# OS Type: linux
|
|
|
|
# DB Type: web
|
|
|
|
# DB Type: web
|
|
|
|
# Total Memory (RAM): 2 GB
|
|
|
|
# Total Memory (RAM): 4 GB
|
|
|
|
# CPUs num: 1
|
|
|
|
# CPUs num: 2
|
|
|
|
# Data Storage: ssd
|
|
|
|
# Data Storage: ssd
|
|
|
|
- name: Tune postgres
|
|
|
|
- name: Tune postgres
|
|
|
|
ansible.builtin.lineinfile:
|
|
|
|
ansible.builtin.lineinfile:
|
|
|
@ -66,15 +50,15 @@
|
|
|
|
vars:
|
|
|
|
vars:
|
|
|
|
configs:
|
|
|
|
configs:
|
|
|
|
max_connections: 200
|
|
|
|
max_connections: 200
|
|
|
|
shared_buffers: 512MB
|
|
|
|
shared_buffers: 1GB
|
|
|
|
effective_cache_size: 1536MB
|
|
|
|
effective_cache_size: 3GB
|
|
|
|
maintenance_work_mem: 128MB
|
|
|
|
maintenance_work_mem: 256MB
|
|
|
|
checkpoint_completion_target: 0.9
|
|
|
|
checkpoint_completion_target: 0.9
|
|
|
|
wal_buffers: 16MB
|
|
|
|
wal_buffers: 16MB
|
|
|
|
default_statistics_target: 100
|
|
|
|
default_statistics_target: 100
|
|
|
|
random_page_cost: 1.1
|
|
|
|
random_page_cost: 1.1
|
|
|
|
effective_io_concurrency: 200
|
|
|
|
effective_io_concurrency: 200
|
|
|
|
work_mem: 1310kB
|
|
|
|
work_mem: 2621kB
|
|
|
|
min_wal_size: 1GB
|
|
|
|
min_wal_size: 1GB
|
|
|
|
max_wal_size: 4GB
|
|
|
|
max_wal_size: 4GB
|
|
|
|
notify: Restart postgres
|
|
|
|
notify: Restart postgres
|
|
|
|