8000 fix: gotrue config persistence for AIO (#961) · cepro/postgres@06b13be · GitHub
[go: up one dir, main page]

Skip to content

Commit 06b13be

Browse files
authored
fix: gotrue config persistence for AIO (supabase#961)
1 parent c4496aa commit 06b13be

File tree

7 files changed

+29
-12
lines changed

7 files changed

+29
-12
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
.DS_Store
22
.python-version
3+
.mise.toml
34
venv/
45
*.swp
56
docker/cache/
67

78
ansible/image-manifest*.json
9+
testinfra-aio-container-logs.log
810

911
# Byte-compiled / optimized / DLL files
1012
__pycache__/

common.vars.pkr.hcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
postgres-version = "15.1.1.49"
1+
postgres-version = "15.1.1.50"

docker/all-in-one/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG postgres_version=15.1.1.24
1+
ARG postgres_version=15.1.1.49
22

33
ARG pgbouncer_release=1.18.0
44
ARG postgrest_release=10.1.2

docker/all-in-one/entrypoint.sh

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,23 @@ function enable_lsn_checkpoint_push {
8080
}
8181

8282
function disable_fail2ban {
83+
sed -i "s/command=.*/command=sleep 5/" /etc/supervisor/services/fail2ban.conf
8384
sed -i "s/autostart=.*/autostart=false/" /etc/supervisor/services/fail2ban.conf
8485
sed -i "s/autorestart=.*/autorestart=false/" /etc/supervisor/services/fail2ban.conf
8586
}
8687

88+
function disable_gotrue {
89+
sed -i "s/command=.*/command=sleep 5/" /etc/supervisor/services/gotrue.conf
90+
sed -i "s/autostart=.*/autostart=false/" /etc/supervisor/services/gotrue.conf
91+
sed -i "s/autorestart=.*/autorestart=false/" /etc/supervisor/services/gotrue.conf
92+
}
93+
94+
function disable_pgbouncer {
95+
sed -i "s/command=.*/command=sleep 5/" /etc/supervisor/services/pgbouncer.conf
96+
sed -i "s/autostart=.*/autostart=false/" /etc/supervisor/services/pgbouncer.conf
97+
sed -i "s/autorestart=.*/autorestart=false/" /etc/supervisor/services/pgbouncer.conf
98+
}
99+
87100
function setup_postgres {
88101
tar -xzvf "$INIT_PAYLOAD_PATH" -C / ./etc/postgresql.schema.sql
89102
mv /etc/postgresql.schema.sql /docker-entrypoint-initdb.d/migrations/99-schema.sql
@@ -285,8 +298,11 @@ if [ "${FAIL2BAN_DISABLED:-}" == "true" ]; then
285298
fi
286299

287300
if [ "${GOTRUE_DISABLED:-}" == "true" ]; then
288-
sed -i "s/autostart=.*/autostart=false/" /etc/supervisor/services/gotrue.conf
289-
sed -i "s/autorestart=.*/autorestart=false/" /etc/supervisor/services/gotrue.conf
301+
disable_gotrue
302+
fi
303+
304+
if [ "${PGBOUNCER_DISABLED:-}" == "true" ]; then
305+
disable_pgbouncer
290306
fi
291307

292308
if [ "${PLATFORM_DEPLOYMENT:-}" == "true" ]; then

docker/all-in-one/etc/supervisor/services/pgbouncer.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
command=/usr/sbin/pgbouncer /etc/pgbouncer/pgbouncer.ini
33
user=pgbouncer
44
stopsignal=INT
5-
autorestart=true
6-
autostart=true
5+
autorestart=false
6+
autostart=false
77
stdout_logfile=/var/log/services/pgbouncer.log
88
redirect_stderr=true
99
stdout_logfile_maxbytes=10MB

docker/all-in-one/healthcheck.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ else
3333
kong health
3434
fi
3535

36-
# pgbouncer up
37-
printf \\0 > "/dev/tcp/localhost/$PGBOUNCER_PORT"
38-
3936
# fail2ban up
4037
fail2ban-client status
4138

docker/all-in-one/init/configure-gotrue.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ if [ "${DATA_VOLUME_MOUNTPOINT}" ]; then
2727
fi
2828

2929
if [ -f "${INIT_PAYLOAD_PATH:-}" ]; then
30-
echo "init gotrue payload"
31-
tar -h --overwrite -xzvf "$INIT_PAYLOAD_PATH" -C / ./etc/gotrue.env
32-
chown -R adminapi:adminapi /etc/gotrue.env
30+
if [ ! -f "${CONFIGURED_FLAG_PATH}" ]; then
31+
echo "init gotrue payload"
32+
tar -h --overwrite -xzvf "$INIT_PAYLOAD_PATH" -C / ./etc/gotrue.env
33+
chown -R adminapi:adminapi /etc/gotrue.env
34+
fi
3335
else
3436
sed -i "s|api_external_url|${API_EXTERNAL_URL:-http://localhost}|g" /etc/gotrue.env
3537
sed -i "s|gotrue_api_host|${GOTRUE_API_HOST:-0.0.0.0}|g" /etc/gotrue.env

0 commit comments

Comments
 (0)
0