# DBIS Core Container Creation - Complete

## Summary

All 6 DBIS Core containers have been successfully created and are running on Proxmox host `192.168.11.10`.

## Containers Created

| VMID | Hostname | IP Address | Status | Description |
|------|----------|------------|--------|-------------|
| 10100 | dbis-postgres-primary | 192.168.11.100 | ✅ Running | PostgreSQL Primary Database |
| 10101 | dbis-postgres-replica-1 | 192.168.11.101 | ✅ Running | PostgreSQL Replica Database |
| 10120 | dbis-redis | 192.168.11.120 | ✅ Running | Redis Cache Server |
| 10150 | dbis-api-primary | 192.168.11.150 | ✅ Running | Backend API Primary Server |
| 10151 | dbis-api-secondary | 192.168.11.151 | ✅ Running | Backend API Secondary Server |
| 10130 | dbis-frontend | 192.168.11.130 | ✅ Running | Frontend Admin Console |

## Container Specifications

### PostgreSQL Containers (10100, 10101)
- **Memory**: 8 GB each
- **CPU**: 4 cores each
- **Disk**: 200 GB each
- **OS**: Ubuntu 22.04 Standard
- **Network**: vmbr0 bridge
- **Features**: nesting=1, keyctl=1
- **Unprivileged**: Yes

### Redis Container (10120)
- **Memory**: 4 GB
- **CPU**: 2 cores
- **Disk**: 50 GB
- **OS**: Ubuntu 22.04 Standard
- **Network**: vmbr0 bridge
- **Features**: nesting=1, keyctl=1
- **Unprivileged**: Yes

### API Containers (10150, 10151)
- **Memory**: 8 GB each
- **CPU**: 4 cores each
- **Disk**: 100 GB each
- **OS**: Ubuntu 22.04 Standard
- **Network**: vmbr0 bridge
- **Features**: nesting=1, keyctl=1
- **Unprivileged**: Yes

### Frontend Container (10130)
- **Memory**: 4 GB
- **CPU**: 2 cores
- **Disk**: 50 GB
- **OS**: Ubuntu 22.04 Standard
- **Network**: vmbr0 bridge
- **Features**: nesting=1, keyctl=1
- **Unprivileged**: Yes

## Script Created

**Location**: `dbis_core/scripts/deployment/create-dbis-core-containers.sh`

This script can be used to create any missing DBIS Core containers. It:
- Checks SSH access to Proxmox host
- Verifies if containers already exist (skips if present)
- Creates containers with proper configuration
- Starts containers automatically
- Provides summary of created/skipped containers

## Next Steps

### 1. Deploy Services to Containers

The deployment scripts need to be run on the Proxmox host. You can either:

**Option A: Run remotely via SSH**
```bash
cd /home/intlc/projects/proxmox
ssh root@192.168.11.10 "cd /path/to/dbis_core && ./scripts/deployment/deploy-all.sh"
```

**Option B: Copy scripts to Proxmox host and run**
```bash
# Copy deployment scripts to Proxmox host
scp -r dbis_core/scripts root@192.168.11.10:/root/dbis_core/
scp -r dbis_core/config root@192.168.11.10:/root/dbis_core/
scp -r dbis_core/templates root@192.168.11.10:/root/dbis_core/

# Then SSH and run
ssh root@192.168.11.10 "cd /root/dbis_core && ./scripts/deployment/deploy-all.sh"
```

### 2. Deployment Order

The `deploy-all.sh` script will deploy services in the correct order:

1. **Phase 1: Foundation Services**
   - PostgreSQL (primary + replica)
   - Redis

2. **Phase 2: Application Services**
   - Backend API (primary + secondary)
   - Frontend Admin Console

### 3. Post-Deployment Tasks

After deployment completes:

1. **Configure Database**
   ```bash
   ./scripts/deployment/configure-database.sh
   ```

2. **Verify Services**
   ```bash
   ./scripts/management/status.sh
   ```

3. **Test API Health**
   ```bash
   curl http://192.168.11.150:3000/health
   ```

## Service Endpoints

Once deployed, services will be available at:

- **PostgreSQL**: `192.168.11.100:5432`
- **Redis**: `192.168.11.120:6379`
- **API Primary**: `http://192.168.11.150:3000`
- **API Secondary**: `http://192.168.11.151:3000`
- **Frontend**: `http://192.168.11.130`

## Verification Commands

Check container status:
```bash
ssh root@192.168.11.10 "for vmid in 10100 10101 10120 10130 10150 10151; do echo \"VMID \$vmid:\"; pct status \$vmid; done"
```

Check container IPs:
```bash
ssh root@192.168.11.10 "for vmid in 10100 10101 10120 10130 10150 10151; do echo \"VMID \$vmid:\"; pct config \$vmid | grep '^net0:'; done"
```

## Notes

- All containers are configured to start on boot (`--onboot 1`)
- Containers use unprivileged mode for security
- Network configuration uses static IPs on `vmbr0` bridge
- Gateway is set to `192.168.11.1`
- Storage uses `local-lvm` on Proxmox host

## Troubleshooting

If containers fail to start:
1. Check Proxmox host resources (memory, disk space)
2. Verify network bridge `vmbr0` exists
3. Check container logs: `pct logs <vmid>`
4. Verify template exists: `pveam list | grep ubuntu-22.04`

