Skip to content

Commit c3fd223

Browse files
committed
production scripts
1 parent d643eec commit c3fd223

File tree

6 files changed

+999
-0
lines changed

6 files changed

+999
-0
lines changed

DEPLOYMENT_GUIDE.md

Lines changed: 266 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,266 @@
1+
# Orin Production Deployment Guide
2+
3+
This guide will help you deploy your custom Orin service to production at `https://app.useorin.com` using Docker + Cloudflare Tunnel.
4+
5+
## 🎯 What We've Built
6+
7+
**Custom Orin Images** - Using your own Docker images instead of `luminainc`
8+
**GPU Support** - Automatic detection and configuration
9+
**CPU Fallback** - Optimized for VPS without GPU
10+
**Cloudflare Tunnel** - Secure, SSL-enabled access
11+
**Production Ready** - Proper scaling and resource management
12+
13+
## 📋 Prerequisites
14+
15+
1. **VPS Provider** (choose one):
16+
- DigitalOcean ($6/month droplet)
17+
- Linode ($5/month)
18+
- Vultr ($6/month)
19+
- AWS EC2 (t3.medium or larger)
20+
21+
2. **Domain**: `useorin.com` (you already own this)
22+
23+
3. **Cloudflare Account** (free tier)
24+
25+
## 🚀 Quick Deployment
26+
27+
### Step 1: Set Up Your VPS
28+
29+
1. **Create a VPS** with at least:
30+
- 2GB RAM (4GB recommended)
31+
- 2 vCPUs
32+
- 50GB storage
33+
- Ubuntu 22.04 LTS
34+
35+
2. **SSH into your VPS**:
36+
```bash
37+
ssh root@your-vps-ip
38+
```
39+
40+
### Step 2: Upload Your Code
41+
42+
1. **Clone your repository** on the VPS:
43+
```bash
44+
git clone https://github.com/your-username/data-extract.git
45+
cd data-extract
46+
```
47+
48+
2. **Or upload files manually** using `scp`:
49+
```bash
50+
scp -r /path/to/your/data-extract root@your-vps-ip:/root/
51+
```
52+
53+
### Step 3: Configure Your Environment
54+
55+
1. **Update your API keys** in `models.yaml`:
56+
```bash
57+
nano models.yaml
58+
```
59+
Replace placeholder values with your actual API keys.
60+
61+
2. **Create environment file**:
62+
```bash
63+
cp env.production.example .env
64+
nano .env
65+
```
66+
67+
### Step 4: Set Up Cloudflare Tunnel
68+
69+
1. **Go to Cloudflare Dashboard**`useorin.com`
70+
71+
2. **Navigate to Zero Trust** → Access → Tunnels
72+
73+
3. **Create a tunnel**:
74+
- Name: `orin-tunnel`
75+
- Save the tunnel token
76+
77+
4. **Update tunnel configuration**:
78+
```bash
79+
nano cloudflared-config.yaml
80+
```
81+
Replace `YOUR_TUNNEL_ID` with your actual tunnel ID.
82+
83+
### Step 5: Deploy
84+
85+
1. **Run the deployment script**:
86+
```bash
87+
chmod +x deploy-production.sh
88+
sudo ./deploy-production.sh
89+
```
90+
91+
2. **Authenticate Cloudflare Tunnel**:
92+
```bash
93+
cloudflared tunnel login
94+
```
95+
96+
3. **Start services**:
97+
```bash
98+
systemctl enable cloudflared-orin
99+
systemctl enable orin-app
100+
systemctl start cloudflared-orin
101+
systemctl start orin-app
102+
```
103+
104+
## 🔧 Configuration Details
105+
106+
### GPU vs CPU Configuration
107+
108+
The deployment script automatically detects GPU availability:
109+
110+
- **With GPU**: Uses `compose-production.yaml` with GPU optimizations
111+
- **Without GPU**: Uses `compose-production-cpu.yaml` with CPU optimizations
112+
113+
### Custom Images
114+
115+
Your deployment uses custom Orin images:
116+
- `orin/server:latest`
117+
- `orin/task:latest`
118+
- `orin/web:latest`
119+
120+
These are built from your custom codebase with Orin branding and modifications.
121+
122+
### Service URLs
123+
124+
After deployment, your services will be available at:
125+
- **Main App**: `https://app.useorin.com`
126+
- **API**: `https://api.app.useorin.com`
127+
- **Auth**: `https://auth.app.useorin.com`
128+
- **S3 Console**: `https://s3.app.useorin.com`
129+
130+
## 📊 Resource Requirements
131+
132+
### Minimum VPS Specs
133+
- **CPU**: 2 vCPUs
134+
- **RAM**: 2GB (4GB recommended)
135+
- **Storage**: 50GB
136+
- **Network**: 1Gbps
137+
138+
### Recommended VPS Specs
139+
- **CPU**: 4 vCPUs
140+
- **RAM**: 8GB
141+
- **Storage**: 100GB SSD
142+
- **Network**: 1Gbps
143+
144+
### With GPU (Optional)
145+
- **GPU**: NVIDIA T4 or better
146+
- **RAM**: 16GB+
147+
- **Storage**: 100GB+ SSD
148+
149+
## 🔍 Monitoring & Maintenance
150+
151+
### Check Service Status
152+
```bash
153+
# Check all services
154+
systemctl status cloudflared-orin orin-app
155+
156+
# Check Docker containers
157+
docker ps
158+
159+
# View logs
160+
docker-compose -f /opt/orin/compose-production.yaml logs -f
161+
```
162+
163+
### Update Your Application
164+
```bash
165+
# Pull latest code
166+
cd /opt/orin
167+
git pull
168+
169+
# Rebuild and restart
170+
systemctl restart orin-app
171+
```
172+
173+
### Backup Database
174+
```bash
175+
# Create backup
176+
docker exec postgres pg_dump -U postgres orin > backup.sql
177+
178+
# Restore backup
179+
docker exec -i postgres psql -U postgres orin < backup.sql
180+
```
181+
182+
## 🛠️ Troubleshooting
183+
184+
### Common Issues
185+
186+
1. **API Key Errors**:
187+
- Check `models.yaml` has correct API keys
188+
- Verify keys are valid and have sufficient credits
189+
190+
2. **Cloudflare Tunnel Issues**:
191+
- Verify tunnel token is correct
192+
- Check DNS records point to Cloudflare
193+
194+
3. **Memory Issues**:
195+
- Increase VPS RAM
196+
- Reduce worker replicas in compose file
197+
198+
4. **GPU Not Detected**:
199+
- Install NVIDIA drivers
200+
- Install NVIDIA Container Toolkit
201+
202+
### Logs and Debugging
203+
```bash
204+
# View application logs
205+
journalctl -u orin-app -f
206+
207+
# View Cloudflare tunnel logs
208+
journalctl -u cloudflared-orin -f
209+
210+
# Check Docker logs
211+
docker logs <container-name>
212+
```
213+
214+
## 🔒 Security Considerations
215+
216+
1. **Change default passwords** in `.env`
217+
2. **Use strong database passwords**
218+
3. **Enable Cloudflare security features**
219+
4. **Regular security updates**
220+
5. **Monitor access logs**
221+
222+
## 📈 Scaling
223+
224+
### Horizontal Scaling
225+
Increase worker replicas in compose file:
226+
```yaml
227+
task:
228+
deploy:
229+
replicas: 5 # Increase from 3
230+
```
231+
232+
### Vertical Scaling
233+
Upgrade your VPS resources or move to a larger instance.
234+
235+
### Load Balancing
236+
For high traffic, consider using multiple VPS instances with a load balancer.
237+
238+
## 💰 Cost Optimization
239+
240+
### VPS Recommendations
241+
- **Startup**: DigitalOcean $6/month droplet
242+
- **Growth**: DigitalOcean $12/month droplet
243+
- **Production**: DigitalOcean $24/month droplet
244+
245+
### Cloudflare Features
246+
- **Free tier**: 50,000 requests/day
247+
- **Pro tier**: $20/month for higher limits
248+
249+
## 🎉 Success!
250+
251+
Once deployed, your Orin service will be:
252+
- ✅ **Live at** `https://app.useorin.com`
253+
- ✅ **SSL secured** via Cloudflare
254+
- ✅ **Custom branded** with Orin
255+
- ✅ **Production ready** for customer onboarding
256+
- ✅ **Scalable** as you grow
257+
258+
## 📞 Support
259+
260+
If you encounter issues:
261+
1. Check the troubleshooting section
262+
2. Review logs for error messages
263+
3. Verify all configuration files
264+
4. Ensure API keys are valid
265+
266+
Your Orin service is now ready to onboard customers! 🚀

cloudflared-config.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
tunnel: YOUR_TUNNEL_ID
2+
credentials-file: /root/.cloudflared/YOUR_TUNNEL_ID.json
3+
4+
ingress:
5+
# Main web application
6+
- hostname: app.useorin.com
7+
service: http://localhost:5173
8+
originRequest:
9+
noTLSVerify: true
10+
11+
# API server
12+
- hostname: api.app.useorin.com
13+
service: http://localhost:8000
14+
originRequest:
15+
noTLSVerify: true
16+
17+
# Authentication
18+
- hostname: auth.app.useorin.com
19+
service: http://localhost:8080
20+
originRequest:
21+
noTLSVerify: true
22+
23+
# S3/MinIO console (optional, for admin access)
24+
- hostname: s3.app.useorin.com
25+
service: http://localhost:9001
26+
originRequest:
27+
noTLSVerify: true
28+
29+
# Catch-all rule - return 404 for unmatched hostnames
30+
- service: http_status:404

0 commit comments

Comments
 (0)