indie-stack icon indicating copy to clipboard operation
indie-stack copied to clipboard

docs: README.md update to scale the fly.io memory

Open johnhooks opened this issue 2 years ago • 2 comments

Have you experienced this bug with the latest version of the template?

Yes

Steps to Reproduce

Follow the instructions in the Deployment section of the README.md

Expected Behavior

Successfully deploy to an app based on the Indie Stack to fly.io by following the deployment instructions.

Actual Behavior

The instance on fly.io ran out of memory. The base instance used 256MB and that must not be enough. I found this conversation about it on the fly.io community https://community.fly.io/t/out-of-memory-restarts/1629/3

It took me a little while to figure out what was going wrong. It would be nice for others if this was handled. I scaled to 1GB, as suggested in that thread, and everything built and deployed correctly.

johnhooks avatar Sep 05 '22 11:09 johnhooks

Though, now that I look at it, that pushes the app out of the free tier which is less than desirable for an example. My specific issue occurred in the start.sh script

 [info] + npx prisma migrate deploy

[info] npm WARN exec The following package was not found and will be installed: [email protected]

Then it hit the wall. Is there something specific about npx and the library not being installed that uses memory differently than regular npm?

johnhooks avatar Sep 05 '22 11:09 johnhooks

Just to make sure, I ran it again. It failed multiple times scaled to 256MB, but then succeeded. This is the fly.io monitor log from one of the failures

$ fly logs -a myapp

Waiting for logs...

2022-09-05T11:45:20.867 runner[d05d088e] sea [info] Starting instance

2022-09-05T11:45:21.234 runner[d05d088e] sea [info] Configuring virtual machine

2022-09-05T11:45:21.235 runner[d05d088e] sea [info] Pulling container image

2022-09-05T11:45:22.895 runner[d05d088e] sea [info] Unpacking image

2022-09-05T11:45:22.906 runner[d05d088e] sea [info] Preparing kernel init

2022-09-05T11:45:23.046 runner[d05d088e] sea [info] Setting up volume 'data'

2022-09-05T11:45:23.049 runner[d05d088e] sea [info] Uninitialized volume 'data', initializing...

2022-09-05T11:45:23.353 runner[d05d088e] sea [info] Encrypting volume

2022-09-05T11:45:27.566 runner[d05d088e] sea [info] Opening encrypted volume

2022-09-05T11:45:29.310 runner[d05d088e] sea [info] Formatting volume

2022-09-05T11:45:29.466 runner[d05d088e] sea [info] Configuring firecracker

2022-09-05T11:45:29.561 runner[d05d088e] sea [info] Starting virtual machine

2022-09-05T11:45:29.738 app[d05d088e] sea [info] Starting init (commit: 249766e)...

2022-09-05T11:45:29.774 app[d05d088e] sea [info] Mounting /dev/vdc at /data w/ uid: 0, gid: 0 and chmod 0755

2022-09-05T11:45:29.778 app[d05d088e] sea [info] Preparing to run: `sh start.sh` as root

2022-09-05T11:45:29.801 app[d05d088e] sea [info] 2022/09/05 11:45:29 listening on [fdaa:0:9621:a7b:2d30:1:c45c:2]:22 (DNS: [fdaa::3]:53)

2022-09-05T11:45:29.804 app[d05d088e] sea [info] + npx prisma migrate deploy

2022-09-05T11:45:32.223 app[d05d088e] sea [info] npm WARN exec The following package was not found and will be installed: [email protected]

2022-09-05T11:45:40.682 app[d05d088e] sea [info] [ 11.015484] Out of memory: Killed process 591 (node) total-vm:11212292kB, anon-rss:135336kB, file-rss:0kB, shmem-rss:0kB, UID:0 pgtables:1268kB oom_score_adj:0

2022-09-05T11:45:40.695 app[d05d088e] sea [info] Killed

2022-09-05T11:45:40.716 app[d05d088e] sea [info] npm notice

2022-09-05T11:45:40.717 app[d05d088e] sea [info] npm notice New minor version of npm available! 8.15.0 -> 8.19.1

2022-09-05T11:45:40.718 app[d05d088e] sea [info] npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.19.1>

2022-09-05T11:45:40.718 app[d05d088e] sea [info] npm notice Run `npm install -g [email protected]` to update!

2022-09-05T11:45:40.718 app[d05d088e] sea [info] npm notice

2022-09-05T11:45:40.882 app[d05d088e] sea [info] Starting clean up.

2022-09-05T11:45:40.900 app[d05d088e] sea [info] Umounting /dev/vdc from /data

johnhooks avatar Sep 05 '22 11:09 johnhooks

@johnhooks are you still experiencing this issue?

machour avatar Nov 19 '22 11:11 machour

No, I moved on to using different hosting solutions. This can be closed, because obviously it must have just been me.

johnhooks avatar Dec 01 '22 16:12 johnhooks

FWIW, definitely not just you @johnhooks. The barebones default example with no changes OOMs consistently when attempting to run prisma migrate deploy on fly.io with only 256MB (~6/7 times for me).

256MB is not a lot for node, the node_modules directory of prod deps is already 133MB (not all JS obviously, but still)

patrickhulce avatar Mar 10 '23 16:03 patrickhulce

Good to know it wasn't just me!

johnhooks avatar Mar 10 '23 16:03 johnhooks