From 9552cb5ca4a6cfd1c48c1fb45360c667dc319e8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Wed, 25 May 2022 15:17:11 +0200 Subject: [PATCH] Add instruction for using pg_activity --- CHANGELOG.md | 2 ++ README.md | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bdb1868..87727d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## 3.8.0 (not released yet) +* Add documentation cookbook for using pg_activity + ## 3.7.0 (2022-05-24) * Add documentation cookbook for installing redirection.io diff --git a/README.md b/README.md index e54f409..d7b6e8e 100644 --- a/README.md +++ b/README.md @@ -594,6 +594,42 @@ services: +### How to pg_activity for monitoring PostgreSQL + +
+ +Read the cookbook + +In order to install pg_activity, you should add the following content to the +`infrastructure/docker/services/postgres/Dockerfile` file: + +```Dockerfile +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + pg-activity \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* +``` + +Then, you can add the following content to the `tasks.py` file: + +```py +@task +def pg_activity(c): + """ + Monitor PostgreSQL + """ + docker_compose(c, 'exec postgres pg_activity -U app', bare_run=True) +``` + +Finally you can use the following command: + +``` +inv pg-activity +``` + +
+ ### How to use MySQL instead of PostgreSQL