← Back to Posts

The Problem

I had constant failures on a 2 vCPU 4GB RAM VPS. I couldn't figure it out what was the main issue.

Coolify Deploy Failure

This was "fixed" momentarily by running build cache cleanup, but it will come back after a few deploys. Disk space was fine. Turns out, what was happening was that the VPS was running out of memory during the build phase of the deployment, and it was killing the process.

The solution

Just add a swap partition to your VPS. By default, Hetzner did not ship this VPS with a swap partition, and Coolify does not use swap by default, so when the build process needed more memory than the available RAM, it was killed. Here is how to do it:

# Create a swap file of 4GB
sudo fallocate -l 4G /swapfile
# Set the correct permissions
sudo chmod 600 /swapfile
# Set up the swap file
sudo mkswap /swapfile
# Enable the swap file
sudo swapon /swapfile
# Make the swap file permanent by adding it to /etc/fstab
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

That's it. Now the deployments should work without any issues. You can check the swap usage with free -h or swapon --show.


← Back to all posts