# Provisioning Platform - Quick Start

Fast deployment guide for all modes.

---

## Prerequisites

```bash
# Verify Docker is installed and running
docker --version  # 20.10+
docker-compose --version  # 2.0+
docker ps  # Should work without errors
```

---

## 1. Solo Mode (Local Development)

**Services**: Orchestrator, Control Center, CoreDNS, OCI Registry, Extension Registry

**Resources**: 2 CPU cores, 4GB RAM, 20GB disk

```bash
cd /Users/Akasha/project-provisioning/provisioning/platform

# Generate secrets
./scripts/generate-secrets.nu

# Deploy
./scripts/deploy-platform.nu --mode solo

# Verify
./scripts/health-check.nu

# Access
open http://localhost:8080  # Orchestrator
open http://localhost:8081  # Control Center
```

**Stop**:

```bash
docker-compose down
```

---

## 2. Multi-User Mode (Team Collaboration)

**Services**: Solo + Gitea, PostgreSQL

**Resources**: 4 CPU cores, 8GB RAM, 50GB disk

```bash
cd /Users/Akasha/project-provisioning/provisioning/platform

# Generate secrets
./scripts/generate-secrets.nu

# Deploy
./scripts/deploy-platform.nu --mode multi-user

# Verify
./scripts/health-check.nu

# Access
open http://localhost:3000  # Gitea
open http://localhost:8081  # Control Center
```

**Configure Gitea**:

1. Visit <http://localhost:3000>
2. Complete initial setup wizard
3. Create admin account

---

## 3. CI/CD Mode (Automated Pipelines)

**Services**: Multi-User + API Server, Jenkins (optional), GitLab Runner (optional)

**Resources**: 8 CPU cores, 16GB RAM, 100GB disk

```bash
cd /Users/Akasha/project-provisioning/provisioning/platform

# Generate secrets
./scripts/generate-secrets.nu

# Deploy
./scripts/deploy-platform.nu --mode cicd --build

# Verify
./scripts/health-check.nu

# Access
open http://localhost:8083  # API Server
```

---

## 4. Enterprise Mode (Production)

**Services**: Full stack (15+ services)

**Resources**: 16 CPU cores, 32GB RAM, 500GB disk

```bash
cd /Users/Akasha/project-provisioning/provisioning/platform

# Generate production secrets
./scripts/generate-secrets.nu --output .env.production

# Review and customize
nano .env.production

# Deploy with build
./scripts/deploy-platform.nu --mode enterprise \
                              --env-file .env.production \
                              --build \
                              --wait 600

# Verify
./scripts/health-check.nu

# Access
open http://localhost:3001  # Grafana (admin / password from .env)
open http://localhost:9090  # Prometheus
open http://localhost:5601  # Kibana
```

---

## Common Commands

### View Logs

```bash
docker-compose logs -f
docker-compose logs -f orchestrator
docker-compose logs --tail=100 orchestrator
```

### Restart Services

```bash
docker-compose restart orchestrator
docker-compose restart
```

### Update Platform

```bash
docker-compose pull
./scripts/deploy-platform.nu --mode <your-mode> --pull
```

### Stop Platform

```bash
docker-compose down
```

### Clean Everything (WARNING: data loss)

```bash
docker-compose down --volumes
```

---

## Systemd (Linux Production)

```bash
# Install services
cd systemd
sudo ./install-services.sh

# Enable and start
sudo systemctl enable --now provisioning-platform

# Check status
sudo systemctl status provisioning-platform

# View logs
sudo journalctl -u provisioning-platform -f

# Restart
sudo systemctl restart provisioning-platform

# Stop
sudo systemctl stop provisioning-platform
```

---

## Troubleshooting

### Services not starting

```bash
# Check Docker
systemctl status docker

# Check logs
docker-compose logs orchestrator

# Check resources
docker stats
```

### Port conflicts

```bash
# Find what's using port
lsof -i :8080

# Change port in .env
nano .env
# Set ORCHESTRATOR_PORT=9080

# Restart
docker-compose down && docker-compose up -d
```

### Health checks failing

```bash
# Check individual service
curl http://localhost:8080/health

# Wait longer
./scripts/deploy-platform.nu --wait 600

# Check networks
docker network inspect provisioning-net
```

---

## Access URLs

### Solo Mode

- Orchestrator: <http://localhost:8080>
- Control Center: <http://localhost:8081>
- OCI Registry: <http://localhost:5000>

### Multi-User Mode

- Gitea: <http://localhost:3000>
- PostgreSQL: localhost:5432

### CI/CD Mode

- API Server: <http://localhost:8083>

### Enterprise Mode

- Prometheus: <http://localhost:9090>
- Grafana: <http://localhost:3001>
- Kibana: <http://localhost:5601>
- Nginx: <http://localhost:80>

---

## Next Steps

- **Full Guide**: See `docs/deployment/deployment-guide.md`
- **Configuration**: Edit `.env` file for customization
- **Monitoring**: Access Grafana dashboards (enterprise mode)
- **API**: Use API Server for automation (CI/CD mode)

---

**Need Help?**

- Health Check: `./scripts/health-check.nu`
- Logs: `docker-compose logs -f`
- Documentation: `docs/deployment/`
