Skip to content

Commit

Permalink
Up memory to 1024 and add swap to low-memory systems
Browse files Browse the repository at this point in the history
  • Loading branch information
natanfelles committed Nov 27, 2018
1 parent a395dd9 commit 01379fb
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Vagrant.configure("2") do |config|
# Display the VirtualBox GUI when booting the machine
vb.gui = false
# Customize the amount of memory on the VM:
vb.memory = "768"
vb.memory = "512"
end

# Provision
Expand All @@ -56,6 +56,22 @@ Vagrant.configure("2") do |config|
grep -q "127.0.0.1 ${VIRTUALHOST}" /etc/hosts || echo "127.0.0.1 ${VIRTUALHOST}" >> /etc/hosts
# Creates a swap file if necessary
RAM=`awk '/MemTotal/ {print $2}' /proc/meminfo`
if [ $RAM -lt 1000000 ] && [ ! -f /swap/swapfile ]; then
echo "================================================================================"
echo "Adding swap"
echo "================================================================================"
echo "This process may take a few minutes. Please wait..."
mkdir /swap
dd if=/dev/zero of=/swap/swapfile bs=1024 count=1000000
chmod 600 /swap/swapfile
mkswap /swap/swapfile
swapon /swap/swapfile
echo "/swap/swapfile swap swap defaults 0 0" >> /etc/fstab
echo "Done."
fi
# Prepare to use APT Proxy
if [ ! -z $APT_PROXY ]; then
if [ ! -f /etc/apt/sources.list-origin ]; then
Expand Down

0 comments on commit 01379fb

Please sign in to comment.