Fix Railway deployment: Add nixpacks.toml and runtime.txt for Python app detection
This commit is contained in:
parent
68a58c3a59
commit
0e7c4d56f1
|
|
@ -0,0 +1,196 @@
|
||||||
|
# 🍎 TradingAgents App Store Submission Checklist
|
||||||
|
|
||||||
|
## 📋 Pre-Submission Checklist
|
||||||
|
|
||||||
|
### **Backend API Deployment** ✅
|
||||||
|
- [ ] Railway account created and project deployed
|
||||||
|
- [ ] Environment variables configured in Railway dashboard
|
||||||
|
- [ ] API accessible via HTTPS (required by Apple)
|
||||||
|
- [ ] All endpoints tested and working
|
||||||
|
- [ ] Production URL documented
|
||||||
|
|
||||||
|
### **iOS App Configuration** 📱
|
||||||
|
- [ ] AppConfig.swift updated with production Railway URL
|
||||||
|
- [ ] App tested with production API (not localhost)
|
||||||
|
- [ ] Network calls working with HTTPS
|
||||||
|
- [ ] Error handling tested (network timeouts, API errors)
|
||||||
|
- [ ] App works without debugging console
|
||||||
|
|
||||||
|
### **App Store Requirements** 🏪
|
||||||
|
- [ ] App version and build number incremented
|
||||||
|
- [ ] App bundle identifier is unique
|
||||||
|
- [ ] App icons in all required sizes (1024x1024 for App Store)
|
||||||
|
- [ ] Launch screen configured
|
||||||
|
- [ ] App category selected (Finance)
|
||||||
|
- [ ] Age rating appropriate (17+ for financial content)
|
||||||
|
|
||||||
|
### **Privacy and Legal** 🔒
|
||||||
|
- [ ] Privacy policy created and accessible
|
||||||
|
- [ ] Terms of service created
|
||||||
|
- [ ] App privacy report filled out in App Store Connect
|
||||||
|
- [ ] Data collection practices documented
|
||||||
|
- [ ] Third-party API usage disclosed (OpenAI, Finnhub, etc.)
|
||||||
|
|
||||||
|
### **Content and Marketing** 📝
|
||||||
|
- [ ] App name decided and available
|
||||||
|
- [ ] App description written (under 4000 characters)
|
||||||
|
- [ ] Keywords selected (under 100 characters)
|
||||||
|
- [ ] Screenshots taken for all device sizes
|
||||||
|
- [ ] App preview video created (optional but recommended)
|
||||||
|
|
||||||
|
## 🚀 Deployment Steps Summary
|
||||||
|
|
||||||
|
### **Phase 1: Railway Deployment**
|
||||||
|
```bash
|
||||||
|
# In backend directory
|
||||||
|
./deploy-to-railway.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
1. **Deploy to Railway:**
|
||||||
|
- Go to https://railway.app
|
||||||
|
- Connect GitHub repository
|
||||||
|
- Add environment variables
|
||||||
|
- Get production URL
|
||||||
|
|
||||||
|
2. **Update iOS App:**
|
||||||
|
```swift
|
||||||
|
// In AppConfig.swift, update production URL:
|
||||||
|
return "https://your-actual-railway-url.up.railway.app"
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Test Everything:**
|
||||||
|
- API health check: `https://your-app.railway.app/health`
|
||||||
|
- iOS app with production API
|
||||||
|
- Full analysis flow end-to-end
|
||||||
|
|
||||||
|
### **Phase 2: App Store Submission**
|
||||||
|
|
||||||
|
1. **Prepare in Xcode:**
|
||||||
|
- Archive for App Store distribution
|
||||||
|
- Upload to App Store Connect
|
||||||
|
- Fill out app information
|
||||||
|
|
||||||
|
2. **Submit for Review:**
|
||||||
|
- Complete metadata
|
||||||
|
- Upload screenshots
|
||||||
|
- Submit for review
|
||||||
|
|
||||||
|
## 📊 Expected Timelines
|
||||||
|
|
||||||
|
| Task | Duration | Notes |
|
||||||
|
|------|----------|-------|
|
||||||
|
| Railway Deployment | 5-10 minutes | Automatic build and deploy |
|
||||||
|
| iOS App Updates | 10-15 minutes | URL change and testing |
|
||||||
|
| App Store Metadata | 1-2 hours | Screenshots, descriptions, etc. |
|
||||||
|
| App Review Process | 1-7 days | Apple's review timeline |
|
||||||
|
|
||||||
|
## 🔧 Technical Requirements
|
||||||
|
|
||||||
|
### **API Requirements**
|
||||||
|
- ✅ HTTPS mandatory (Railway provides automatically)
|
||||||
|
- ✅ Stable uptime (Railway handles auto-restart)
|
||||||
|
- ✅ Response time < 30 seconds for health checks
|
||||||
|
- ✅ Proper error handling and status codes
|
||||||
|
|
||||||
|
### **iOS App Requirements**
|
||||||
|
- ✅ iOS 15.0+ minimum deployment target
|
||||||
|
- ✅ Swift 5.5+ with SwiftUI
|
||||||
|
- ✅ Proper network security (HTTPS only)
|
||||||
|
- ✅ Privacy compliance (data handling disclosure)
|
||||||
|
|
||||||
|
## 🚨 Common Rejection Reasons (and How to Avoid)
|
||||||
|
|
||||||
|
### **Network/API Issues**
|
||||||
|
- ❌ **App doesn't work**: Ensure production API is stable
|
||||||
|
- ❌ **Network errors**: Test with poor network conditions
|
||||||
|
- ❌ **HTTPS required**: Use Railway (provides HTTPS automatically)
|
||||||
|
|
||||||
|
### **Content Issues**
|
||||||
|
- ❌ **Financial advice disclaimer**: Add disclaimer about not being financial advice
|
||||||
|
- ❌ **Data accuracy**: Mention data is for informational purposes only
|
||||||
|
- ❌ **Real-time data**: Clarify data may be delayed
|
||||||
|
|
||||||
|
### **Privacy Issues**
|
||||||
|
- ❌ **Missing privacy policy**: Create and link privacy policy
|
||||||
|
- ❌ **Data collection not disclosed**: Document all API data usage
|
||||||
|
- ❌ **Third-party services**: Disclose OpenAI, Finnhub usage
|
||||||
|
|
||||||
|
## 📱 Testing Checklist
|
||||||
|
|
||||||
|
### **Functional Testing**
|
||||||
|
- [ ] App launches successfully
|
||||||
|
- [ ] Can enter ticker symbols
|
||||||
|
- [ ] Analysis starts and completes
|
||||||
|
- [ ] Results display correctly
|
||||||
|
- [ ] History saves and loads
|
||||||
|
- [ ] Error states handled gracefully
|
||||||
|
|
||||||
|
### **Network Testing**
|
||||||
|
- [ ] Works on WiFi
|
||||||
|
- [ ] Works on cellular data
|
||||||
|
- [ ] Handles network timeouts
|
||||||
|
- [ ] Handles server errors (500, 503, etc.)
|
||||||
|
- [ ] Handles invalid ticker symbols
|
||||||
|
|
||||||
|
### **Device Testing**
|
||||||
|
- [ ] iPhone (various sizes)
|
||||||
|
- [ ] iPad (if universal app)
|
||||||
|
- [ ] Different iOS versions
|
||||||
|
- [ ] Light and dark mode
|
||||||
|
- [ ] Accessibility features
|
||||||
|
|
||||||
|
## 📄 Required Legal Documents
|
||||||
|
|
||||||
|
### **Privacy Policy Template**
|
||||||
|
```
|
||||||
|
This app collects the following data:
|
||||||
|
- Stock ticker symbols you search
|
||||||
|
- Analysis results for your reference
|
||||||
|
- App usage analytics (if implemented)
|
||||||
|
|
||||||
|
Data is processed by:
|
||||||
|
- OpenAI (for AI analysis)
|
||||||
|
- Finnhub (for market data)
|
||||||
|
- [Your Railway server] (for processing)
|
||||||
|
|
||||||
|
Data is not sold or shared with third parties for marketing.
|
||||||
|
```
|
||||||
|
|
||||||
|
### **Terms of Service Key Points**
|
||||||
|
- App provides educational/informational content only
|
||||||
|
- Not financial advice
|
||||||
|
- User responsible for investment decisions
|
||||||
|
- Data accuracy not guaranteed
|
||||||
|
- Service availability not guaranteed
|
||||||
|
|
||||||
|
## ✅ Final Pre-Submission Check
|
||||||
|
|
||||||
|
- [ ] **Production API is live and stable**
|
||||||
|
- [ ] **iOS app works with production API**
|
||||||
|
- [ ] **All screenshots and metadata ready**
|
||||||
|
- [ ] **Privacy policy and terms accessible**
|
||||||
|
- [ ] **App tested on real device (not just simulator)**
|
||||||
|
- [ ] **No debugging code or console logs in release build**
|
||||||
|
- [ ] **App Store Connect information complete**
|
||||||
|
|
||||||
|
## 🎉 Post-Approval Tasks
|
||||||
|
|
||||||
|
### **After App Store Approval:**
|
||||||
|
- [ ] Monitor Railway usage and costs
|
||||||
|
- [ ] Set up monitoring/alerts for API downtime
|
||||||
|
- [ ] Plan for scaling if app becomes popular
|
||||||
|
- [ ] Consider migration to VPS for cost optimization
|
||||||
|
|
||||||
|
### **Marketing and Growth:**
|
||||||
|
- [ ] Social media announcement
|
||||||
|
- [ ] Product Hunt launch (optional)
|
||||||
|
- [ ] User feedback collection
|
||||||
|
- [ ] App Store optimization (ASO)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**🚀 Good luck with your App Store submission!**
|
||||||
|
|
||||||
|
For technical support during deployment, see:
|
||||||
|
- `backend/DEPLOYMENT_GUIDE.md` - Detailed deployment instructions
|
||||||
|
- `backend/deploy-to-railway.sh` - Automated deployment script
|
||||||
Binary file not shown.
|
|
@ -18,8 +18,9 @@ enum AppConfig {
|
||||||
return "http://10.73.204.80:8000"
|
return "http://10.73.204.80:8000"
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
// For production, update this to your deployed server URL
|
// Production URL - update this with your Railway deployment URL
|
||||||
return "https://api.tradingagents.com"
|
// Example: "https://tradingagents-production.up.railway.app"
|
||||||
|
return "https://your-app.railway.app" // ⚠️ UPDATE THIS AFTER RAILWAY DEPLOYMENT
|
||||||
#endif
|
#endif
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,8 @@ Railway provides the quickest path to production with automatic HTTPS - perfect
|
||||||
4. **Select your TradingAgents repository**
|
4. **Select your TradingAgents repository**
|
||||||
5. **Railway will auto-detect** the Python app and start building
|
5. **Railway will auto-detect** the Python app and start building
|
||||||
|
|
||||||
|
> **Note**: The repository includes special configuration files (`nixpacks.toml`, `runtime.txt`) to help Railway detect the Python app in the `backend/` directory.
|
||||||
|
|
||||||
### **Step 3: Configure Environment Variables**
|
### **Step 3: Configure Environment Variables**
|
||||||
|
|
||||||
In the Railway dashboard:
|
In the Railway dashboard:
|
||||||
|
|
@ -65,6 +67,35 @@ curl -X POST https://your-app.railway.app/analyze \
|
||||||
-d '{"ticker": "AAPL"}'
|
-d '{"ticker": "AAPL"}'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 🔧 **Troubleshooting Railway Deployment**
|
||||||
|
|
||||||
|
### **Build Detection Issues**
|
||||||
|
|
||||||
|
If Railway says "Nixpacks was unable to generate a build plan":
|
||||||
|
|
||||||
|
1. **Check root directory files**: Ensure these files exist in your root directory:
|
||||||
|
- `nixpacks.toml` ✅ (helps Railway detect Python app)
|
||||||
|
- `runtime.txt` ✅ (specifies Python version)
|
||||||
|
- `requirements.txt` ✅ (copied from backend/)
|
||||||
|
|
||||||
|
2. **Force redeploy**: In Railway dashboard, click "Redeploy"
|
||||||
|
|
||||||
|
3. **Check logs**: Look at build logs for specific error messages
|
||||||
|
|
||||||
|
### **Build Failures**
|
||||||
|
|
||||||
|
If the build fails:
|
||||||
|
- Check that all dependencies in `requirements.txt` are valid
|
||||||
|
- Ensure Python version compatibility (we use Python 3.11)
|
||||||
|
- Check Railway build logs for specific error messages
|
||||||
|
|
||||||
|
### **Runtime Errors**
|
||||||
|
|
||||||
|
If the app builds but doesn't start:
|
||||||
|
- Verify environment variables are set correctly
|
||||||
|
- Check Railway deployment logs
|
||||||
|
- Ensure the start command is correct: `cd backend && uvicorn api:app --host 0.0.0.0 --port $PORT`
|
||||||
|
|
||||||
## 📱 Update iOS App for Production
|
## 📱 Update iOS App for Production
|
||||||
|
|
||||||
### **Step 1: Update API Configuration**
|
### **Step 1: Update API Configuration**
|
||||||
|
|
@ -123,6 +154,7 @@ Railway automatically handles:
|
||||||
1. **Build failures:**
|
1. **Build failures:**
|
||||||
- Check requirements.txt is valid
|
- Check requirements.txt is valid
|
||||||
- Ensure Python version compatibility
|
- Ensure Python version compatibility
|
||||||
|
- Look for missing root-level configuration files
|
||||||
|
|
||||||
2. **Runtime errors:**
|
2. **Runtime errors:**
|
||||||
- Verify all environment variables are set
|
- Verify all environment variables are set
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
web: uvicorn api:app --host 0.0.0.0 --port $PORT --workers 1
|
web: cd backend && uvicorn api:app --host 0.0.0.0 --port $PORT --workers 1
|
||||||
|
|
@ -2,17 +2,18 @@
|
||||||
"$schema": "https://railway.app/railway.schema.json",
|
"$schema": "https://railway.app/railway.schema.json",
|
||||||
"build": {
|
"build": {
|
||||||
"builder": "nixpacks",
|
"builder": "nixpacks",
|
||||||
"buildCommand": "pip install -r requirements.txt"
|
"buildCommand": "cd backend && pip install -r requirements.txt",
|
||||||
|
"watchPatterns": ["backend/**"]
|
||||||
},
|
},
|
||||||
"deploy": {
|
"deploy": {
|
||||||
"startCommand": "uvicorn api:app --host 0.0.0.0 --port $PORT",
|
"startCommand": "cd backend && uvicorn api:app --host 0.0.0.0 --port $PORT",
|
||||||
"restartPolicyType": "on_failure",
|
"restartPolicyType": "on_failure",
|
||||||
"restartPolicyMaxRetries": 3
|
"restartPolicyMaxRetries": 3
|
||||||
},
|
},
|
||||||
"environments": {
|
"environments": {
|
||||||
"production": {
|
"production": {
|
||||||
"variables": {
|
"variables": {
|
||||||
"PYTHONPATH": "/app",
|
"PYTHONPATH": "/app/backend",
|
||||||
"TRADINGAGENTS_API_HOST": "0.0.0.0",
|
"TRADINGAGENTS_API_HOST": "0.0.0.0",
|
||||||
"TRADINGAGENTS_API_PORT": "$PORT"
|
"TRADINGAGENTS_API_PORT": "$PORT"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
[options]
|
||||||
|
# Tell Nixpacks this is a Python app
|
||||||
|
providers = ["python"]
|
||||||
|
|
||||||
|
[variables]
|
||||||
|
# Set working directory to backend
|
||||||
|
NIXPACKS_BUILD_CMD = "cd backend && pip install -r requirements.txt"
|
||||||
|
NIXPACKS_START_CMD = "cd backend && uvicorn api:app --host 0.0.0.0 --port $PORT"
|
||||||
|
|
||||||
|
[phases.setup]
|
||||||
|
dependsOn = []
|
||||||
|
|
||||||
|
[phases.install]
|
||||||
|
dependsOn = ["setup"]
|
||||||
|
cmds = [
|
||||||
|
"cd backend",
|
||||||
|
"pip install -r requirements.txt"
|
||||||
|
]
|
||||||
|
|
||||||
|
[phases.build]
|
||||||
|
dependsOn = ["install"]
|
||||||
|
|
||||||
|
[phases.start]
|
||||||
|
cmd = "cd backend && uvicorn api:app --host 0.0.0.0 --port $PORT"
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
typing-extensions
|
||||||
|
langchain-openai
|
||||||
|
langchain-experimental
|
||||||
|
pandas
|
||||||
|
yfinance
|
||||||
|
praw
|
||||||
|
feedparser
|
||||||
|
stockstats
|
||||||
|
eodhd
|
||||||
|
langgraph
|
||||||
|
chromadb
|
||||||
|
setuptools
|
||||||
|
backtrader
|
||||||
|
akshare
|
||||||
|
tushare
|
||||||
|
finnhub-python
|
||||||
|
parsel
|
||||||
|
requests
|
||||||
|
tqdm
|
||||||
|
pytz
|
||||||
|
redis
|
||||||
|
chainlit
|
||||||
|
rich
|
||||||
|
questionary
|
||||||
|
langchain_anthropic
|
||||||
|
langchain-google-genai
|
||||||
|
fastapi
|
||||||
|
pydantic
|
||||||
|
uvicorn[standard]
|
||||||
|
python-dotenv
|
||||||
|
google-search-results
|
||||||
|
serpapi
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
python-3.11
|
||||||
Loading…
Reference in New Issue