-
Notifications
You must be signed in to change notification settings - Fork 314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fly Instance runs out of memory on deployment #200
Comments
By the way, this seems to be a duplicate of #156 but that one is closed since the author opted to stopped using Fly, so probably that one is untracked. |
I'm also experiencing this. It's not ideal. I was able to deploy reliably after the first revision by moving |
This just happened to me on a fresh newly created app (today). I can confirm that the above comment from @seashairo helped me get it working. |
There is a related issue on the fly.io community: Prisma + SQLite causes an out of memory error on deploy which references the following fly.io docs page Optimizing your deployment. As far as I understand if you turn on swap mode before running migrations, it will use disk space instead of running out of memory. Removing the swap directory and disabling swap after running migrations also seems reasonable to me. The modified #!/bin/sh
# This file is how Fly starts the server (configured in fly.toml). Before starting
# the server though, we need to run any prisma migrations that haven't yet been
# run, which is why this file exists in the first place.
# Learn more: https://community.fly.io/t/sqlite-not-getting-setup-properly/4386
set -ex
# Setup 512MB of space for swap and set permissions and turn on swapmode
fallocate -l 512M /swapfile
chmod 0600 /swapfile
mkswap /swapfile
echo 10 > /proc/sys/vm/swappiness
swapon /swapfile
# Run migrations
npx prisma migrate deploy
# Turn off swap mode and remove swap directory
swapoff /swapfile
rm /swapfile
# Finally start the app
npm run start Can anyone try this out? |
nice find @Apsysikal, if this does fix the problem, more than happy to accept a PR 🙂 |
@Apsysikal I tested the swap and it worked great. It was on a postgress instance tho. |
@hilja Nice 👌 I won’t have time to test it myself for the next few weeks with Sqlite but once I have, I’ll create a pull request. |
I was having this issue with a completely fresh npx create-remix@latest using Sqlite and it fixed it for me :)
That was the error before and this was the result after:
|
@Apsysikal works like a charm! Thanks a lot 🚀 I'm using Indie stack with LiteSQL |
This will be fixed by #232 |
@Apsysikal -- you're my hero, thank you 🙏 |
I was still getting this error using fly.toml: swap_size_mb = 2048 |
Have you experienced this bug with the latest version of the template?
Yes
Steps to Reproduce
Expected Behavior
Migrations are applied and app starts normally
And possibly, prisma shouldn't be installed again with
npx
. It should already be there from dependency installing phase.Actual Behavior
Instance runs out of memory while running
npx prisma migrate deploy
So the app never starts and it's rolled back.
This is the log from Fly
The text was updated successfully, but these errors were encountered: