How do I access the rails console (API-only) ?

Hello !

I am in training and with my project group we have to make a React app linked with a Rails API. We have always hosted RoR applications on fly and have never had any problems.
But this time we only host a Rails API and we cannot access the Rails console in production.

We tried the following command: fly ssh console -C "rails/bin/rails console"
But we got this error:

Connecting to ***... complete
Error ssh shell: wait: remote command exited without exit status or exit signal

Thank you for your help !

Hi!

Can you do this as two steps?

Are you able to connect to the console with -

fly ssh console

And then connect to the rails console from there?

rails/bin/rails console
1 Like

fly ssh console work, but then when I write rails/bin/rails console I got:

Loading production environment (Rails 7.0.4.2)

But then nothing else happen.

If you look on the Monitoring tab in your dashboard are you seeing anything in the logs that might indicate any issues with your application?

This may solve the problem:

bin/rails generate dockerfile --swap=512M
fly deploy

See Dockerfiles and fly.toml · Fly Docs for more details

2 Likes

In the Monitoring Tab we got this message:

2023-03-22T12:05:38.779 app[2f25ac77] cdg [info] [ 275.778355] Out of memory: Killed process 520 (ruby) total-vm:739052kB, anon-rss:106160kB, file-rss:0kB, shmem-rss:0kB, UID:1000 pgtables:492kB oom_score_adj:0

This works ! Thanks :heart:

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