`fly console` crashes by default for Rails apps

Greetings former colleagues,

When I run fly console on my Rails app, it crashes. Why? OOM. I don’t know it at the time because there’s no error message, but I eventually get an email informing me that I indeed ran out of memory.

There’s no documentation on configuring the fly.toml file to boot the console with an appropriate amount of memory. I have to remember to run fly console —vm-memory 2048 to boot without incident, which I never remember.

Please make fly console work out of the box without crashing for Rails apps by allocating as much memory as the fly.toml

Here’s my fly.toml file. You’ll see I’ve attempted to configure the vms with 2gb of memory.

# fly.toml app configuration file generated for terminalwire on 2024-10-02T10:22:34-07:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = 'terminalwire'
primary_region = 'sjc'
console_command = '/rails/bin/rails console'

[build]

[env]
CANONICAL_HOST = "terminalwire.com"

[[mounts]]
source = 'data'
destination = '/data'

[http_service]
internal_port = 3000
force_https = true
auto_stop_machines = 'stop'
auto_start_machines = true
min_machines_running = 2
processes = ['app']

[checks]
[checks.status]
port = 3000
type = 'http'
interval = '10s'
timeout = '2s'
grace_period = '5s'
method = 'GET'
path = '/up'
protocol = 'http'
tls_skip_verify = false

[checks.status.headers]
X-Forwarded-Proto = 'https'

[[vm]]
memory = '2gb'
cpu_kind = 'shared'
cpus = 2

[[statics]]
guest_path = '/rails/public'
url_prefix = '/'
[deploy]
release_command = "./bin/rails db:prepare"

Cheers mates

Doesn’t appear to be documented, but adding

  processes = ["console"]

to your [[vm]] section will make it work (add a new [[vm]] section if you need to). Also swap_size_mb applies to console machines too.

It looks like the intent of a [[vm]] section with no processes defined is that it defined a default that applies to all machines, and the fact that this is not being honored is a bug.

1 Like

Thanks Sam! That fixes the problem.

Yep, I’d agree this is a :lady_beetle:.

Pull request:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.