Skip to content

Commit 35dc15b

Browse files
authored
chore: enable swap on fly (#671)
1 parent 4d83016 commit 35dc15b

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

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.0.92"
1+
postgres-version = "15.1.0.94"

docker/all-in-one/entrypoint.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ function configure_services {
3737
done
3838
}
3939

40+
function enable_swap {
41+
fallocate -l 1G /mnt/swapfile
42+
chmod 600 /mnt/swapfile
43+
mkswap /mnt/swapfile
44+
swapon /mnt/swapfile
45+
}
46+
4047
PG_CONF=/etc/postgresql/postgresql.conf
4148
SUPERVISOR_CONF=/etc/supervisor/supervisord.conf
4249

@@ -224,5 +231,9 @@ if [ "${AUTOSHUTDOWN_ENABLED:-}" ]; then
224231
sed -i "s/autostart=.*/autostart=true/" /etc/supervisor/db-only/supa-shutdown.conf
225232
fi
226233

234+
if [ "${PLATFORM_DEPLOYMENT:-}" ]; then
235+
enable_swap
236+
fi
237+
227238
touch "$CONFIGURED_FLAG_PATH"
228239
start_supervisor

0 commit comments

Comments
 (0)