# DBIS Core Deployment Fixes Applied

## Fixes Implemented

### 1. ✅ Added curl Installation
**Issue**: `curl` command not found, preventing Node.js installation
**Fix**: Added explicit curl installation step before Node.js installation in both `deploy-api.sh` and `deploy-frontend.sh`

### 2. ✅ Fixed Node.js Installation Conflict
**Issue**: Conflict between existing `libnode72` package and Node.js 18 installation
**Fix**: Added step to remove conflicting packages (`nodejs` and `libnode72`) before installing Node.js 18

### 3. ✅ Fixed File Transfer Mechanism
**Issue**: `pct push --recursive` flag not supported by Proxmox
**Fix**: Changed to use `tar` archive creation and `pct push` for single file transfer:
- Create tar archive: `tar czf /tmp/dbis_core_$$.tar.gz -C "$PROJECT_ROOT" dbis_core`
- Push single tar file: `pct push "$vmid" "$temp_tar" /tmp/dbis_core.tar.gz`
- Extract inside container: `pct exec "$vmid" -- bash -c "cd /opt && tar xzf /tmp/dbis_core.tar.gz && mv dbis_core dbis-core"`

### 4. ✅ Fixed Nginx Configuration
**Issue**: Invalid `proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for` directive
**Fix**: Changed to `proxy_set_header X-Forwarded-For $remote_addr` in `deploy-frontend.sh`

## Files Modified

1. `/home/intlc/projects/proxmox/dbis_core/scripts/deployment/deploy-api.sh`
2. `/home/intlc/projects/proxmox/dbis_core/scripts/deployment/deploy-frontend.sh`

## Next Steps

The deployment scripts are now fixed and ready to deploy. The scripts will:
1. Install curl first
2. Remove conflicting Node.js packages
3. Install Node.js 18 properly
4. Copy files using tar archive method
5. Configure services correctly

**To redeploy:**

```bash
ssh root@192.168.11.10 "cd /root/proxmox/dbis_core/scripts/deployment && ./deploy-all.sh"
```

**Note**: If the dbis_core source code is not available on the Proxmox host, the scripts will automatically clone it from GitHub as a fallback.

