Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ wheels/
# .env
.env

# Deployment-generated URLs
# Deployment-generated URLs and backups
.onboarding-status-url
.token-service-url
url-map-backup*.yaml

terraform.tfvars
*.tfstate
Expand Down
196 changes: 196 additions & 0 deletions docs/developer_guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
# Developer Guide

This guide provides comprehensive information for developers and administrators working with the AI Engineering Platform infrastructure.

## Overview

The AI Engineering Platform consists of multiple components that work together to provide secure, isolated development environments and automated participant management. This guide covers deployment, configuration, and maintenance procedures.

---

## Platform Components

### 1. Coder Server
- **Purpose**: Provides containerized development environments
- **Deployment**: GCP VM with Terraform
- **Documentation**: See [Coder Deployment](index.md#1-coder-deployment-for-gcp)

### 2. Participant Onboarding System
- **Purpose**: Automated participant authentication and API key distribution
- **Components**: Firebase Authentication, Firestore, Cloud Functions
- **Documentation**: See [Participant Onboarding](index.md#2-participant-onboarding-system)

### 3. Onboarding Status Dashboard
- **Purpose**: Real-time monitoring of participant onboarding status
- **Deployment**: Next.js on Cloud Run with Load Balancer path-based routing
- **Access**: `https://platform.vectorinstitute.ai/onboarding`

---

## Infrastructure Deployment

### Coder Server Deployment

Follow the comprehensive deployment guide in the `coder/deploy/` directory.

**Quick Start:**
```bash
cd coder/deploy
terraform init
terraform plan
terraform apply
```

For detailed instructions, see [`coder/deploy/README.md`](../coder/deploy/README.md).

### Onboarding Status Web Dashboard

The onboarding status dashboard is deployed on Cloud Run and integrated with the main platform load balancer using path-based routing.

**Setup Guide:** [Onboarding Status Web - Load Balancer Setup](onboarding-status-web-load-balancer-setup.md)

This guide covers:

- Configuring Next.js with basePath for path-based routing
- Creating serverless Network Endpoint Groups (NEG)
- Setting up backend services for Cloud Run
- Configuring load balancer path matchers
- Deployment and verification procedures
- Troubleshooting common issues

**Deployment Command:**
```bash
./scripts/admin/deploy_onboarding_status_web.sh
```

**Access URL:**
```
https://platform.vectorinstitute.ai/onboarding
```

---

## Service Architecture

### Load Balancer Configuration

The platform uses a single Google Cloud Load Balancer to route traffic to multiple backend services:

```
platform.vectorinstitute.ai/
├── / → Coder Server (VM: coder-entrypoint)
├── /onboarding → Cloud Run (onboarding-status-web)
└── /onboarding/* → Cloud Run (onboarding-status-web)
```

**Key Resources:**

| Resource | Name | Purpose |
|----------|------|---------|
| External IP | `coderd-https-lb-ip` | Static IP for load balancer |
| HTTPS Forwarding Rule | `coderd-https-forwarding-rule` | Routes HTTPS traffic |
| HTTPS Proxy | `coderd-https-proxy` | SSL termination |
| URL Map | `https-url-map` | Path-based routing configuration |
| Backend Service (Coder) | `coderd-backend` | Routes to Coder VM |
| Backend Service (Onboarding) | `onboarding-backend` | Routes to Cloud Run |

### Firebase Services

The platform uses Firebase for authentication and data storage:

- **Firebase Authentication**: Custom token generation for participants
- **Firestore**: Participant data, team assignments, and API keys
- **Firebase Security Rules**: Enforce team-level data isolation

---

## Administration

### Participant Management

#### Adding Participants

Use the admin scripts to add new participants:

```bash
python scripts/admin/setup_participants.py
```

**Requirements:**
- CSV file with participant information
- Firebase admin credentials
- Team assignments

#### Viewing Onboarding Status

**Command Line:**
```bash
onboard --admin-status-report --gcp-project coderd
```

**Web Dashboard:**
```
https://platform.vectorinstitute.ai/onboarding
```

The dashboard provides:
- Real-time participant status
- Onboarding completion rates
- Filtering by status
- CSV export functionality

---

## Monitoring and Maintenance

### Health Checks

**Coder Server:**
```bash
curl -I https://platform.vectorinstitute.ai/
```

**Onboarding Dashboard:**
```bash
curl -I https://platform.vectorinstitute.ai/onboarding
```

**Onboarding API:**
```bash
curl https://platform.vectorinstitute.ai/onboarding/api/participants
```

### Log Access

**Cloud Run Logs:**
```bash
gcloud logging read "resource.type=cloud_run_revision AND resource.labels.service_name=onboarding-status-web" \
--project=coderd \
--limit=50 \
--format=json
```

**Coder Server Logs:**
```bash
# SSH into VM
gcloud compute ssh coder-entrypoint --project=coderd --zone=us-central1-a

# View logs
sudo journalctl -u coder -f
```

### Resource Management

**List Active Services:**
```bash
# Cloud Run services
gcloud run services list --project=coderd

# Compute instances
gcloud compute instances list --project=coderd

# Backend services
gcloud compute backend-services list --project=coderd
```

---
Loading