Spaces:
Sleeping
Sleeping
Commit Β·
d7be59f
1
Parent(s): 6906333
π Add Docker & cloud deployment configuration (Railway, Render)
Browse files- .dockerignore +55 -0
- DEPLOYMENT.md +250 -0
- Dockerfile +40 -0
- Procfile +1 -0
- README.md +27 -0
- docker-compose.yml +32 -0
- railway.json +14 -0
- render.yaml +20 -0
- runtime.txt +1 -0
.dockerignore
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Git
|
| 2 |
+
.git
|
| 3 |
+
.gitignore
|
| 4 |
+
|
| 5 |
+
# Python
|
| 6 |
+
__pycache__
|
| 7 |
+
*.py[cod]
|
| 8 |
+
*$py.class
|
| 9 |
+
*.so
|
| 10 |
+
.Python
|
| 11 |
+
*.egg-info
|
| 12 |
+
dist
|
| 13 |
+
build
|
| 14 |
+
*.egg
|
| 15 |
+
|
| 16 |
+
# Virtual Environment
|
| 17 |
+
venv
|
| 18 |
+
env
|
| 19 |
+
ENV
|
| 20 |
+
|
| 21 |
+
# Environment files (use docker env vars instead)
|
| 22 |
+
.env
|
| 23 |
+
.env.local
|
| 24 |
+
.env.*.local
|
| 25 |
+
|
| 26 |
+
# IDE
|
| 27 |
+
.vscode
|
| 28 |
+
.idea
|
| 29 |
+
*.swp
|
| 30 |
+
*.swo
|
| 31 |
+
|
| 32 |
+
# OS
|
| 33 |
+
.DS_Store
|
| 34 |
+
Thumbs.db
|
| 35 |
+
|
| 36 |
+
# Logs
|
| 37 |
+
*.log
|
| 38 |
+
|
| 39 |
+
# Cache
|
| 40 |
+
.cache
|
| 41 |
+
.pytest_cache
|
| 42 |
+
.mypy_cache
|
| 43 |
+
|
| 44 |
+
# Uploads (will be created at runtime)
|
| 45 |
+
uploads/*
|
| 46 |
+
!uploads/.gitkeep
|
| 47 |
+
|
| 48 |
+
# Documentation (not needed in container)
|
| 49 |
+
*.md
|
| 50 |
+
!README.md
|
| 51 |
+
LICENSE
|
| 52 |
+
|
| 53 |
+
# Development files
|
| 54 |
+
requirements-dev.txt
|
| 55 |
+
test_*.py
|
DEPLOYMENT.md
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# π Deployment Guide
|
| 2 |
+
|
| 3 |
+
This guide covers multiple deployment options for PaperBOT.
|
| 4 |
+
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
## π Prerequisites
|
| 8 |
+
|
| 9 |
+
Before deploying, ensure you have:
|
| 10 |
+
- β
Pinecone API key (index: `paperbot`, dimensions: `1024`)
|
| 11 |
+
- β
Google AI API key (Gemini)
|
| 12 |
+
- β
(Optional) HuggingFace token
|
| 13 |
+
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
## π³ Option 1: Docker (Recommended)
|
| 17 |
+
|
| 18 |
+
Docker provides the most consistent deployment across any environment.
|
| 19 |
+
|
| 20 |
+
### Local Docker Deployment
|
| 21 |
+
|
| 22 |
+
```bash
|
| 23 |
+
# 1. Build the image
|
| 24 |
+
docker build -t paperbot .
|
| 25 |
+
|
| 26 |
+
# 2. Run the container
|
| 27 |
+
docker run -d \
|
| 28 |
+
--name paperbot \
|
| 29 |
+
-p 8000:8000 \
|
| 30 |
+
-e PINECONE_API_KEY=your_pinecone_key \
|
| 31 |
+
-e GOOGLE_API_KEY=your_google_key \
|
| 32 |
+
paperbot
|
| 33 |
+
|
| 34 |
+
# 3. Access at http://localhost:8000
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
### Docker Compose (Easier)
|
| 38 |
+
|
| 39 |
+
```bash
|
| 40 |
+
# 1. Create .env file with your API keys
|
| 41 |
+
cp .env.example .env
|
| 42 |
+
# Edit .env with your actual keys
|
| 43 |
+
|
| 44 |
+
# 2. Start the application
|
| 45 |
+
docker-compose up -d
|
| 46 |
+
|
| 47 |
+
# 3. View logs
|
| 48 |
+
docker-compose logs -f
|
| 49 |
+
|
| 50 |
+
# 4. Stop the application
|
| 51 |
+
docker-compose down
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
---
|
| 55 |
+
|
| 56 |
+
## π Option 2: Railway (Free Tier)
|
| 57 |
+
|
| 58 |
+
Railway offers easy deployment with a generous free tier.
|
| 59 |
+
|
| 60 |
+
### Steps
|
| 61 |
+
|
| 62 |
+
1. **Create Railway Account**
|
| 63 |
+
- Go to [railway.app](https://railway.app)
|
| 64 |
+
- Sign up with GitHub
|
| 65 |
+
|
| 66 |
+
2. **Deploy from GitHub**
|
| 67 |
+
- Click "New Project" β "Deploy from GitHub repo"
|
| 68 |
+
- Select your `PaperBOT` repository
|
| 69 |
+
- Railway auto-detects Dockerfile
|
| 70 |
+
|
| 71 |
+
3. **Set Environment Variables**
|
| 72 |
+
- Go to your project β "Variables"
|
| 73 |
+
- Add:
|
| 74 |
+
```
|
| 75 |
+
PINECONE_API_KEY=your_key
|
| 76 |
+
GOOGLE_API_KEY=your_key
|
| 77 |
+
HF_TOKEN=your_token (optional)
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
4. **Generate Domain**
|
| 81 |
+
- Go to "Settings" β "Networking"
|
| 82 |
+
- Click "Generate Domain"
|
| 83 |
+
- Your app is live! π
|
| 84 |
+
|
| 85 |
+
### Railway Pricing
|
| 86 |
+
- **Free Tier**: $5/month credit (enough for light usage)
|
| 87 |
+
- **Hobby**: $5/month for 8GB RAM, 8 vCPU
|
| 88 |
+
|
| 89 |
+
---
|
| 90 |
+
|
| 91 |
+
## π¨ Option 3: Render (Free Tier)
|
| 92 |
+
|
| 93 |
+
Render provides simple deployment with auto-scaling.
|
| 94 |
+
|
| 95 |
+
### Steps
|
| 96 |
+
|
| 97 |
+
1. **Create Render Account**
|
| 98 |
+
- Go to [render.com](https://render.com)
|
| 99 |
+
- Sign up with GitHub
|
| 100 |
+
|
| 101 |
+
2. **Deploy Web Service**
|
| 102 |
+
- Click "New +" β "Web Service"
|
| 103 |
+
- Connect your GitHub repo
|
| 104 |
+
- Select "Docker" as runtime
|
| 105 |
+
- Choose "Free" plan
|
| 106 |
+
|
| 107 |
+
3. **Configure Environment**
|
| 108 |
+
- Add environment variables:
|
| 109 |
+
```
|
| 110 |
+
PINECONE_API_KEY=your_key
|
| 111 |
+
GOOGLE_API_KEY=your_key
|
| 112 |
+
```
|
| 113 |
+
|
| 114 |
+
4. **Deploy**
|
| 115 |
+
- Click "Create Web Service"
|
| 116 |
+
- Wait 5-10 minutes for first build
|
| 117 |
+
|
| 118 |
+
### Render Pricing
|
| 119 |
+
- **Free Tier**: 750 hours/month, sleeps after 15 min inactivity
|
| 120 |
+
- **Starter**: $7/month for always-on
|
| 121 |
+
|
| 122 |
+
---
|
| 123 |
+
|
| 124 |
+
## βοΈ Option 4: Cloud VPS (Full Control)
|
| 125 |
+
|
| 126 |
+
For production with full control, use a VPS.
|
| 127 |
+
|
| 128 |
+
### DigitalOcean / Linode / Vultr
|
| 129 |
+
|
| 130 |
+
```bash
|
| 131 |
+
# 1. Create a VPS (Ubuntu 22.04, 2GB RAM minimum)
|
| 132 |
+
|
| 133 |
+
# 2. SSH into server
|
| 134 |
+
ssh root@your-server-ip
|
| 135 |
+
|
| 136 |
+
# 3. Install Docker
|
| 137 |
+
curl -fsSL https://get.docker.com | sh
|
| 138 |
+
|
| 139 |
+
# 4. Clone repository
|
| 140 |
+
git clone https://github.com/vikash-48413/PaperBOT.git
|
| 141 |
+
cd PaperBOT
|
| 142 |
+
|
| 143 |
+
# 5. Create environment file
|
| 144 |
+
cp .env.example .env
|
| 145 |
+
nano .env # Add your API keys
|
| 146 |
+
|
| 147 |
+
# 6. Start with Docker Compose
|
| 148 |
+
docker-compose up -d
|
| 149 |
+
|
| 150 |
+
# 7. (Optional) Setup Nginx reverse proxy with SSL
|
| 151 |
+
apt install nginx certbot python3-certbot-nginx
|
| 152 |
+
```
|
| 153 |
+
|
| 154 |
+
### Nginx Configuration
|
| 155 |
+
|
| 156 |
+
```nginx
|
| 157 |
+
server {
|
| 158 |
+
listen 80;
|
| 159 |
+
server_name your-domain.com;
|
| 160 |
+
|
| 161 |
+
location / {
|
| 162 |
+
proxy_pass http://localhost:8000;
|
| 163 |
+
proxy_http_version 1.1;
|
| 164 |
+
proxy_set_header Upgrade $http_upgrade;
|
| 165 |
+
proxy_set_header Connection 'upgrade';
|
| 166 |
+
proxy_set_header Host $host;
|
| 167 |
+
proxy_set_header X-Real-IP $remote_addr;
|
| 168 |
+
proxy_read_timeout 300s;
|
| 169 |
+
client_max_body_size 20M;
|
| 170 |
+
}
|
| 171 |
+
}
|
| 172 |
+
```
|
| 173 |
+
|
| 174 |
+
---
|
| 175 |
+
|
| 176 |
+
## π§ Configuration for Production
|
| 177 |
+
|
| 178 |
+
### Modify app.py for Production
|
| 179 |
+
|
| 180 |
+
The app already binds to `0.0.0.0:8000`, which works for containers.
|
| 181 |
+
|
| 182 |
+
### Memory Considerations
|
| 183 |
+
|
| 184 |
+
The embedding model requires ~2GB RAM. Ensure your deployment has:
|
| 185 |
+
- **Minimum**: 2GB RAM
|
| 186 |
+
- **Recommended**: 4GB RAM
|
| 187 |
+
|
| 188 |
+
### File Upload Storage
|
| 189 |
+
|
| 190 |
+
- Uploaded files are stored in `/app/uploads/`
|
| 191 |
+
- For persistent storage, mount a volume (see docker-compose.yml)
|
| 192 |
+
- Consider using cloud storage (S3, GCS) for production
|
| 193 |
+
|
| 194 |
+
---
|
| 195 |
+
|
| 196 |
+
## π Health Checks
|
| 197 |
+
|
| 198 |
+
The app exposes `/model_status` for health checks:
|
| 199 |
+
|
| 200 |
+
```bash
|
| 201 |
+
curl http://your-domain.com/model_status
|
| 202 |
+
# Returns: {"status": "ready", "model_loaded": true}
|
| 203 |
+
```
|
| 204 |
+
|
| 205 |
+
---
|
| 206 |
+
|
| 207 |
+
## π Troubleshooting
|
| 208 |
+
|
| 209 |
+
### Container won't start
|
| 210 |
+
- Check logs: `docker logs paperbot`
|
| 211 |
+
- Ensure environment variables are set
|
| 212 |
+
- Verify Pinecone index exists
|
| 213 |
+
|
| 214 |
+
### Out of memory
|
| 215 |
+
- The embedding model needs 2GB+ RAM
|
| 216 |
+
- Use swap if needed: `fallocate -l 2G /swapfile`
|
| 217 |
+
- Consider the "fast" model for less memory usage
|
| 218 |
+
|
| 219 |
+
### Slow first request
|
| 220 |
+
- Normal! The model warms up on first load
|
| 221 |
+
- Takes 30-60 seconds initially
|
| 222 |
+
|
| 223 |
+
---
|
| 224 |
+
|
| 225 |
+
## π Deployment Comparison
|
| 226 |
+
|
| 227 |
+
| Platform | Free Tier | Min RAM | Auto Deploy | Custom Domain | SSL |
|
| 228 |
+
|----------|-----------|---------|-------------|---------------|-----|
|
| 229 |
+
| Railway | $5 credit | 512MB | β
| β
| οΏ½οΏ½ |
|
| 230 |
+
| Render | 750 hrs | 512MB | β
| β
| β
|
|
| 231 |
+
| Fly.io | 3 VMs | 256MB | β
| β
| β
|
|
| 232 |
+
| DigitalOcean | - | 1GB | Manual | β
| Manual |
|
| 233 |
+
| Docker Local | - | 2GB | - | - | - |
|
| 234 |
+
|
| 235 |
+
---
|
| 236 |
+
|
| 237 |
+
## π― Recommendation
|
| 238 |
+
|
| 239 |
+
For your use case, I recommend:
|
| 240 |
+
|
| 241 |
+
1. **Just testing?** β Use Docker locally
|
| 242 |
+
2. **Free hosting?** β Use Railway (best free tier)
|
| 243 |
+
3. **Production?** β Use DigitalOcean + Docker + Nginx
|
| 244 |
+
4. **Enterprise?** β Use AWS/GCP with Kubernetes
|
| 245 |
+
|
| 246 |
+
---
|
| 247 |
+
|
| 248 |
+
<p align="center">
|
| 249 |
+
<b>Happy Deploying! π</b>
|
| 250 |
+
</p>
|
Dockerfile
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ================================
|
| 2 |
+
# PaperBOT - Production Dockerfile
|
| 3 |
+
# ================================
|
| 4 |
+
FROM python:3.11-slim
|
| 5 |
+
|
| 6 |
+
# Set environment variables
|
| 7 |
+
ENV PYTHONDONTWRITEBYTECODE=1 \
|
| 8 |
+
PYTHONUNBUFFERED=1 \
|
| 9 |
+
PIP_NO_CACHE_DIR=1 \
|
| 10 |
+
PIP_DISABLE_PIP_VERSION_CHECK=1
|
| 11 |
+
|
| 12 |
+
# Set working directory
|
| 13 |
+
WORKDIR /app
|
| 14 |
+
|
| 15 |
+
# Install system dependencies
|
| 16 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 17 |
+
build-essential \
|
| 18 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 19 |
+
|
| 20 |
+
# Copy requirements first (for Docker cache optimization)
|
| 21 |
+
COPY requirements.txt .
|
| 22 |
+
|
| 23 |
+
# Install Python dependencies
|
| 24 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 25 |
+
|
| 26 |
+
# Copy application code
|
| 27 |
+
COPY . .
|
| 28 |
+
|
| 29 |
+
# Create directories for uploads and data
|
| 30 |
+
RUN mkdir -p uploads data
|
| 31 |
+
|
| 32 |
+
# Expose port
|
| 33 |
+
EXPOSE 8000
|
| 34 |
+
|
| 35 |
+
# Health check
|
| 36 |
+
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
| 37 |
+
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/model_status')" || exit 1
|
| 38 |
+
|
| 39 |
+
# Run the application
|
| 40 |
+
CMD ["python", "app.py"]
|
Procfile
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
web: python app.py
|
README.md
CHANGED
|
@@ -357,6 +357,8 @@ PaperBOT/
|
|
| 357 |
βββ uploads/ # User uploads (gitignored)
|
| 358 |
βββ requirements.txt # Python dependencies
|
| 359 |
βββ .env.example # Environment template
|
|
|
|
|
|
|
| 360 |
βββ start.bat # Windows launcher
|
| 361 |
βββ start.sh # Linux/Mac launcher
|
| 362 |
βββ LICENSE # MIT License
|
|
@@ -364,6 +366,31 @@ PaperBOT/
|
|
| 364 |
|
| 365 |
---
|
| 366 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 367 |
## π§ͺ Testing
|
| 368 |
|
| 369 |
### Run System Tests
|
|
|
|
| 357 |
βββ uploads/ # User uploads (gitignored)
|
| 358 |
βββ requirements.txt # Python dependencies
|
| 359 |
βββ .env.example # Environment template
|
| 360 |
+
βββ Dockerfile # Docker container config
|
| 361 |
+
βββ docker-compose.yml # Docker Compose setup
|
| 362 |
βββ start.bat # Windows launcher
|
| 363 |
βββ start.sh # Linux/Mac launcher
|
| 364 |
βββ LICENSE # MIT License
|
|
|
|
| 366 |
|
| 367 |
---
|
| 368 |
|
| 369 |
+
## π Deployment
|
| 370 |
+
|
| 371 |
+
### Quick Deploy with Docker
|
| 372 |
+
|
| 373 |
+
```bash
|
| 374 |
+
# Build and run
|
| 375 |
+
docker build -t paperbot .
|
| 376 |
+
docker run -d -p 8000:8000 \
|
| 377 |
+
-e PINECONE_API_KEY=your_key \
|
| 378 |
+
-e GOOGLE_API_KEY=your_key \
|
| 379 |
+
paperbot
|
| 380 |
+
```
|
| 381 |
+
|
| 382 |
+
### Deploy to Cloud (Free Options)
|
| 383 |
+
|
| 384 |
+
| Platform | Command / Link | Free Tier |
|
| 385 |
+
|----------|----------------|-----------|
|
| 386 |
+
| **Railway** | [railway.app](https://railway.app) β Deploy from GitHub | $5/month credit |
|
| 387 |
+
| **Render** | [render.com](https://render.com) β New Web Service | 750 hrs/month |
|
| 388 |
+
| **Docker** | `docker-compose up -d` | Local only |
|
| 389 |
+
|
| 390 |
+
π **Full deployment guide**: See [DEPLOYMENT.md](DEPLOYMENT.md)
|
| 391 |
+
|
| 392 |
+
---
|
| 393 |
+
|
| 394 |
## π§ͺ Testing
|
| 395 |
|
| 396 |
### Run System Tests
|
docker-compose.yml
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ================================
|
| 2 |
+
# PaperBOT - Docker Compose
|
| 3 |
+
# ================================
|
| 4 |
+
# Usage:
|
| 5 |
+
# docker-compose up -d # Start in background
|
| 6 |
+
# docker-compose logs -f # View logs
|
| 7 |
+
# docker-compose down # Stop
|
| 8 |
+
|
| 9 |
+
version: '3.8'
|
| 10 |
+
|
| 11 |
+
services:
|
| 12 |
+
paperbot:
|
| 13 |
+
build: .
|
| 14 |
+
container_name: paperbot
|
| 15 |
+
ports:
|
| 16 |
+
- "8000:8000"
|
| 17 |
+
environment:
|
| 18 |
+
- PINECONE_API_KEY=${PINECONE_API_KEY}
|
| 19 |
+
- GOOGLE_API_KEY=${GOOGLE_API_KEY}
|
| 20 |
+
- HF_TOKEN=${HF_TOKEN:-}
|
| 21 |
+
volumes:
|
| 22 |
+
# Persist uploaded files (optional)
|
| 23 |
+
- ./uploads:/app/uploads
|
| 24 |
+
# Persist preloaded data
|
| 25 |
+
- ./data:/app/data
|
| 26 |
+
restart: unless-stopped
|
| 27 |
+
healthcheck:
|
| 28 |
+
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/model_status')"]
|
| 29 |
+
interval: 30s
|
| 30 |
+
timeout: 10s
|
| 31 |
+
retries: 3
|
| 32 |
+
start_period: 60s
|
railway.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"$schema": "https://railway.app/railway.schema.json",
|
| 3 |
+
"build": {
|
| 4 |
+
"builder": "DOCKERFILE",
|
| 5 |
+
"dockerfilePath": "Dockerfile"
|
| 6 |
+
},
|
| 7 |
+
"deploy": {
|
| 8 |
+
"startCommand": "python app.py",
|
| 9 |
+
"healthcheckPath": "/model_status",
|
| 10 |
+
"healthcheckTimeout": 60,
|
| 11 |
+
"restartPolicyType": "ON_FAILURE",
|
| 12 |
+
"restartPolicyMaxRetries": 3
|
| 13 |
+
}
|
| 14 |
+
}
|
render.yaml
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ================================
|
| 2 |
+
# Render.com Blueprint
|
| 3 |
+
# ================================
|
| 4 |
+
# Deploy: https://render.com/deploy
|
| 5 |
+
# Click "New +" β "Blueprint" β Connect this repo
|
| 6 |
+
|
| 7 |
+
services:
|
| 8 |
+
- type: web
|
| 9 |
+
name: paperbot
|
| 10 |
+
runtime: docker
|
| 11 |
+
dockerfilePath: ./Dockerfile
|
| 12 |
+
plan: free # or "starter" for $7/month with more resources
|
| 13 |
+
healthCheckPath: /model_status
|
| 14 |
+
envVars:
|
| 15 |
+
- key: PINECONE_API_KEY
|
| 16 |
+
sync: false # Set manually in dashboard
|
| 17 |
+
- key: GOOGLE_API_KEY
|
| 18 |
+
sync: false # Set manually in dashboard
|
| 19 |
+
- key: HF_TOKEN
|
| 20 |
+
sync: false # Optional
|
runtime.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
python-3.11.7
|