Timeout

Hi all - I get the below error message and I’m unable to fix it (i have a grace period of 60s). Any ideas? fly.toml and gemfile below.

Error: timeout reached waiting for healthchecks to pass for machine

I tried running fly logs and the following comes up but I don’t see a problem when I run the app locally.

Is the server running locally and accepting connections on that socket?

2024-11-12T08:27:09Z app[2875747b6617d8] atl [info]Caused by:

2024-11-12T08:27:09Z app[2875747b6617d8] atl [info]PG::ConnectionBad: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory (PG::ConnectionBad)

2024-11-12T08:27:09Z app[2875747b6617d8] atl [info] Is the server running locally and accepting connections on that socket?
app = "appname"
primary_region = "atl"
console_command = "/rails/bin/rails console"
swap_size_mb = 1024

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

[checks]
  [checks.status]
    port = 3000
    type = "http"
    interval = "15s"
    timeout = "2s"
    grace_period = "60s"
    method = "GET"
    path = "/up"
    protocol = "http"

[[statics]]
  guest_path = "/rails/public"
  url_prefix = "/"
source "https://rubygems.org"

# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 7.2.1", ">= 7.2.1.2"
# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem "sprockets-rails"
# Use postgresql as the database for Active Record
gem "pg", "~> 1.1"
# Use the Puma web server [https://github.com/puma/puma]
gem "puma", ">= 5.0"
# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
gem "importmap-rails"
# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
gem "turbo-rails"
# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
gem "stimulus-rails"
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
gem "jbuilder"
# Use Redis adapter to run Action Cable in production
# gem "redis", ">= 4.0.1"

# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
# gem "kredis"

# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
# gem "bcrypt", "~> 3.1.7"

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: %i[ windows jruby ]

# Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", require: false

# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
# gem "image_processing", "~> 1.2"

gem "bootstrap", "~> 5.2"
gem "devise"
gem "autoprefixer-rails"
gem "font-awesome-sass", "~> 6.1"
gem "simple_form", github: "heartcombo/simple_form"
gem "sassc-rails"

group :development, :test do
  gem "dotenv-rails"
  # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
  gem "debug", platforms: %i[ mri windows ], require: "debug/prelude"

  # Static analysis for security vulnerabilities [https://brakemanscanner.org/]
  gem "brakeman", require: false

  # Omakase Ruby styling [https://github.com/rails/rubocop-rails-omakase/]
  gem "rubocop-rails-omakase", require: false
end

group :development do
  # Use console on exceptions pages [https://github.com/rails/web-console]
  gem "web-console"
end

group :test do
  # Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
  gem "capybara"
  gem "selenium-webdriver"
end

gem "dockerfile-rails", ">= 1.6", :group => :development

Anyone?
I’ve tried fly deploy --wait-timeout=300 but it doesn’t fix the issue.

It seems your app isn’t starting because it can’t connect to PostgreSQL. Locally it connects through something called a “UNIX socket” - a local-only kind of connection.

You will need a PostgreSQL database - you can run one on fly.io, or configure an external one.

The “Rails on Fly.io” guide suggests fly launch should offer creating a PostgreSQL cluster for you (well, a single node tiny cluster :-)): Active Record · Fly Docs.

I think the issue is that I’m using an old version of flyctl (I’m unable to upgrade as my Mac uses 10.15 OS and I’m unable to upgrade the OS because of storage issues). Is there a way round this problem?
The app already has a PostgreSQL DB but there are issues when deploying.

You need to tell your app where to connect to. I don’t know Rails, so I can’t really help with that part.

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