a month ago
We recently deployed a Rails 8.1 app (Dockerized, Puma, PostgreSQL) and had trouble diagnosing deployment issues because we couldn't see any meaningful logs from our container.
The problem: Our Dockerfile defined the start command via CMD ["./bin/rails", "server", "-b", "0.0.0.0"]. When deploying, the container would get stuck at "Starting Container" with no application logs visible in the Railway dashboard. This made it very difficult to troubleshoot — we couldn't tell if the server was starting, crashing, or failing to connect to the database.
The fix: We moved the start command into a separate bash script (bin/start) and referenced it via startCommand in railway.toml:
```toml
[deploy]
startCommand = "./bin/start"
```
```bash
#!/usr/bin/env bash
set -x
./bin/rails s -b 0.0.0.0
```
Once we did this, logs started appearing in the Railway dashboard and we were able to diagnose and resolve our remaining issues.
Question: Is there a known issue with log output visibility when using the Dockerfile's CMD directive vs. startCommand in railway.toml? It seems like the same command behaves differently depending on how it's invoked, at least in terms of log forwarding. Any guidance on the recommended approach would be helpful.
1 Replies
a month ago
Can you provide a direct link to a deployment that was getting caught during the creating containers step?
Status changed to Awaiting User Response Railway • 27 days ago
20 days ago
This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!
Status changed to Solved Railway • 20 days ago