Django on fly.io

I wrote about some caveats I found while running Django on fly: Django + fly.io = ❤️ | Josef's Blog

1 Like

Thanks for this, @joseferben! I’m wondering about the swap files, where should I put in those commands? Is that in your Dockerfile?

I have it in my starting script web.sh:

#!/bin/bash
set -e

# Set up swapping
fallocate -l 512M /swapfile
chmod 0600 /swapfile
mkswap /swapfile
echo 10 > /proc/sys/vm/swappiness
swapon /swapfile

gunicorn config.wsgi:application -b 0.0.0.0:8080 --workers=2 --capture-output --enable-stdio-inheritance

Which is run by

[processes]
  web = "sh /app/scripts/web.sh"
  worker = "sh /app/scripts/worker.sh"