From bea3707127d9fba257787d61ad08729f3d946ffb Mon Sep 17 00:00:00 2001 From: Paul Cioanca Date: Tue, 30 Apr 2024 19:49:02 +0300 Subject: [PATCH 1/6] chore: gotrue config persistence fix for AIO --- docker/all-in-one/entrypoint.sh | 20 +++++++++++++++++-- .../etc/supervisor/services/pgbouncer.conf | 4 ++-- docker/all-in-one/init/configure-gotrue.sh | 8 +++++--- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/docker/all-in-one/entrypoint.sh b/docker/all-in-one/entrypoint.sh index 56b58cc39..4287fe8f7 100755 --- a/docker/all-in-one/entrypoint.sh +++ b/docker/all-in-one/entrypoint.sh @@ -80,10 +80,23 @@ function enable_lsn_checkpoint_push { } function disable_fail2ban { + sed -i "s/command=.*/command=sleep 1/" /etc/supervisor/services/fail2ban.conf sed -i "s/autostart=.*/autostart=false/" /etc/supervisor/services/fail2ban.conf sed -i "s/autorestart=.*/autorestart=false/" /etc/supervisor/services/fail2ban.conf } +function disable_gotrue { + sed -i "s/command=.*/command=sleep 1/" /etc/supervisor/services/gotrue.conf + sed -i "s/autostart=.*/autostart=false/" /etc/supervisor/services/gotrue.conf + sed -i "s/autorestart=.*/autorestart=false/" /etc/supervisor/services/gotrue.conf +} + +function disable_pgbouncer { + sed -i "s/command=.*/command=sleep 1/" /etc/supervisor/services/pgbouncer.conf + sed -i "s/autostart=.*/autostart=false/" /etc/supervisor/services/pgbouncer.conf + sed -i "s/autorestart=.*/autorestart=false/" /etc/supervisor/services/pgbouncer.conf +} + function setup_postgres { tar -xzvf "$INIT_PAYLOAD_PATH" -C / ./etc/postgresql.schema.sql mv /etc/postgresql.schema.sql /docker-entrypoint-initdb.d/migrations/99-schema.sql @@ -285,8 +298,11 @@ if [ "${FAIL2BAN_DISABLED:-}" == "true" ]; then fi if [ "${GOTRUE_DISABLED:-}" == "true" ]; then - sed -i "s/autostart=.*/autostart=false/" /etc/supervisor/services/gotrue.conf - sed -i "s/autorestart=.*/autorestart=false/" /etc/supervisor/services/gotrue.conf + disable_gotrue +fi + +if [ "${PGBOUNCER_DISABLED:-}" == "true" ]; then + disable_pgbouncer fi if [ "${PLATFORM_DEPLOYMENT:-}" == "true" ]; then diff --git a/docker/all-in-one/etc/supervisor/services/pgbouncer.conf b/docker/all-in-one/etc/supervisor/services/pgbouncer.conf index 44fe93b5f..6926c34bc 100644 --- a/docker/all-in-one/etc/supervisor/services/pgbouncer.conf +++ b/docker/all-in-one/etc/supervisor/services/pgbouncer.conf @@ -2,8 +2,8 @@ command=/usr/sbin/pgbouncer /etc/pgbouncer/pgbouncer.ini user=pgbouncer stopsignal=INT -autorestart=true -autostart=true +autorestart=false +autostart=false stdout_logfile=/var/log/services/pgbouncer.log redirect_stderr=true stdout_logfile_maxbytes=10MB diff --git a/docker/all-in-one/init/configure-gotrue.sh b/docker/all-in-one/init/configure-gotrue.sh index e3d99f0e6..5fe4ad25e 100755 --- a/docker/all-in-one/init/configure-gotrue.sh +++ b/docker/all-in-one/init/configure-gotrue.sh @@ -27,9 +27,11 @@ if [ "${DATA_VOLUME_MOUNTPOINT}" ]; then fi if [ -f "${INIT_PAYLOAD_PATH:-}" ]; then - echo "init gotrue payload" - tar -h --overwrite -xzvf "$INIT_PAYLOAD_PATH" -C / ./etc/gotrue.env - chown -R adminapi:adminapi /etc/gotrue.env + if [ ! -f "${CONFIGURED_FLAG_PATH}" ]; then + echo "init gotrue payload" + tar -h --overwrite -xzvf "$INIT_PAYLOAD_PATH" -C / ./etc/gotrue.env + chown -R adminapi:adminapi /etc/gotrue.env + fi else sed -i "s|api_external_url|${API_EXTERNAL_URL:-http://localhost}|g" /etc/gotrue.env sed -i "s|gotrue_api_host|${GOTRUE_API_HOST:-0.0.0.0}|g" /etc/gotrue.env From c256c5ceaf89edfc4307dd736e6ee3ab8f7adcf8 Mon Sep 17 00:00:00 2001 From: Paul Cioanca Date: Wed, 1 May 2024 13:20:21 +0300 Subject: [PATCH 2/6] chore: increase sleep to 5s --- docker/all-in-one/entrypoint.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/all-in-one/entrypoint.sh b/docker/all-in-one/entrypoint.sh index 4287fe8f7..48311a413 100755 --- a/docker/all-in-one/entrypoint.sh +++ b/docker/all-in-one/entrypoint.sh @@ -80,19 +80,19 @@ function enable_lsn_checkpoint_push { } function disable_fail2ban { - sed -i "s/command=.*/command=sleep 1/" /etc/supervisor/services/fail2ban.conf + sed -i "s/command=.*/command=sleep 5/" /etc/supervisor/services/fail2ban.conf sed -i "s/autostart=.*/autostart=false/" /etc/supervisor/services/fail2ban.conf sed -i "s/autorestart=.*/autorestart=false/" /etc/supervisor/services/fail2ban.conf } function disable_gotrue { - sed -i "s/command=.*/command=sleep 1/" /etc/supervisor/services/gotrue.conf + sed -i "s/command=.*/command=sleep 5/" /etc/supervisor/services/gotrue.conf sed -i "s/autostart=.*/autostart=false/" /etc/supervisor/services/gotrue.conf sed -i "s/autorestart=.*/autorestart=false/" /etc/supervisor/services/gotrue.conf } function disable_pgbouncer { - sed -i "s/command=.*/command=sleep 1/" /etc/supervisor/services/pgbouncer.conf + sed -i "s/command=.*/command=sleep 5/" /etc/supervisor/services/pgbouncer.conf sed -i "s/autostart=.*/autostart=false/" /etc/supervisor/services/pgbouncer.conf sed -i "s/autorestart=.*/autorestart=false/" /etc/supervisor/services/pgbouncer.conf } From 5093473de1b286e9b05066fddd6652811d4ad5e1 Mon Sep 17 00:00:00 2001 From: Paul Cioanca Date: Mon, 13 May 2024 16:27:28 +0300 Subject: [PATCH 3/6] chore: fixing tests --- .gitignore | 2 ++ docker/all-in-one/Dockerfile | 2 +- docker/all-in-one/healthcheck.sh | 3 --- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 9e232d380..4ee250e08 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,12 @@ .DS_Store .python-version +.mise.toml venv/ *.swp docker/cache/ ansible/image-manifest*.json +testinfra-aio-container-logs.log # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/docker/all-in-one/Dockerfile b/docker/all-in-one/Dockerfile index 360a5fbf7..a539df4e4 100644 --- a/docker/all-in-one/Dockerfile +++ b/docker/all-in-one/Dockerfile @@ -1,4 +1,4 @@ -ARG postgres_version=15.1.1.24 +ARG postgres_version=15.1.1.49 ARG pgbouncer_release=1.18.0 ARG postgrest_release=10.1.2 diff --git a/docker/all-in-one/healthcheck.sh b/docker/all-in-one/healthcheck.sh index 039b461f1..0b5c9607d 100755 --- a/docker/all-in-one/healthcheck.sh +++ b/docker/all-in-one/healthcheck.sh @@ -33,9 +33,6 @@ else kong health fi -# pgbouncer up -printf \\0 > "/dev/tcp/localhost/$PGBOUNCER_PORT" - # fail2ban up fail2ban-client status From 53b569c85a784a06824defe949e6987a34aab781 Mon Sep 17 00:00:00 2001 From: Paul Cioanca Date: Tue, 14 May 2024 11:44:46 +0300 Subject: [PATCH 4/6] chore: add metric for pending WAL files to be archived (#970) --- docker/all-in-one/opt/postgres_exporter/queries.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docker/all-in-one/opt/postgres_exporter/queries.yml b/docker/all-in-one/opt/postgres_exporter/queries.yml index 83cfeed44..fe065247a 100644 --- a/docker/all-in-one/opt/postgres_exporter/queries.yml +++ b/docker/all-in-one/opt/postgres_exporter/queries.yml @@ -170,6 +170,15 @@ pg_stat_statements: usage: "COUNTER" description: "Total time spent, in seconds" +pg_ls_archive_statusdir: + master: true + cache_seconds: 60 + query: "select count(*) as wal_pending_count from pg_ls_archive_statusdir() where name like '%.ready'" + metrics: + - wal_pending_count: + usage: "COUNTER" + description: "Number of not yet archived WAL files" + auth_users: master: true cache_seconds: 60 From 0de8a22b6866cabbdb545da07005fc89864ae7e1 Mon Sep 17 00:00:00 2001 From: Paul Cioanca Date: Tue, 14 May 2024 11:47:43 +0300 Subject: [PATCH 5/6] chore: bump adminapi to 0.64.0 (#969) --- ansible/vars.yml | 2 +- docker/all-in-one/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ansible/vars.yml b/ansible/vars.yml index adfc2351b..986ae2ac8 100644 --- a/ansible/vars.yml +++ b/ansible/vars.yml @@ -46,7 +46,7 @@ postgres_exporter_release_checksum: arm64: sha256:29ba62d538b92d39952afe12ee2e1f4401250d678ff4b354ff2752f4321c87a0 amd64: sha256:cb89fc5bf4485fb554e0d640d9684fae143a4b2d5fa443009bd29c59f9129e84 -adminapi_release: 0.63.5 +adminapi_release: 0.64.0 adminmgr_release: 0.19.0 # Postgres Extensions diff --git a/docker/all-in-one/Dockerfile b/docker/all-in-one/Dockerfile index a539df4e4..c28bf1e15 100644 --- a/docker/all-in-one/Dockerfile +++ b/docker/all-in-one/Dockerfile @@ -3,7 +3,7 @@ ARG postgres_version=15.1.1.49 ARG pgbouncer_release=1.18.0 ARG postgrest_release=10.1.2 ARG gotrue_release=2.130.0 -ARG adminapi_release=0.63.5 +ARG adminapi_release=0.64.0 ARG adminmgr_release=0.19.0 ARG vector_release=0.22.3 ARG postgres_exporter_release=0.15.0 From a958662722ec911ab6b08ac09da967a566f34e61 Mon Sep 17 00:00:00 2001 From: Paul Cioanca Date: Tue, 14 May 2024 11:51:00 +0300 Subject: [PATCH 6/6] chore: bump PG version --- common.vars.pkr.hcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common.vars.pkr.hcl b/common.vars.pkr.hcl index 3f868970b..2e4bc0ced 100644 --- a/common.vars.pkr.hcl +++ b/common.vars.pkr.hcl @@ -1 +1 @@ -postgres-version = "15.1.1.49" +postgres-version = "15.1.1.50"