Error release_command failed running on machine with exit code 126

Hi everyone,

I have encountered the captioned error when deploying a Ruby on Rails app.

Here’s the bottom of log:

Running app_name release_command: ./bin/rails db:prepare

-------
 ✖ release_command failed
-------
Error release_command failed running on machine 4d8913edc932e8 with exit code 126.
Check its logs: here's the last 100 lines below, or run 'fly logs -i 4d8913edc932e8':
  Pulling container image registry.fly.io/flix6d:deployment-01J3A8PBPPFA42H7R2AQ7YC1MQ
  Successfully prepared image registry.fly.io/flix6d:deployment-01J3A8PBPPFA42H7R2AQ7YC1MQ (21.979968364s)
  Configuring firecracker
  2024-07-21T09:14:34.726512440 [01J3A93STBMF29TYE94K59SB3J:main] Running Firecracker v1.7.0
  [    0.276259] PCI: Fatal: No config space access function found
   INFO Starting init (commit: 6d042359e)...
   INFO Preparing to run: `/rails/bin/docker-entrypoint ./bin/rails db:prepare` as 1000
   INFO [fly api proxy] listening at /.fly/api
  2024/07/21 09:14:35 INFO SSH listening listen_address=[fdaa:9:945c:a7b:1b4:6e02:18ec:2]:22 dns_server=[fdaa::3]:53
  Machine created and started in 25.207s
  /rails/bin/docker-entrypoint: line 5: /rails/bin/rails: Permission denied
   INFO Main child exited normally with code: 126
   INFO Starting clean up.
   WARN could not unmount /rootfs: EINVAL: Invalid argument
  [    1.595856] reboot: Restarting system
  machine restart policy set to 'no', not restarting
-------
Error: release command failed - aborting deployment. error release_command machine 4d8913edc932e8 exited with non-zero status of 126

… and here’s the content of the toml file:

app = 'app_name'
primary_region = 'syd'
console_command = '/rails/bin/rails console'

[build]

[deploy]
  release_command = './bin/rails db:prepare'

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

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

[[statics]]
  guest_path = '/rails/public'
  url_prefix = '/'

Generally the following will fix that problem:

bin/rails generate dockerfile

If you would rather fix it yourself, these are the lines to be added to your Dockerfile:

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