Unable to deploy rail app

Hello team, it looks like i am also experiensing the same trouble but unlike @bhaswar1212 I am able to fly launch succefully

Even deploying but i can’t view my app i am getting this logs

@roadmr @andie or @bhaswar1212 let me know how you went through it

@Than0s this is most likely not the same trouble. Your screenshot is truncated but it shows a Rails trace indicating the app crashed (the root cause is unfortunately not visible in the screenshot; it would be further down). This is why you see the proxy saying the application is not responding (sure thing, because it crashed).

  • Daniel

Thank you for the quick response @roadmr , i dont really understand why the app is crushing though, i scaled it to the size of two gb on a shared CPU. For more infor here is my fly.toml file

**`app = "kwasio"
primary_region = "jnb"
console_command = "/rails/bin/rails console"


  source = "data"
  destination = "/data"

  internal_port = 3000
  force_https = true
  auto_stop_machines = true
  auto_start_machines = true
  min_machines_running = 0
  processes = ["app"]

  guest_path = "/rails/public"
  url_prefix = "/"

when i deploy this is the response also note i used fly deploy --local-only

--> Pushing image done
image: registry.fly.io/kwasio:deployment-01H822V3TF23PVAENNVHS000ZG
image size: 339 MB

Watch your deployment at https://fly.io/apps/kwasio/monitoring

Provisioning ips for kwasio
  Dedicated ipv6: 2a09:8280:1::4e:5a0a
  Shared ipv4:
  Add a dedicated ipv4 with: fly ips allocate-v4

Creating 1GB volume 'data' for process group 'app'. Use 'fly vol extend' to increase its size
This deployment will:
 * create 1 "app" machine

No machines in group app, launching a new machine
  Machine 91850eea2e0e83 [app] update finished: success

WARNING The app is not listening on the expected address and will not be reachable by fly-proxy.
You can fix this by configuring your app to listen on the following addresses:
Found these processes inside the machine with open listening sockets:
  /.fly/hallpass | [fdaa:2:c72d:a7b:d6e9:a2f6:29d2:2]:22

Finished launching new machines

NOTE: The machines for [app] have services with 'auto_stop_machines = true' that will be stopped when idling

when i slowly try to monitor the logs much of what i see it this

and bytheway also locally i am able to run the code smoothly

 2023-08-17T19:17:00.696 proxy[91850eea2e0e83] jnb [info] Starting machine

2023-08-17T19:17:00.698 proxy[91850eea2e0e83] jnb [error] failed to change machine state: machine still active, refusing to start

2023-08-17T19:17:01.705 proxy[91850eea2e0e83] jnb [error] could not find a good candidate within 90 attempts at load balancing

2023-08-17T19:17:30.485 app[91850eea2e0e83] jnb [info] [ 0.051305] PCI: Fatal: No config space access function found

2023-08-17T19:17:30.705 app[91850eea2e0e83] jnb [info] INFO Starting init (commit: b437b5b)...

2023-08-17T19:17:30.771 app[91850eea2e0e83] jnb [info] INFO Mounting /dev/vdb at /data w/ uid: 1000, gid: 1000 and chmod 0755

2023-08-17T19:17:30.777 app[91850eea2e0e83] jnb [info] INFO Resized /data to 1069547520 bytes

2023-08-17T19:17:30.777 app[91850eea2e0e83] jnb [info] INFO starting statics vsock server

2023-08-17T19:17:30.778 app[91850eea2e0e83] jnb [info] INFO Preparing to run: `/rails/bin/docker-entrypoint ./bin/rails server` as rails

2023-08-17T19:17:30.789 app[91850eea2e0e83] jnb [info] INFO [fly api proxy] listening at /.fly/api

2023-08-17T19:17:30.799 app[91850eea2e0e83] jnb [info] 2023/08/17 19:17:30 listening on [fdaa:2:c72d:a7b:d6e9:a2f6:29d2:2]:22 (DNS: [fdaa::3]:53)

2023-08-17T19:17:32.428 app[91850eea2e0e83] jnb [info] rails aborted!

2023-08-17T19:17:32.428 app[91850eea2e0e83] jnb [info] NameError: uninitialized constant LetterOpenerWeb

2023-08-17T19:17:32.428 app[91850eea2e0e83] jnb [info] /rails/config/routes.rb:5:in `block in <main>'

