basecamp / kamal

Deploy web apps anywhere.
https://kamal-deploy.org
MIT License
11.67k stars 471 forks source link

OOM in Failed to reserve virtual memory for CodeRange #1230

Open cjenaro opened 1 week ago

cjenaro commented 1 week ago

I'm new to rails, I'm trying to deploy a barebones app, just created with tailwind for CSS.

Rails: 8.0.0 Ruby: 3.3.5

Using an M1 Mac when I run kamal setup I get this error:

------
 > [build 6/6] RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile:
#10 6.141 #
#10 6.141 # Fatal process OOM in Failed to reserve virtual memory for CodeRange
#10 6.141 #
#10 6.141
#10 6.141 qemu: uncaught target signal 5 (Trace/breakpoint trap) - core dumped
#10 6.145 bin/rails aborted!
#10 6.145 Command failed with SIGTRAP (signal 5): /usr/local/bundle/ruby/3.3.0/gems/tailwindcss-ruby-3.4.15-x86_64-linux/exe/x86_64-linux/tailwindcss
#10 6.156
#10 6.156 Tasks: TOP => assets:precompile => tailwindcss:build
#10 6.156 (See full trace by running task with --trace)

I see there's a similar issue here related to docker, tried updating the docker desktop version and also settng my memory preferences to 8 GB even, but it still fails, the VPS I'm trying to deploy to is a digital ocean droplet with 2GB memory.

When trying to build on the remote:

  ERROR (SSHKit::Command::Failed): docker exit status: 256
docker stdout: Nothing written
docker stderr: time="2024-11-19T12:34:16-03:00" level=warning msg="commandConn.CloseWrite: commandconn: failed to wait: signal: killed"
time="2024-11-19T12:34:16-03:00" level=warning msg="commandConn.CloseRead: commandconn: failed to wait: signal: killed"
time="2024-11-19T12:34:16-03:00" level=warning msg="commandConn.CloseWrite: commandconn: failed to wait: signal: killed"
error: failed to get status: rpc error: code = Unavailable desc = timed out waiting for server handshake

This is my first time trying Kamal so I'm not sure if I'm doing anything wrong :/

cjenaro commented 1 week ago

I think some people have run into this with kamal 1.x and fixed it this way: https://github.com/basecamp/kamal/discussions/549

Not sure how to do it for v2 though, since remote has to be a string

djmb commented 5 days ago

Not tried this, but can you set the remote to remote: ssh://localhost? You'd need to set things up so ssh localhost worked though.

cjenaro commented 5 days ago

Haven't been able to make that work either, but now I'm not sure if it has to do with the ssh connection or kamal, so there's no way to build on a mac for a linux server really? Not sure why buiding in the VPS doesn't work though, it has Docker there for sure, running docker ps shows the container