Last active
August 29, 2015 14:25
-
-
Save dweomer/67306d31da5b461f09bc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ "$1" = "" ]; then | |
echo "Usage: $0 <host> [<fallocate length>]" | |
exit 1 | |
fi | |
DOCKER_MACHINE_HOST_NAME=$1 | |
DOCKER_MACHINE_SWAP_SIZE=${DOCKER_MACHINE_SWAP_SIZE:-2G} | |
exec docker-machine ssh $1 -- sh -x << EOF | |
if [ ! -f /var/swapfile ]; then | |
fallocate -l ${DOCKER_MACHINE_SWAP_SIZE} /var/swapfile | |
mkswap /var/swapfile | |
chmod -v 600 /var/swapfile | |
echo "/var/swapfile none swap sw 0 0" >> /etc/fstab | |
fi | |
sysctl vm.swappiness=10 > /etc/sysctl.d/11-vm-swappiness.conf | |
sysctl vm.vfs_cache_pressure=50 > /etc/sysctl.d/11-vm-vfs-cache-pressure.conf | |
swapon -a && swapon -s | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment