Skip to content

Commit

Permalink
chore: update adminmgr, fix gotrue, fix config perms (#847)
Browse files Browse the repository at this point in the history
  • Loading branch information
pcnc authored Dec 18, 2023
1 parent 1d78e9e commit 2441263
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 9 deletions.
2 changes: 1 addition & 1 deletion ansible/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ postgres_exporter_release_checksum:
amd64: sha256:cb89fc5bf4485fb554e0d640d9684fae143a4b2d5fa443009bd29c59f9129e84

adminapi_release: 0.58.1
adminmgr_release: 0.14.0
adminmgr_release: 0.14.2

# Postgres Extensions
postgis_release: "3.3.2"
Expand Down
8 changes: 4 additions & 4 deletions docker/all-in-one/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ ARG postgres_version=15.1.0.148

ARG pgbouncer_release=1.18.0
ARG postgrest_release=10.1.2
ARG gotrue_release=2.47.0
ARG gotrue_release=2.130.0
ARG adminapi_release=0.58.1
ARG adminmgr_release=0.14.0
ARG adminmgr_release=0.14.2
ARG vector_release=0.22.3
ARG postgres_exporter_release=0.9.0
ARG envoy_release=1.28.0
Expand Down Expand Up @@ -154,8 +154,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \

# Copy single binary dependencies
COPY --from=pgrst /bin/postgrest /dist/
COPY --from=gotrue /usr/local/bin/gotrue /dist/
COPY --from=gotrue /usr/local/etc/gotrue /opt/gotrue/
COPY --from=gotrue /usr/local/bin/auth /dist/gotrue
COPY --from=gotrue /usr/local/etc/auth /opt/gotrue/
COPY --from=envoy /usr/local/bin/envoy /dist/
COPY --from=adminapi /tmp/supabase-admin-api /dist/
COPY --chown=root:root --from=adminmgr /tmp/admin-mgr /dist/
Expand Down
2 changes: 1 addition & 1 deletion docker/all-in-one/init/configure-adminapi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ if [ "${DATA_VOLUME_MOUNTPOINT}" ]; then
chown -R adminapi:adminapi "/etc/adminapi"

chown -R adminapi:adminapi "${ADMINAPI_CUSTOM_DIR}"
chmod g+rx "${ADMINAPI_CUSTOM_DIR}"
chmod g+wrx "${ADMINAPI_CUSTOM_DIR}"
fi
1 change: 1 addition & 0 deletions docker/all-in-one/init/configure-autoshutdown.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ if [ "${DATA_VOLUME_MOUNTPOINT}" ]; then

rm -f "/etc/supa-shutdown/shutdown.conf"
ln -s "${AUTOSHUTDOWN_CUSTOM_CONFIG_FILE_PATH}" "/etc/supa-shutdown/shutdown.conf"
chmod g+wrx "${AUTOSHUTDOWN_CUSTOM_DIR}"
chown -R adminapi:adminapi "/etc/supa-shutdown/shutdown.conf"
chown -R adminapi:adminapi "${AUTOSHUTDOWN_CUSTOM_CONFIG_FILE_PATH}"
fi
1 change: 1 addition & 0 deletions docker/all-in-one/init/configure-gotrue.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ GOTRUE_CUSTOM_CONFIG_FILE_PATH="${DATA_VOLUME_MOUNTPOINT}/etc/gotrue/gotrue.env"

if [ "${DATA_VOLUME_MOUNTPOINT}" ]; then
mkdir -p "${GOTRUE_CUSTOM_DIR}"
chmod g+wrx "${GOTRUE_CUSTOM_DIR}"
chown adminapi:adminapi "${GOTRUE_CUSTOM_DIR}"

if [ ! -f "${CONFIGURED_FLAG_PATH}" ]; then
Expand Down
17 changes: 17 additions & 0 deletions docker/all-in-one/init/configure-kong.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
set -eou pipefail

KONG_CONF=/etc/kong/kong.yml
KONG_CUSTOM_DIR="${DATA_VOLUME_MOUNTPOINT}/etc/kong"

touch /var/log/services/kong.log

if [ -f "${INIT_PAYLOAD_PATH:-}" ]; then
Expand Down Expand Up @@ -29,3 +31,18 @@ sed -i -e "s|anon_key|$ANON_KEY|g" \
# Update kong ports
sed -i "s|:80 |:$KONG_HTTP_PORT |g" /etc/kong/kong.conf
sed -i "s|:443 |:$KONG_HTTPS_PORT |g" /etc/kong/kong.conf

if [ "${DATA_VOLUME_MOUNTPOINT}" ]; then
mkdir -p "${KONG_CUSTOM_DIR}"
if [ ! -f "${CONFIGURED_FLAG_PATH}" ]; then
echo "Copying existing custom kong config from /etc/kong/kong.yml to ${KONG_CUSTOM_DIR}"
cp /etc/kong/kong.yml "${KONG_CUSTOM_DIR}/kong.yml"
fi

rm -rf "/etc/kong/kong.yml"
ln -s "${KONG_CUSTOM_DIR}/kong.yml" "/etc/kong/kong.yml"
chown -R adminapi:adminapi "/etc/kong/kong.yml"

chown -R adminapi:adminapi "${KONG_CUSTOM_DIR}"
chmod g+wrx "${KONG_CUSTOM_DIR}"
fi
2 changes: 1 addition & 1 deletion docker/all-in-one/init/configure-pgbouncer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ if [ "${DATA_VOLUME_MOUNTPOINT}" ]; then
ln -s "${PGBOUNCER_DIR}" "/etc/pgbouncer"
chown -R pgbouncer:pgbouncer "/etc/pgbouncer"
chown -R pgbouncer:pgbouncer "${PGBOUNCER_DIR}"
chmod -R g+rx "${PGBOUNCER_DIR}"
chmod -R g+wrx "${PGBOUNCER_DIR}"
fi
2 changes: 1 addition & 1 deletion docker/all-in-one/init/configure-postgrest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ if [ "${DATA_VOLUME_MOUNTPOINT}" ]; then
chown -R postgrest:postgrest "/etc/postgrest"

chown -R postgrest:postgrest "${POSTGREST_CUSTOM_DIR}"
chmod g+rx "${POSTGREST_CUSTOM_DIR}"
chmod g+wrx "${POSTGREST_CUSTOM_DIR}"
fi

PGRST_CONF=/etc/postgrest/generated.conf
Expand Down
2 changes: 1 addition & 1 deletion docker/all-in-one/shutdown.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ SQL
# This is to ensure that the WAL file is shipped, just in case
sleep 1

/usr/bin/admin-mgr lsn-checkpoint-push || echo "Failed to push LSN checkpoint"
/usr/bin/admin-mgr lsn-checkpoint-push --immediately || echo "Failed to push LSN checkpoint"

kill -s TERM "$(supervisorctl pid)"
fi
Expand Down

0 comments on commit 2441263

Please sign in to comment.