Skip to content

Instantly share code, notes, and snippets.

@kyletaylored
Last active December 10, 2018 16:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kyletaylored/24d1291120f7cea4bcddf52a85c5bef6 to your computer and use it in GitHub Desktop.
Save kyletaylored/24d1291120f7cea4bcddf52a85c5bef6 to your computer and use it in GitHub Desktop.
Docksal swap file command to increase swap size for Composer issues (beta)
#!/usr/bin/env bash
set -e # Abort if anything fails
echo "Checking current swap space..."
fin exec free -h
# Increase swap memory
echo "Creating 512M swap file..."
fin exec sudo dd if=/dev/zero of=/swapfile bs=1M count=512
echo "Formatting swap file..."
fin exec sudo mkswap /swapfile
fin exec sudo chown root /swapfile
fin exec sudo chmod 0600 /swapfile
# echo "Adding swap to /etc/fstab..."
# fin exec sudo echo "/swap swap swap defaults 0 0" >> /etc/fstab
# fin exec echo "/swap none swap sw 0 0" | sudo tee -a /etc/fstab
echo "Enabling swap..."
fin exec sudo swapon /swapfile -a
echo "Checking new swap space..."
fin exec free -h
@kyletaylored
Copy link
Author

Fstab doesn't look like it's available on these docker containers, so the command errors out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment