3 months ago
I'm having an issue with my Rails 8 application deployment on Railway. When I try to access the application either via my custom domain or the Railway-generated domain (with or without SSL), I'm getting a "404 - The train has not arrived at the station" error message.
What's strange is that I don't see any HTTP requests showing up in the HTTP logs section of the Railway dashboard, which makes me think the requests aren't even reaching my application container.
Here are the details of my setup:
1. The application is a Ruby on Rails 8.01 app with PostgreSQL database
2. I encountered a Thor::MalformattedArgumentError related to the PORT environment variable, which I resolved by hardcoding the port to 3000 in my Dockerfile and Procfile
3. My app properly references DATABASE_URL in config/database.yml
4. The deployment seems to complete successfully according to the logs
5. The healthcheck appears to fail repeatedly (the log shows "Attempt failed with service unavailable"), so presumably it also receives the same error that I do when trying to access it
PostgreSQL is configured as a separate service in Railway, from the standard template (as well as a service worker for SolidQueue)
Could this be related to a networking/routing problem? Something related to how Railway handles ports?
I'd appreciate any help on how to get this working!
-------
Deployment ID: 8f915fad-970a-4ce2-8f36-90177470e6f4
Deploy logs:
Starting Container
=> Booting Puma
=> Rails 8.0.1 application starting in development
=> Run bin/rails server --help
for more startup options
WARNING: Could not start PostgreSQL. Database operations may fail.
Puma starting in single mode...
* Puma version: 6.6.0 ("Return to Forever")
* Ruby version: ruby 3.3.6 (2024-11-05 revision 75015d4c1f) [x86_64-linux]
* Min threads: 5
* Max threads: 5
* Environment: development
* PID: 1
* Listening on http://0.0.0.0:3000
Use Ctrl-C to stop
4 Replies
3 months ago
startCommand = "bundle exec rails server -b 0.0.0.0 -p 3000"
If I run this locally on my machine, it starts, it just gives an "ActiveRecord::ConnectionNotEstablished" error page because of course I don't have a separate PostreSQL instance like on Railway. But it doesn't give any other errors.
3 months ago
Hello?
Have you checked your deploy logs? -
PG::ConnectionBad: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory (PG::ConnectionBad)
You need to connect to Postgres via its URL, not via a socket.
Status changed to Awaiting User Response railway[bot] • 4 months ago
3 months ago
Yeah, I fixed that. I have fixed the original issue now by specifying the port of the server in the networking settings of the Rails instance. Thanks!
Status changed to Awaiting Railway Response railway[bot] • 4 months ago
Status changed to Awaiting User Response railway[bot] • 4 months ago
Status changed to Solved brody • 4 months ago