261 lines
6.2 KiB
Markdown
261 lines
6.2 KiB
Markdown
# 🚀 START HERE - LuckyChit Deployment
|
|
|
|
## 📁 What Files Were Created?
|
|
|
|
I've created deployment documentation for your LuckyChit app:
|
|
|
|
| File | Purpose | When to Use |
|
|
|------|---------|-------------|
|
|
| **PROXMOX_DEPLOYMENT_GUIDE.md** | Complete detailed guide | First time deployment |
|
|
| **QUICK_DEPLOY.md** | Quick command reference | Quick reference / updates |
|
|
| **deploy.sh** | Automated setup script | Fastest automated setup |
|
|
| **DEPLOYMENT_README.md** | Overview & comparison | Understanding options |
|
|
| **START_HERE.md** | This file - Quick start | Right now! |
|
|
|
|
---
|
|
|
|
## 🎯 Choose Your Path
|
|
|
|
### 🤖 Option 1: Automated (Recommended for Beginners)
|
|
|
|
**Time: ~15 minutes**
|
|
|
|
1. Create Ubuntu 22.04 LXC container in Proxmox
|
|
2. Upload `deploy.sh` to the container
|
|
3. Run: `sudo bash deploy.sh`
|
|
4. Upload your code and follow on-screen instructions
|
|
|
|
### 📖 Option 2: Manual Step-by-Step
|
|
|
|
**Time: ~30-45 minutes**
|
|
|
|
Follow **PROXMOX_DEPLOYMENT_GUIDE.md** for complete instructions
|
|
|
|
### ⚡ Option 3: Quick Commands (For Experts)
|
|
|
|
**Time: ~20 minutes**
|
|
|
|
Use **QUICK_DEPLOY.md** for copy-paste commands
|
|
|
|
---
|
|
|
|
## 🏃 Fastest Way to Deploy (5 Steps)
|
|
|
|
### Step 1: Create LXC Container on Proxmox
|
|
|
|
```bash
|
|
# On Proxmox host
|
|
pct create 100 local:vztmpl/ubuntu-22.04-standard_22.04-1_amd64.tar.zst \
|
|
--hostname luckychit \
|
|
--memory 2048 \
|
|
--cores 2 \
|
|
--net0 name=eth0,bridge=vmbr0,ip=dhcp \
|
|
--rootfs local-lvm:8
|
|
|
|
pct start 100
|
|
pct enter 100
|
|
```
|
|
|
|
### Step 2: Upload & Run Deploy Script
|
|
|
|
```bash
|
|
# Upload deploy.sh to container, then:
|
|
chmod +x deploy.sh
|
|
./deploy.sh
|
|
|
|
# Follow the prompts:
|
|
# - Enter database password
|
|
# - Enter JWT secret (random 32+ characters)
|
|
# - Enter domain name (optional)
|
|
# - Enter server IP
|
|
```
|
|
|
|
### Step 3: Upload Your Code
|
|
|
|
```bash
|
|
# From your Windows machine:
|
|
scp -r C:\Users\sunde\workspace\chitfund luckychit@<container-ip>:/home/luckychit/apps/
|
|
|
|
# Or using Git inside container:
|
|
cd /home/luckychit/apps
|
|
git clone <your-repo-url> chitfund
|
|
```
|
|
|
|
### Step 4: Deploy Backend
|
|
|
|
```bash
|
|
cd /home/luckychit/apps/chitfund/backend
|
|
npm install --production
|
|
node create-db.js
|
|
pm2 start src/server.js --name luckychit-api
|
|
pm2 startup systemd -u luckychit --hp /home/luckychit
|
|
pm2 save
|
|
```
|
|
|
|
### Step 5: Deploy Frontend
|
|
|
|
```bash
|
|
cd /home/luckychit/apps/chitfund/luckychit
|
|
|
|
# Update API endpoint first!
|
|
# Edit the file that contains your API URL
|
|
# Change it to: http://<your-server-ip>:3000 or https://api.yourdomain.com
|
|
|
|
flutter pub get
|
|
flutter build web --release
|
|
sudo cp -r build/web/* /var/www/luckychit/
|
|
```
|
|
|
|
### ✅ Test Your Deployment
|
|
|
|
```bash
|
|
# Check if everything is running
|
|
pm2 status
|
|
sudo systemctl status nginx
|
|
curl http://localhost:3000/health
|
|
|
|
# Access from browser:
|
|
# Frontend: http://<your-server-ip>
|
|
# API Health: http://<your-server-ip>/health
|
|
```
|
|
|
|
---
|
|
|
|
## 📋 What You Need Before Starting
|
|
|
|
### Information
|
|
- [ ] Your Proxmox host IP/access
|
|
- [ ] Server IP address for the LXC container
|
|
- [ ] Domain name (optional, for SSL)
|
|
- [ ] Strong password for database (16+ characters)
|
|
- [ ] Random JWT secret (32+ characters)
|
|
|
|
### Tools (Optional - for uploading files)
|
|
- [ ] WinSCP or FileZilla (for file transfers)
|
|
- [ ] PuTTY or Windows Terminal (for SSH)
|
|
|
|
### Generate Secure Secrets
|
|
|
|
```powershell
|
|
# On Windows PowerShell, generate random secrets:
|
|
|
|
# Database Password (16 characters)
|
|
-join ((48..57) + (65..90) + (97..122) | Get-Random -Count 16 | % {[char]$_})
|
|
|
|
# JWT Secret (32 characters)
|
|
-join ((48..57) + (65..90) + (97..122) | Get-Random -Count 32 | % {[char]$_})
|
|
```
|
|
|
|
---
|
|
|
|
## 🎓 Learning Path
|
|
|
|
### Complete Beginner?
|
|
1. Read **DEPLOYMENT_README.md** first (understand options)
|
|
2. Follow **PROXMOX_DEPLOYMENT_GUIDE.md** step-by-step
|
|
3. Keep **QUICK_DEPLOY.md** for future reference
|
|
|
|
### Some Experience?
|
|
1. Skim **DEPLOYMENT_README.md**
|
|
2. Use **deploy.sh** for automated setup
|
|
3. Reference **QUICK_DEPLOY.md** when needed
|
|
|
|
### Expert User?
|
|
1. Use **QUICK_DEPLOY.md** directly
|
|
2. Reference **PROXMOX_DEPLOYMENT_GUIDE.md** for specifics
|
|
|
|
---
|
|
|
|
## 🆘 Something Wrong?
|
|
|
|
### Deploy Script Fails
|
|
- Check internet connection
|
|
- Make sure you're running as root: `sudo bash deploy.sh`
|
|
- Check logs for specific errors
|
|
|
|
### Can't Access Application
|
|
- Check firewall: `sudo ufw status`
|
|
- Check services: `pm2 status` and `sudo systemctl status nginx`
|
|
- Check ports: `sudo netstat -tulpn | grep -E '(80|3000)'`
|
|
|
|
### Database Issues
|
|
- Verify PostgreSQL is running: `sudo systemctl status postgresql`
|
|
- Test connection: `psql -U luckychit -d luckychit -h localhost`
|
|
- Check credentials in `.env` file
|
|
|
|
### More Help Needed?
|
|
- See **Troubleshooting** section in **PROXMOX_DEPLOYMENT_GUIDE.md**
|
|
- Check logs: `pm2 logs`, `sudo tail -f /var/log/nginx/error.log`
|
|
|
|
---
|
|
|
|
## 🔒 Security Checklist
|
|
|
|
After deployment, verify:
|
|
|
|
- [ ] Firewall is enabled and configured
|
|
- [ ] Strong database password set
|
|
- [ ] Unique JWT secret configured
|
|
- [ ] `.env` file has correct permissions (600)
|
|
- [ ] SSL/HTTPS enabled (for production)
|
|
- [ ] Regular backups scheduled
|
|
- [ ] All default passwords changed
|
|
|
|
---
|
|
|
|
## 📞 Quick Reference
|
|
|
|
| Task | Command |
|
|
|------|---------|
|
|
| Check status | `pm2 status` |
|
|
| View logs | `pm2 logs` |
|
|
| Restart app | `pm2 restart luckychit-api` |
|
|
| Update code | `git pull && npm install && pm2 reload luckychit-api` |
|
|
| Backup DB | `/home/luckychit/backup-db.sh` |
|
|
| Check nginx | `sudo systemctl status nginx` |
|
|
|
|
---
|
|
|
|
## 🎉 Ready to Deploy?
|
|
|
|
1. Pick your deployment method above
|
|
2. Gather required information
|
|
3. Follow the steps
|
|
4. Test your application
|
|
5. Setup SSL (recommended for production)
|
|
|
|
**Estimated Time:** 15-45 minutes depending on method
|
|
|
|
Good luck! Your LuckyChit app will be live soon! 🚀
|
|
|
|
---
|
|
|
|
## 📚 Documentation Structure
|
|
|
|
```
|
|
START_HERE.md (You are here!)
|
|
├── Quick overview and decision guide
|
|
├──
|
|
DEPLOYMENT_README.md
|
|
│ ├── Compare deployment methods
|
|
│ ├── Post-deployment tasks
|
|
│ └── Troubleshooting overview
|
|
│
|
|
PROXMOX_DEPLOYMENT_GUIDE.md
|
|
│ ├── Complete step-by-step guide
|
|
│ ├── Detailed explanations
|
|
│ ├── Troubleshooting details
|
|
│ └── Maintenance procedures
|
|
│
|
|
QUICK_DEPLOY.md
|
|
│ ├── Quick command reference
|
|
│ ├── Common operations
|
|
│ └── Useful paths
|
|
│
|
|
deploy.sh
|
|
└── Automated deployment script
|
|
```
|
|
|
|
**Tip:** Bookmark this structure for future reference!
|
|
|