How to run ts-node scripts as a free user (OOM)


I have a typescript nodejs application (specifically running remix js) and i have been running into memory issues (OOM) when trying to run one off ts-node scripts on my VM.

I assume ts-node just uses too much memory for my 256MB limit since the nodejs server is already taking up a big portion of memory. But I am wondering what the work around is.

I need to run one off scripts every once in a while that will talk with my ORM (prisma) and make changes to the database that way. Or just various other tasks I may need to accomplish.

Currently as a free user I have a postgres vm, node js vm, and a builder vm for the docker builds.

You can allocate swap memory using the following commands:

I actually don’t know anything about swap memory. Where can I learn more about it and what exactly that code you posted does? Also any downsides?

Also referencing another post that has to do with running additional processes that consume too much memory for free tier: Rails console makes app Out Of Memory and restarts

We publish recommendations for dealing with this for Rails users: Dockerfiles and fly.toml · Fly Docs

The commands I shared previously are what is run if you run the command bin/rails dockerfile generate --swap=512M.

1 Like

Is there a limit on how much memory that can be swapped? not super familiar on all of this