I’ve got two postgres apps, staging and prod. The prod one is pretty beefy, but the staging instance is the skimpiest one, because it really doesn’t get any traffic.
But it keeps running out of memory when I deploy, because I think a Prisma migration task. It’s run via the deploy command:
Yep, that sounds like it’s the temporary VM failing.
That’s also the way we would setup swap as well - in the ENTRYPOINT script (err, well in your case, you set it as CMD, but if it works, that’s cool).
The key point is that you can’t setup swap in the Dockerfile when creating the image that gets deployed, but instead need to do that when the VM is booted, and hence the ENTRYPOINT or CMD is the place to do it
One note:
Your Dockerfile defines ENTRYPOINT as start.sh but then fly.toml is over-riding that by setting sh as ENTRYPOINT and start.sh as the CMD.
You could instead:
Keep start.sh as entrypoint as defined in the Dockerfile, perhaps also set the full path (/myapp/start.sh) instead of relative path ./start.sh.
Ensure start.sh is executable (chmod +x /myapp/start.sh)
Ensure start.sh will use the correct shell by prepending #! /bin/sh to the top of the file
Remove the [experimental] section from fly.toml so the settings in Dockerfile are used