# SmoothSchedule Quick Reference

## Deployment Commands

### Deploy to Production
```bash
cd /home/poduck/Desktop/smoothschedule2
./deploy.sh poduck@smoothschedule.com
```

### SSH to Server
```bash
ssh poduck@smoothschedule.com
# Password: chaff/starry
```

## Production Management

### Navigate to Project
```bash
cd ~/smoothschedule
```

### View Logs
```bash
# All services
docker compose -f docker-compose.production.yml logs -f

# Specific service
docker compose -f docker-compose.production.yml logs -f django
docker compose -f docker-compose.production.yml logs -f celeryworker
docker compose -f docker-compose.production.yml logs -f traefik
```

### Check Status
```bash
docker compose -f docker-compose.production.yml ps
```

### Restart Services
```bash
# All services
docker compose -f docker-compose.production.yml restart

# Specific service
docker compose -f docker-compose.production.yml restart django
```

### Run Django Commands
```bash
# Migrations
docker compose -f docker-compose.production.yml exec django python manage.py migrate

# Create superuser
docker compose -f docker-compose.production.yml exec django python manage.py createsuperuser

# Django shell
docker compose -f docker-compose.production.yml exec django python manage.py shell

# Collect static files
docker compose -f docker-compose.production.yml exec django python manage.py collectstatic --noinput
```

## URLs

- **Main Site:** https://smoothschedule.com
- **Platform Dashboard:** https://platform.smoothschedule.com
- **API:** https://smoothschedule.com/api
- **Admin:** https://smoothschedule.com/admin
- **Flower (Celery):** https://smoothschedule.com:5555

## DigitalOcean Spaces

### View Bucket Contents
```bash
aws --profile do-tor1 s3 ls s3://smoothschedule/
aws --profile do-tor1 s3 ls s3://smoothschedule/static/
aws --profile do-tor1 s3 ls s3://smoothschedule/media/
```

### Upload File
```bash
aws --profile do-tor1 s3 cp file.jpg s3://smoothschedule/media/
```

### Public URLs
- **Static:** https://smoothschedule.nyc3.digitaloceanspaces.com/static/
- **Media:** https://smoothschedule.nyc3.digitaloceanspaces.com/media/

## Troubleshooting

### 500 Error
```bash
# Check Django logs
docker compose -f docker-compose.production.yml logs django --tail=100
```

### SSL Not Working
```bash
# Check Traefik logs
docker compose -f docker-compose.production.yml logs traefik

# Verify DNS
dig smoothschedule.com +short
```

### Database Issues
```bash
# Check PostgreSQL
docker compose -f docker-compose.production.yml logs postgres

# Access database
docker compose -f docker-compose.production.yml exec django python manage.py dbshell
```

### Static Files Not Loading
```bash
# Re-collect static files
docker compose -f docker-compose.production.yml exec django python manage.py collectstatic --noinput

# Check Spaces
aws --profile do-tor1 s3 ls s3://smoothschedule/static/ | head
```

## Backups

### Create Database Backup
```bash
docker compose -f docker-compose.production.yml exec postgres backup
```

### List Backups
```bash
docker compose -f docker-compose.production.yml exec postgres backups
```

### Restore Backup
```bash
docker compose -f docker-compose.production.yml exec postgres restore <backup_file>
```

## Emergency Commands

### Stop All Services
```bash
docker compose -f docker-compose.production.yml down
```

### Start All Services
```bash
docker compose -f docker-compose.production.yml up -d
```

### Rebuild Everything
```bash
docker compose -f docker-compose.production.yml down
docker compose -f docker-compose.production.yml build --no-cache
docker compose -f docker-compose.production.yml up -d
```

### View Resource Usage
```bash
docker stats
```

## Environment Files

- **Backend:** `~/smoothschedule/.envs/.production/.django`
- **Database:** `~/smoothschedule/.envs/.production/.postgres`

## Support

- **Detailed Guide:** See DEPLOYMENT.md
- **Production Status:** See PRODUCTION-READY.md
- **Main Docs:** See CLAUDE.md
