supabase-postgres.git / summary / log / commit / refs

commit    77b297954e4fab8aed02ee8964f8b24d6cc07398
Author:   Paul Cioanca <paul.cioanca@supabase.io>
Commit:   GitHub <noreply@github.com>
Date:     Tue May 14 09:59:47 2024 +0000

    fix: gotrue config persistence for AIO (#961)


.gitignore | 2 ++ common.vars.pkr.hcl | 2 +- docker/all-in-one/Dockerfile | 2 +- docker/all-in-one/entrypoint.sh | 20 ++++++++++++++++++-- .../etc/supervisor/services/pgbouncer.conf | 4 ++-- docker/all-in-one/healthcheck.sh | 3 --- docker/all-in-one/init/configure-gotrue.sh | 8 +++++--- 7 files changed, 29 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 9e232d38..4ee250e0 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/common.vars.pkr.hcl b/common.vars.pkr.hcl index 3f868970..2e4bc0ce 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" diff --git a/docker/all-in-one/Dockerfile b/docker/all-in-one/Dockerfile index c9007c1f..c28bf1e1 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/entrypoint.sh b/docker/all-in-one/entrypoint.sh index 56b58cc3..48311a41 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 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 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 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 +} + 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 44fe93b5..6926c34b 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/healthcheck.sh b/docker/all-in-one/healthcheck.sh index 039b461f..0b5c9607 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 diff --git a/docker/all-in-one/init/configure-gotrue.sh b/docker/all-in-one/init/configure-gotrue.sh index e3d99f0e..5fe4ad25 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 [parent: 6f5b25fde12e]