# 🚀 Quick Deployment Reference

## Deploy to Solaria (Improved)

### One-Command Deployment

```bash
# Set JWT secret and deploy
JWT_SECRET=$(openssl rand -base64 32) ./backend/deploy-to-solaria-improved.sh
```

### What's Fixed

| Issue | Before | After |
|-------|--------|-------|
| Binary path | `./normogen-backend` (wrong) | `/app/normogen-backend` (correct) |
| Health checks | None | Every 30s |
| User | root | normogen (UID 1000) |
| Image size | ~1.5GB | ~400MB |
| Build time | ~10 min | ~3 min |
| Dependencies | None | Waits for MongoDB |
| Resources | Unlimited | 1 CPU, 512MB RAM |

### Files Created

1. **backend/docker/Dockerfile.improved** - Multi-stage build
2. **backend/docker/docker-compose.improved.yml** - Production-ready compose
3. **backend/deploy-to-solaria-improved.sh** - Automated deployment
4. **DOCKER_DEPLOYMENT_IMPROVEMENTS.md** - Complete guide

### Quick Commands

```bash
# View logs
ssh solaria 'docker logs -f normogen-backend'

# Check status
ssh solaria 'docker ps | grep normogen'

# Restart services
ssh solaria 'docker compose -f /srv/normogen/docker/docker-compose.improved.yml restart'

# Test API
curl http://solaria.solivarez.com.ar:8001/health
```

### Troubleshooting

```bash
# Container not starting?
ssh solaria 'docker logs normogen-backend'

# Port conflict?
ssh solaria 'netstat -tlnp | grep 8001'

# MongoDB issues?
ssh solaria 'docker exec normogen-mongodb mongosh --eval "db.adminCommand('ping')"'
```

---

**Ready?** Run: `JWT_SECRET=$(openssl rand -base64 32) ./backend/deploy-to-solaria-improved.sh`
