|
| 1 | +# π Cloud IDE Startup Guide for Dealership Application |
| 2 | + |
| 3 | +## π Quick Start Commands |
| 4 | + |
| 5 | +### **1. Clone and Setup (First Time)** |
| 6 | +```bash |
| 7 | +# Clone the repository |
| 8 | +git clone https://github.com/emiflair/xrwvm-fullstack_developer_capstone.git |
| 9 | +cd xrwvm-fullstack_developer_capstone |
| 10 | + |
| 11 | +# Make scripts executable |
| 12 | +chmod +x *.sh |
| 13 | + |
| 14 | +# Start the application |
| 15 | +./cloud-deploy.sh |
| 16 | +``` |
| 17 | + |
| 18 | +### **2. Daily Startup (After First Setup)** |
| 19 | +```bash |
| 20 | +# Navigate to project directory |
| 21 | +cd xrwvm-fullstack_developer_capstone |
| 22 | + |
| 23 | +# Start all services |
| 24 | +docker-compose up -d |
| 25 | + |
| 26 | +# Check status |
| 27 | +docker-compose ps |
| 28 | + |
| 29 | +# View logs (optional) |
| 30 | +docker-compose logs -f |
| 31 | +``` |
| 32 | + |
| 33 | +## π§ Platform-Specific Instructions |
| 34 | + |
| 35 | +### **GitHub Codespaces** |
| 36 | +1. **Open Repository**: Click "Code" β "Create codespace on main" |
| 37 | +2. **Wait for Setup**: Codespaces will automatically install Docker |
| 38 | +3. **Run Commands**: |
| 39 | + ```bash |
| 40 | + ./cloud-deploy.sh |
| 41 | + ``` |
| 42 | +4. **Access Application**: Codespaces will automatically forward ports |
| 43 | + - Django App: `https://[codespace-name]-8000.githubpreview.dev` |
| 44 | + - API: `https://[codespace-name]-3030.githubpreview.dev` |
| 45 | + |
| 46 | +### **Gitpod** |
| 47 | +1. **Open in Gitpod**: `https://gitpod.io/#https://github.com/emiflair/xrwvm-fullstack_developer_capstone` |
| 48 | +2. **Run Commands**: |
| 49 | + ```bash |
| 50 | + ./cloud-deploy.sh |
| 51 | + ``` |
| 52 | +3. **Make Ports Public**: |
| 53 | + - Go to "Ports" tab in Gitpod |
| 54 | + - Make ports 8000 and 3030 "Public" |
| 55 | +4. **Access URLs**: Gitpod will provide the public URLs |
| 56 | + |
| 57 | +### **IBM Cloud (Theia IDE)** |
| 58 | +1. **Upload Project** or clone via terminal |
| 59 | +2. **Run Commands**: |
| 60 | + ```bash |
| 61 | + ./cloud-deploy.sh |
| 62 | + ``` |
| 63 | +3. **Configure Port Forwarding** in Theia settings |
| 64 | +4. **Access**: Use the provided external URLs |
| 65 | + |
| 66 | +### **Replit** |
| 67 | +1. **Import Repository**: "Create" β "Import from GitHub" |
| 68 | +2. **Run Commands**: |
| 69 | + ```bash |
| 70 | + ./cloud-deploy.sh |
| 71 | + ``` |
| 72 | +3. **Configure Ports**: Replit auto-detects and forwards ports |
| 73 | +4. **Access**: Use Replit's provided URLs |
| 74 | + |
| 75 | +## π Step-by-Step Startup Process |
| 76 | + |
| 77 | +### **Step 1: Initial Setup** |
| 78 | +```bash |
| 79 | +# Make sure you're in the project root |
| 80 | +ls -la |
| 81 | + |
| 82 | +# You should see: cloud-deploy.sh, docker-compose.yml, README.md |
| 83 | + |
| 84 | +# Make scripts executable |
| 85 | +chmod +x cloud-deploy.sh cloud-setup-guide.sh cloud-access.sh |
| 86 | +``` |
| 87 | + |
| 88 | +### **Step 2: Start Application** |
| 89 | +```bash |
| 90 | +# One-command deployment (recommended) |
| 91 | +./cloud-deploy.sh |
| 92 | + |
| 93 | +# OR manual startup |
| 94 | +docker-compose up --build -d |
| 95 | +``` |
| 96 | + |
| 97 | +### **Step 3: Verify Services** |
| 98 | +```bash |
| 99 | +# Check all containers are running |
| 100 | +docker-compose ps |
| 101 | + |
| 102 | +# Test local access |
| 103 | +curl http://localhost:8000/ # Django app |
| 104 | +curl http://localhost:3030/health # API health check |
| 105 | +``` |
| 106 | + |
| 107 | +### **Step 4: Configure Cloud Access** |
| 108 | +```bash |
| 109 | +# Get cloud-specific URLs and instructions |
| 110 | +./cloud-setup-guide.sh |
| 111 | + |
| 112 | +# Quick cloud access helper |
| 113 | +./cloud-access.sh |
| 114 | +``` |
| 115 | + |
| 116 | +## π Troubleshooting Commands |
| 117 | + |
| 118 | +### **Check Container Status** |
| 119 | +```bash |
| 120 | +docker-compose ps |
| 121 | +docker-compose logs dealership_django |
| 122 | +docker-compose logs dealership_api |
| 123 | +docker-compose logs dealership_mongodb |
| 124 | +``` |
| 125 | + |
| 126 | +### **Restart Services** |
| 127 | +```bash |
| 128 | +# Restart all services |
| 129 | +docker-compose restart |
| 130 | + |
| 131 | +# Restart specific service |
| 132 | +docker-compose restart dealership_django |
| 133 | +``` |
| 134 | + |
| 135 | +### **Clean Restart** |
| 136 | +```bash |
| 137 | +# Stop and remove everything |
| 138 | +docker-compose down -v |
| 139 | + |
| 140 | +# Rebuild and start fresh |
| 141 | +docker-compose up --build -d |
| 142 | +``` |
| 143 | + |
| 144 | +### **Health Checks** |
| 145 | +```bash |
| 146 | +# Django health |
| 147 | +curl -I http://localhost:8000/ |
| 148 | + |
| 149 | +# API health |
| 150 | +curl http://localhost:3030/health |
| 151 | + |
| 152 | +# MongoDB connection test |
| 153 | +docker-compose exec dealership_mongodb mongosh --eval "db.adminCommand('ping')" |
| 154 | +``` |
| 155 | + |
| 156 | +## π Port Configuration |
| 157 | + |
| 158 | +| Service | Internal Port | External Port | URL | |
| 159 | +|---------|---------------|---------------|-----| |
| 160 | +| Django | 8000 | 8000 | `http://localhost:8000` | |
| 161 | +| API | 3030 | 3030 | `http://localhost:3030` | |
| 162 | +| MongoDB | 27017 | 27017 | `mongodb://localhost:27017` | |
| 163 | + |
| 164 | +## π¨ Common Issues & Solutions |
| 165 | + |
| 166 | +### **Issue: "Port already in use"** |
| 167 | +```bash |
| 168 | +# Kill processes using the ports |
| 169 | +sudo lsof -ti:8000 | xargs kill -9 |
| 170 | +sudo lsof -ti:3030 | xargs kill -9 |
| 171 | +docker-compose down -v |
| 172 | +``` |
| 173 | + |
| 174 | +### **Issue: "Docker not found"** |
| 175 | +```bash |
| 176 | +# Most cloud IDEs have Docker pre-installed |
| 177 | +# If not, contact your cloud provider support |
| 178 | +docker --version |
| 179 | +``` |
| 180 | + |
| 181 | +### **Issue: "Permission denied"** |
| 182 | +```bash |
| 183 | +# Make scripts executable |
| 184 | +chmod +x *.sh |
| 185 | + |
| 186 | +# Run with explicit bash |
| 187 | +bash cloud-deploy.sh |
| 188 | +``` |
| 189 | + |
| 190 | +### **Issue: "Can't access from browser"** |
| 191 | +1. **Check port forwarding** in your cloud IDE |
| 192 | +2. **Make ports public** (not just open) |
| 193 | +3. **Use HTTPS URLs** if provided by cloud IDE |
| 194 | +4. **Check firewall settings** in cloud environment |
| 195 | + |
| 196 | +## π― Production Deployment Commands |
| 197 | + |
| 198 | +### **For Cloud Platforms (AWS, Google Cloud, Azure)** |
| 199 | +```bash |
| 200 | +# Use Docker Compose directly |
| 201 | +docker-compose up -d |
| 202 | + |
| 203 | +# Or with custom environment |
| 204 | +DJANGO_ENV=production docker-compose up -d |
| 205 | +``` |
| 206 | + |
| 207 | +### **For Kubernetes** |
| 208 | +```bash |
| 209 | +# Convert to Kubernetes manifests (if needed) |
| 210 | +kompose convert |
| 211 | + |
| 212 | +# Deploy to cluster |
| 213 | +kubectl apply -f . |
| 214 | +``` |
| 215 | + |
| 216 | +## π± Quick Access URLs |
| 217 | + |
| 218 | +After startup, your application will be available at: |
| 219 | +- **Main Application**: Your cloud IDE will provide the Django URL (port 8000) |
| 220 | +- **API Endpoints**: Your cloud IDE will provide the API URL (port 3030) |
| 221 | +- **API Health Check**: `[API_URL]/health` |
| 222 | + |
| 223 | +## π Get Help |
| 224 | + |
| 225 | +If you encounter issues: |
| 226 | +1. **Run diagnostics**: `./cloud-setup-guide.sh` |
| 227 | +2. **Check logs**: `docker-compose logs -f` |
| 228 | +3. **Restart services**: `docker-compose restart` |
| 229 | +4. **Full reset**: `docker-compose down -v && ./cloud-deploy.sh` |
| 230 | + |
| 231 | +--- |
| 232 | +**Happy Coding! π** |
0 commit comments