2023-08-17T19:17:32.428 app[91850eea2e0e83] jnb [info] /rails/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.7/lib/action_dispatch/routing/route_set.rb:428:in `instance_exec'

2023-08-17T19:17:32.428 app[91850eea2e0e83] jnb [info] /rails/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.7/lib/action_dispatch/routing/route_set.rb:428:in `eval_block'

2023-08-17T19:17:32.428 app[91850eea2e0e83] jnb [info] /rails/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.7/lib/action_dispatch/routing/route_set.rb:410:in `draw'

2023-08-17T19:17:32.428 app[91850eea2e0e83] jnb [info] /rails/config/routes.rb:1:in `<main>'

2023-08-17T19:17:32.428 app[91850eea2e0e83] jnb [info] /rails/vendor/bundle/ruby/3.2.0/gems/railties-7.0.7/lib/rails/application/routes_reloader.rb:50:in `load'

2023-08-17T19:17:32.428 app[91850eea2e0e83] jnb [info] /rails/vendor/bundle/ruby/3.2.0/gems/railties-7.0.7/lib/rails/application/routes_reloader.rb:50:in `block in load_paths'

2023-08-17T19:17:32.428 app[91850eea2e0e83] jnb [info] /rails/vendor/bundle/ruby/3.2.0/gems/railties-7.0.7/lib/rails/application/routes_reloader.rb:50:in `each'

2023-08-17T19:17:32.428 app[91850eea2e0e83] jnb [info] /rails/vendor/bundle/ruby/3.2.0/gems/railties-7.0.7/lib/rails/application/routes_reloader.rb:50:in `load_paths' 
 2023-08-17T19:17:32.428 app[91850eea2e0e83] jnb [info] /rails/vendor/bundle/ruby/3.2.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'

2023-08-17T19:17:32.428 app[91850eea2e0e83] jnb [info] Tasks: TOP => db:prepare => db:load_config => environment

2023-08-17T19:17:32.428 app[91850eea2e0e83] jnb [info] (See full trace by running task with --trace)

2023-08-17T19:17:32.790 app[91850eea2e0e83] jnb [info] INFO Main child exited normally with code: 1

2023-08-17T19:17:32.791 app[91850eea2e0e83] jnb [info] INFO Starting clean up.

2023-08-17T19:17:32.791 app[91850eea2e0e83] jnb [info] INFO Umounting /dev/vdb from /data

2023-08-17T19:17:32.793 app[91850eea2e0e83] jnb [info] WARN hallpass exited, pid: 332, status: signal: 15 (SIGTERM)

2023-08-17T19:17:32.796 app[91850eea2e0e83] jnb [info] 2023/08/17 19:17:32 listening on [fdaa:2:c72d:a7b:d6e9:a2f6:29d2:2]:22 (DNS: [fdaa::3]:53)

2023-08-17T19:17:33.794 app[91850eea2e0e83] jnb [info] [ 3.361829] reboot: Restarting system

2023-08-17T19:17:33.943 runner[91850eea2e0e83] jnb [info] machine has reached its max restart count (10) 

The error here is:

NameError: uninitialized constant LetterOpenerWeb

You said you can run the project locally; how are you doing this? with rails server?

Something you can try is building the docker image locally (you have a Dockerfile, so basically just docker build . and then do docker run on the built image. I’ve found this is a good reproduction of how the application will run on Fly.io, and it’s likely you’ll get the same “NameError” problem, and then you can work on fixing it locally such that the docker image runs correctly.

  • Daniel

Sure using rails server, so with the LetterOpenerWeb

group :development do
  # Use console on exceptions pages [https://github.com/rails/web-console]
  gem "web-console"
  # Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
  # gem "rack-mini-profiler"

  # Speed up commands on slow machines / big apps [https://github.com/rails/spring]
  # gem "spring"

gem 'letter_opener'

Initially it was inside the development do, so i removed it out, and ran bundle install again but it was not preventing me from running the app locally.

I will try build the dockerfile test it locally and try again to see if the is still persistent

After really trying for a long time running my docker image locally i am running into issue

C:\Users\user\ror\64635>docker run  9a3f8db57a96ca0267924843cce54cb5f6062ba49fa73ed0ebf2d2b7f4725caf
Missing encryption key to decrypt file with. Ask your team for your master key and write it to /rails/config/master.key or put it in the ENV['RAILS_MASTER_KEY'].

if i refresh the whole procces i end up with same error

=> ERROR [build 7/7] RUN SECRET_KEY_BASE=DUMMY ./bin/rails assets:precompile   

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