From 162db34e1bb8ebed7d896b077180fa8297de3e22 Mon Sep 17 00:00:00 2001
From: Sebastian Rieger <sebastian.rieger@informatik.hs-fulda.de>
Date: Tue, 26 Apr 2022 22:54:56 +0200
Subject: [PATCH] add swap to fix OOM kill for pip in cheapest AWS instance
 type m1.tiny

---
 faafo/contrib/install-aws.sh | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/faafo/contrib/install-aws.sh b/faafo/contrib/install-aws.sh
index b378c6c..d285fba 100644
--- a/faafo/contrib/install-aws.sh
+++ b/faafo/contrib/install-aws.sh
@@ -146,8 +146,12 @@ if [[ -e /etc/os-release ]]; then
         cd cloud-computing-msc-ai-examples/faafo
         # following line required by bug 1636150
         sudo pip install --upgrade pbr
-        sudo pip install -r requirements.txt
-        # rerun install of reqs in AWS, as first run seams to be killed?
+        # in m1.tiny instance during cloud-init the following pip install can experience OOM kill
+        # setup swap to prevent that
+        sudo dd if=/dev/zero of=/swap bs=1M count=512
+        sudo chmod 600 /swap
+        sudo mkswap /swap
+        sudo swapon /swap
         sudo pip install -r requirements.txt
         sudo python setup.py install
 
-- 
GitLab