diff --git a/.ebextensions/01_setup_swap.config b/.ebextensions/01_setup_swap.config new file mode 100644 index 0000000..18cbc9d --- /dev/null +++ b/.ebextensions/01_setup_swap.config @@ -0,0 +1,3 @@ +container_commands: + 01setup_swap: + command: "bash .ebextensions/setup_swap.sh" \ No newline at end of file diff --git a/.ebextensions/setup_swap.sh b/.ebextensions/setup_swap.sh new file mode 100644 index 0000000..1f7a5d5 --- /dev/null +++ b/.ebextensions/setup_swap.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +SWAPFILE=/var/swapfile +SWAP_MEGABYTES=1024 + +if [ -f $SWAPFILE ]; then + echo "Swapfile $SWAPFILE found, assuming already setup" + exit; +fi + +/bin/dd if=/dev/zero of=$SWAPFILE bs=1M count=$SWAP_MEGABYTES +/bin/chmod 600 $SWAPFILE +/sbin/mkswap $SWAPFILE +/sbin/swapon $SWAPFILE \ No newline at end of file