14 days ago
I'm experiencing a deployment issue where my application builds successfully but doesn't auto-start after deployment. The app only starts after a manual restart through the Railway dashboard.
Issue Details:
Project ID:
Service: petite-shelf (production)
Framework: Python FastAPI application
Start Command:
python app.py
Symptoms:
Git push triggers build successfully (build logs show completion)
Deployment shows "Active" but no deployment logs appear
Message shows: "No deployment logs. All output sent to stdout will be displayed here"
Manual restart through dashboard immediately fixes the issue
App runs perfectly after manual restart
Timeline:
App deployed successfully for 20+ days
Issues started ~June 28-30 when we added:
Cron job configuration in railway.json
Historical data re-analysis features
No issues with local development
What We've Tried:
Added print statements at top of app.py - work after manual restart
Removed Procfile to avoid config conflicts
Verified railway.json syntax
Tested with minimal Python script - same behavior
Checked for syntax errors - none found
Build succeeds with all dependencies installed
Current railway.json:
{
"build": {
"builder": "NIXPACKS"
},
"deploy": {
"startCommand": "python app.py",
"restartPolicyType": "ON_FAILURE",
"restartPolicyMaxRetries": 10
},
"cron": [
{
"name": "daily-analysis",
"schedule": "30 10 * * 1-5",
"command": "python trigger_analysis.py"
}
]
}
Questions:
Are there any known issues with cron jobs affecting deployment auto-start?
Is there a race condition between the cron configuration and main app startup?
Should we add a health check endpoint to help Railway determine readiness?
Are there any recent platform changes that might affect Python app startup?
The app works perfectly once manually restarted, suggesting the code is fine but something in the deployment pipeline isn't triggering the initial start correctly.
Any guidance would be greatly appreciated.
Thank you
5 Replies
ctbo3
can I undo the "solved" command? It was clicked accidentally?
14 days ago
umm.. Isn't that obvious or am i not getting it ?
You added a cron schedule to have the app run once everyday from Monday to Friday at 10:30AM, so the app is going to start at 10:30AM
Why would you think it should start immediately ?
smolpaw
umm.. Isn't that obvious or am i not getting it ?You added a cron schedule to have the app run once everyday from Monday to Friday at 10:30AM, so the app is going to start at 10:30AMWhy would you think it should start immediately ?
14 days ago
I think you are saying that cron job is default to "ONLY" run at: (time). Am I following you? So any pushes are held up until that time. Is there a setting for "AND" run at: (time)? So jobs run at set time and manual deployments also run?
ctbo3
I think you are saying that cron job is default to "ONLY" run at: (time). Am I following you? So any pushes are held up until that time. Is there a setting for "AND" run at: (time)? So jobs run at set time and manual deployments also run?
14 days ago
There is no such settings as far as I am aware. You have to achieve that behavior by creating 2 different apps, 1 with cron and 1 without both being deployed from your repo.
If some state needs to stay in sync between 2 applications then you will have to achieve that by using an external state management application like a db.
smolpaw
There is no such settings as far as I am aware. You have to achieve that behavior by creating 2 different apps, 1 with cron and 1 without both being deployed from your repo.If some state needs to stay in sync between 2 applications then you will have to achieve that by using an external state management application like a db.
14 days ago
Thanks. The issue is that Cron Jobs was intended to be applied to the app and not the entire service. I think I can fix it from here.
Status changed to Solved chandrika • 14 days ago