mu
change
commit 5808ed502f5ba7bbceec28d03f44402dc379b5be
author Alpha Chen <alpha@kejadlen.dev>
date
parent 7d1b92a9
diff --git a/hosts.yml b/hosts.yml
index 25134b9..e2e8d5e 100644
--- a/hosts.yml
+++ b/hosts.yml
@@ -7,3 +7,4 @@ all:
       ansible_user: root
       ansible_python_interpreter: /usr/bin/python3
     on-fire-within:
+    lotus-land-story:
diff --git a/lotus-land-story/main.yml b/lotus-land-story/main.yml
index 0934a6d..2d8aa2d 100644
--- a/lotus-land-story/main.yml
+++ b/lotus-land-story/main.yml
@@ -95,10 +95,10 @@
           GRANT SELECT ON prometheus.pg_stat_activity TO prometheus;
       when: "'prometheus' not in postgres_info.roles"
 
+- import_playbook: golink.yml     # noqa: name[play]
 - import_playbook: grafana.yml    # noqa: name[play]
 - import_playbook: loki.yml       # noqa: name[play]
 - import_playbook: miniflux.yml   # noqa: name[play]
-- import_playbook: golink.yml     # noqa: name[play]
 - import_playbook: woodpecker.yml # noqa: name[play]
 
 - import_playbook: caddy.yml      # noqa: name[play]
diff --git a/lotus-land-story/postgres.yml b/lotus-land-story/postgres.yml
index 5a5b56a..858d6ca 100644
--- a/lotus-land-story/postgres.yml
+++ b/lotus-land-story/postgres.yml
@@ -49,6 +49,36 @@
             from_ip: "{{ docker_network.network.IPAM.Config[0].Subnet }}"
           notify: Reload ufw
 
+    # https://pgtune.leopard.in.ua/
+    #   DB Version: 15
+    #   OS Type: linux
+    #   DB Type: web
+    #   Total Memory (RAM): 2 GB
+    #   CPUs num: 1
+    #   Data Storage: ssd
+    - name: Tune postgres
+      ansible.builtin.lineinfile:
+        dest: "/etc/postgresql/13/main/postgresql.conf"
+        regexp: '^#?{{ item.key }} ='
+        line: "{{ item.key }} = {{ item.value }}"
+        state: present
+      loop: "{{ configs | dict2items }}"
+      vars:
+        configs:
+          max_connections: 200
+          shared_buffers: 512MB
+          effective_cache_size: 1536MB
+          maintenance_work_mem: 128MB
+          checkpoint_completion_target: 0.9
+          wal_buffers: 16MB
+          default_statistics_target: 100
+          random_page_cost: 1.1
+          effective_io_concurrency: 200
+          work_mem: 1310kB
+          min_wal_size: 1GB
+          max_wal_size: 4GB
+      notify: Restart postgres
+
   handlers:
     - name: Import restarts
       ansible.builtin.import_tasks: restarts.yml