8000 fix: gotrue config persistence for AIO by pcnc · Pull Request #961 · supabase/postgres · GitHub
[go: up one dir, main page]

Skip to content

fix: gotrue config persistence for AIO #961

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
10000
Original file line number Diff line number Diff line change
@@ -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__/
Expand Down
2 changes: 1 addition & 1 deletion ansible/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion common.vars.pkr.hcl
Original file line number Diff line number Diff line change
@@ -1 +1 @@
postgres-version = "15.1.1.49"
postgres-version = "15.1.1.50"
4 changes: 2 additions & 2 deletions docker/all-in-one/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
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
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
Expand Down
20 changes: 18 additions & 2 deletions docker/all-in-one/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docker/all-in-one/etc/supervisor/services/pgbouncer.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions docker/all-in-one/healthcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ else
kong health
fi

# pgbouncer up
printf \\0 > "/dev/tcp/localhost/$PGBOUNCER_PORT"

# fail2ban up
fail2ban-client status

Expand Down
8 changes: 5 additions & 3 deletions docker/all-in-one/init/configure-gotrue.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 1E0A :-0.0.0.0}|g" /etc/gotrue.env
Expand Down
9 changes: 9 additions & 0 deletions docker/all-in-one/opt/postgres_exporter/queries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading
0