Reorganize proxmox documentation into subdirectories per LXC/VM

- Create cluster/ for Proxmox cluster infrastructure (SSH guide, HA monitor, UPS)
- Create lxc108-oracle/ for Oracle Database documentation and scripts
- Create vm201-windows/ for Windows 11 VM docs and SSL certificate scripts
- Add SSL certificate monitoring scripts (check-ssl-certificates.ps1, monitor-ssl-certificates.sh)
- Remove archived VM107 references (decommissioned)
- Update all cross-references between files
- Update main README.md with new structure and navigation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Marius
2026-01-27 17:02:49 +02:00
parent 1da4c2347c
commit 4d51d5b2d2
33 changed files with 954 additions and 593 deletions

View File

@@ -1,349 +1,189 @@
# Documentație Proxmox Infrastructure - ROMFASTSQL
## 📚 Structură Documentație
### 🏢 Infrastructură Generală
#### **proxmox-ssh-guide.md** - Ghid Complet Proxmox Cluster
**Când să folosești:** Pentru orice operațiuni legate de infrastructura Proxmox
**Conține:**
- Cluster Proxmox (3 noduri: pve1, pvemini, pveelite)
- Configurare SSH și acces noduri
- **Lista completă LXC containers cu IP-uri**
- **Lista completă Virtual Machines**
- Comenzi Proxmox generale (`pct`, `qm`, `pvesm`)
- Storage configuration (local-zfs, backup, backup-nfs)
- Backup jobs și politici retention
- **Hartă completă IP-uri** toate serviciile
- Troubleshooting Proxmox
---
### 📦 LXC Containers
#### **oracle-database-lxc108.md** - Oracle Database XE 21c
**LXC:** 108 (central-oracle) - IP: 10.0.20.121
**Host Proxmox:** pvemini (10.0.20.201)
**Când să folosești:** Pentru orice operațiuni legate de Oracle Database
**Conține:**
- Detalii container LXC 108 (Oracle XE 21c în Docker)
- **PDB-uri (roa, roa2) - toate detaliile**
- **Useri și parole Oracle** pentru fiecare PDB
- **Connection strings** (SQL*Plus, JDBC, TNS)
- Export/Import Data Pump (expdp, impdp)
- Comenzi SQL pentru verificări (tablespace, obiecte, useri)
- Troubleshooting Oracle specific
- Diferențe Oracle 10g vs 21c (istoric migrare)
---
### 💻 Virtual Machines
#### **vm201-windows11.md** - VM 201 (roacentral)
**VM:** 201 (roacentral) - Windows 11
**Host Proxmox:** pvemini (10.0.20.201)
**Când să folosești:** Pentru informații generale despre VM 201
**Conține:**
- Configurație hardware VM
- Rol și utilizare (client aplicații Windows, SQL*Plus, reverse proxy IIS)
- Servicii instalate
- Configurare rețea
- Backup și recovery
#### **vm201-certificat-letsencrypt-iis.md** - Certificat SSL IIS
**VM:** 201 (roacentral)
**Când să folosești:** Pentru configurare și reînnoire certificate Let's Encrypt pe IIS
**Conține:**
- Instalare Win-ACME pentru certificate Let's Encrypt
- Configurare IIS cu SNI (Server Name Indication)
- Binding-uri pentru multiple domenii
- Reînnoire automată certificate
- Troubleshooting SSL/TLS
- Scripturi PowerShell pentru configurare automată
#### **vm201-troubleshooting-backup-nfs.md** - Incident VM 201
**VM:** 201 (roacentral)
**Data:** 2025-10-08
**Când să folosești:** Pentru referință troubleshooting probleme similare
**Conține:**
- Incident VM locked și backup NFS blocat
- Diagnostic și rezolvare pas cu pas
- Comenzi HA management (ha-manager)
- Force reboot și recovery
- Lecții învățate și preventie
- Comenzi utile pentru diagnostic viitor
---
### 🌐 Cluster-Wide Resources
#### **cluster-ha-monitor.sh** - Monitorizare High Availability
**Scope:** Întreg cluster Proxmox (toate nodurile)
**Locație:** `/opt/scripts/cluster-ha-monitor.sh` pe noduri
**Când să folosești:** Pentru monitorizare automată HA cluster
**Conține:**
- Script bash monitorizare HA services
- Verificare quorum cluster
- Verificare noduri online
- Notificări prin PVE::Notify (email)
- Template-uri Handlebars pentru emailuri
- Logging automat
- Cron setup pentru rulare automată
**Instalare:**
```bash
scp proxmox/cluster-ha-monitor.sh root@10.0.20.201:/opt/scripts/
ssh root@10.0.20.201 "chmod +x /opt/scripts/cluster-ha-monitor.sh"
ssh root@10.0.20.201 "/opt/scripts/cluster-ha-monitor.sh --create-templates"
```
**Rulare:**
```bash
# Verificare normală (silent, trimite notificare)
/opt/scripts/cluster-ha-monitor.sh
# Verificare verbose (afișare pe console)
/opt/scripts/cluster-ha-monitor.sh -v
```
#### **ups/** - Sistem UPS pentru Cluster
**Scope:** Întreg cluster Proxmox (toate nodurile)
**Hardware:** INNO TECH USB UPS conectat la pvemini
**Când să folosești:** Pentru configurare, monitorizare și mentenanță UPS
**Conține:**
- `ups/README.md` - Ghid complet UPS
- `ups/docs/` - Documentație detaliată
- `INSTALARE-NUT.md` - Instalare NUT server pe Proxmox
- `INSTALARE-WINNUT.md` - Instalare client WinNUT pe Windows
- `UPS-SHUTDOWN-README.md` - Sistem shutdown orchestrat automat
- `UPS-MONTHLY-TEST.md` - Test lunar automat baterie
- `UPS-BATTERY-REPLACEMENT.md` - Procedură înlocuire baterie
- `ups/scripts/` - Scripturi automate
- `ups-shutdown-cluster.sh` - Shutdown orchestrat cluster
- `ups-shutdown-test.sh` - Test dry-run shutdown
- `ups-monthly-test.sh` - Test lunar baterie automat
- `ups-maintenance-shutdown.sh` - Shutdown pentru mentenanță
- `ups/config/` - Fișiere configurare NUT
**Quick Start:**
```bash
# Status UPS
ssh root@10.0.20.201 "upsc nutdev1"
# Test dry-run shutdown
ssh root@10.0.20.201 "/usr/local/bin/ups-shutdown-test.sh"
# Vezi ultimul test lunar baterie
ssh root@10.0.20.201 "tail -50 /var/log/ups-monthly-test.log"
```
---
### 📂 Archived / Decommissioned
#### **archived-vm107-monitor.sh** - VM 107 Monitor (DECOMMISSIONED)
**VM:** 107 (Oracle 10g Windows 7) - **NU MAI EXISTĂ**
**Status:** Script arhivat pentru referință istorică
**Notă:** VM 107 a fost decommissioned și înlocuit cu LXC 108 (Oracle XE 21c).
Vezi `oracle-database-lxc108.md` pentru sistemul actual.
---
## 🚀 Quick Start
### Acces în Proxmox
```bash
ssh root@10.0.20.201
```
### Acces în LXC 108 (Oracle)
```bash
ssh root@10.0.20.201
pct enter 108
```
### Restart Oracle Database
```bash
# Rapid (recomandat)
ssh root@10.0.20.201 "pct exec 108 -- docker restart oracle-xe"
# Restart complet LXC
ssh root@10.0.20.201 "pct restart 108"
```
### Conexiune Oracle
```bash
# SQL*Plus la PDB roa
sqlplus sys/romfastsoft@10.0.20.121:1521/roa as sysdba
# JDBC connection string
jdbc:oracle:thin:@10.0.20.121:1521/roa
```
---
## 📋 Hartă Rapidă Resurse
### Noduri Proxmox
| Nod | IP | Web GUI |
|-----|--------|---------|
| pve1 | 10.0.20.200 | https://10.0.20.200:8006 |
| **pvemini** | 10.0.20.201 | https://10.0.20.201:8006 |
| pveelite | 10.0.20.202 | https://10.0.20.202:8006 |
### LXC Containers (Servicii Active)
| VMID | Nume | IP | Serviciu | Documentație |
|------|------|-----|----------|--------------|
| 100 | portainer | 10.0.20.170 | Docker Management | proxmox-ssh-guide.md |
| 103 | dokploy | 10.0.20.167 | Deployment Platform | proxmox-ssh-guide.md |
| 104 | flowise | 10.0.20.161 | Flowise AI + Ollama | proxmox-ssh-guide.md |
| 106 | gitea | 10.0.20.165 | Git Server | proxmox-ssh-guide.md |
| **108** | **central-oracle** | **10.0.20.121** | **Oracle XE 21c** | **oracle-database-lxc108.md** |
### Virtual Machines
| VMID | Nume | OS | IP/Rol | Documentație |
|------|------|-----|--------|--------------|
| **201** | **roacentral** | **Windows 11** | **Client aplicații** | **vm201-windows11.md** |
| 300 | Win11-Template | Windows 11 | Template clonare | proxmox-ssh-guide.md |
---
## 🔗 Link-uri Utile
### Proxmox Cluster
- **pve1:** https://10.0.20.200:8006
- **pvemini:** https://10.0.20.201:8006
- **pveelite:** https://10.0.20.202:8006
### Oracle Database (LXC 108)
- Oracle Listener: `10.0.20.121:1521`
- Oracle EM Express: http://10.0.20.121:5500/em
- Portainer: http://10.0.20.121:9443
### Alte Servicii
- Portainer Principal: http://10.0.20.170:9443
- Gitea: http://10.0.20.165:3000
- Dokploy: http://10.0.20.167:3000
- Flowise AI: http://10.0.20.161:3000
---
## 📖 Navigare Rapidă - Am nevoie să...
### Infrastructură Proxmox
- **Văd toate VM-urile și LXC-urile** → `proxmox-ssh-guide.md`
- **Configurez SSH pe Proxmox** → `proxmox-ssh-guide.md` → "Configurare Inițială SSH"
- **Văd toate IP-urile** → `proxmox-ssh-guide.md` → "Hartă Rapidă IP-uri"
- **Creez backup VM/LXC** → `proxmox-ssh-guide.md` → "Gestiune Backup-uri"
### Oracle Database (LXC 108)
- **Restart Oracle Database** → `proxmox-ssh-guide.md` → "LXC 108 - Acces Rapid"
- **Conectez la Oracle Database** → `oracle-database-lxc108.md` → "Conexiuni Oracle"
- **Export/Import DMP Oracle** → `oracle-database-lxc108.md` → "Export și Import Data Pump"
- **Verific PDB-uri Oracle** → `oracle-database-lxc108.md` → "Verificări și Comenzi SQL"
### VM 201 (Windows 11)
- **Informații generale VM 201** → `vm201-windows11.md`
- **Configurez certificate SSL IIS** → `vm201-certificat-letsencrypt-iis.md`
- **Reînnoiesc certificate Let's Encrypt** → `vm201-certificat-letsencrypt-iis.md` → "Reînnoire"
- **Rezolv probleme VM locked** → `vm201-troubleshooting-backup-nfs.md` → "VM 201 Locked"
- **Rezolv probleme backup NFS** → `vm201-troubleshooting-backup-nfs.md` → "Storage backup-nfs"
### Cluster-Wide Resources
- **Monitorizez HA cluster** → `cluster-ha-monitor.sh` (script)
- **Configurez sistem UPS** → `ups/README.md`
- **Test shutdown cluster UPS** → `ups/docs/UPS-SHUTDOWN-README.md`
- **Test lunar baterie UPS** → `ups/docs/UPS-MONTHLY-TEST.md`
- **Înlocuiesc baterie UPS** → `ups/docs/UPS-BATTERY-REPLACEMENT.md`
---
## 📁 Structură Completă Directoare
## Structură Directoare
```
proxmox/
├── README.md # Acest fișier (index)
├── proxmox-ssh-guide.md # Ghid general Proxmox
├── README.md # Acest fișier (index principal)
├── oracle-database-lxc108.md # LXC 108 - Oracle XE 21c
├── cluster/ # Infrastructură cluster Proxmox
│ ├── README.md # Ghid SSH și administrare cluster
│ ├── cluster-ha-monitor.sh # Script monitorizare HA
│ └── ups/ # Sistem UPS pentru cluster
│ ├── README.md
│ ├── docs/
│ ├── scripts/
│ └── config/
├── vm201-windows11.md # VM 201 - Info generală
├── vm201-certificat-letsencrypt-iis.md # VM 201 - SSL certificates
├── vm201-troubleshooting-backup-nfs.md # VM 201 - Incident 2025-10-08
├── lxc108-oracle/ # LXC 108 - Oracle Database XE 21c
│ ├── README.md # Documentație completă Oracle
│ └── scripts/
│ ├── export-roa2.sh
│ └── export-roa2.ps1
├── cluster-ha-monitor.sh # Script monitorizare HA cluster
├── vm201-windows/ # VM 201 - Windows 11 (roacentral)
│ ├── README.md # Informații generale VM
│ ├── docs/
│ │ ├── vm201-certificat-letsencrypt-iis.md
│ │ ├── vm201-troubleshooting-backup-nfs.md
│ │ └── vm201-troubleshooting-pana-curent-2026-01-11.md
│ └── scripts/
│ ├── check-ssl-certificates.ps1
│ └── monitor-ssl-certificates.sh
── ups/ # Sistem UPS cluster
├── README.md # Ghid complet UPS
── docs/ # Documentație detaliată
│ │ ├── INSTALARE-NUT.md
│ │ ├── INSTALARE-WINNUT.md
│ │ ├── UPS-SHUTDOWN-README.md
│ │ ├── UPS-MONTHLY-TEST.md
│ │ └── UPS-BATTERY-REPLACEMENT.md
│ ├── scripts/ # Scripturi automate UPS
│ │ ├── ups-shutdown-cluster.sh
│ │ ├── ups-shutdown-test.sh
│ │ ├── ups-monthly-test.sh
│ │ └── ups-maintenance-shutdown.sh
│ └── config/ # Configurare NUT
│ ├── ups.conf
│ ├── upsd.conf
│ ├── upsd.users
│ ├── upsmon.conf
│ └── upssched.conf
├── scripts/ # Scripturi utilitare
│ ├── configure-iis-sni.ps1 # Configurare SNI IIS (VM 201)
│ └── verify-letsencrypt.ps1 # Verificare certificate (VM 201)
└── archived-vm107-monitor.sh # DECOMMISSIONED - VM 107
── claude-agent/ # Scripturi Claude Agent
├── README.md
── *.sh
```
---
## 🎯 Flux de Lucru Recomandat
## Documentație per Componentă
### Pentru o problemă nouă Oracle
1. **Citește:** `oracle-database-lxc108.md` → "Troubleshooting Oracle"
2. **Verifică:** Status PDB, conexiune, logs
3. **Documentează:** Notează problema și rezolvarea pentru viitor
### Cluster Proxmox
**Director:** `cluster/`
### Pentru configurare nouă VM 201
1. **Citește:** `vm201-windows11.md` pentru context
2. **Pentru SSL:** Vezi `vm201-certificat-letsencrypt-iis.md`
3. **Testează:** Verifică configurația
4. **Documentează:** Actualizează documentele relevante
| Fișier | Descriere |
|--------|-----------|
| `README.md` | Ghid complet: SSH, noduri, storage, comenzi Proxmox, hartă IP-uri |
| `cluster-ha-monitor.sh` | Script monitorizare High Availability |
| `ups/` | Sistem UPS: configurare NUT, shutdown orchestrat, test baterie |
### Pentru incident Proxmox
1. **Diagnostică:** Folosește `proxmox-ssh-guide.md` → "Troubleshooting"
2. **Referință:** Vezi `vm201-troubleshooting-backup-nfs.md` pentru exemple
3. **Rezolvă:** Aplică comenzile din ghiduri
4. **Documentează:** Creează un fișier nou troubleshooting pentru incident
**Quick Start:**
```bash
# Acces Proxmox
ssh root@10.0.20.201
### Pentru mentenanță UPS
1. **Citește:** `ups/README.md` pentru overview
2. **Verifică:** Status UPS și baterie
3. **Test:** Rulează `ups-shutdown-test.sh` pentru dry-run
4. **Mentenanță:** Vezi `ups/docs/UPS-BATTERY-REPLACEMENT.md` dacă e nevoie
# Status cluster
ssh root@10.0.20.201 "pvecm status"
# Status UPS
ssh root@10.0.20.201 "upsc nutdev1"
```
---
**Ultima actualizare:** 2025-11-19
### LXC 108 - Oracle Database
**Director:** `lxc108-oracle/`
**IP:** 10.0.20.121 | **Host:** pvemini
| Fișier | Descriere |
|--------|-----------|
| `README.md` | PDB-uri, useri, parole, connection strings, export/import DMP |
| `scripts/export-roa2.sh` | Script export PDB roa2 |
| `scripts/export-roa2.ps1` | Script export pentru Windows |
**Quick Start:**
```bash
# Acces în container
ssh root@10.0.20.201 "pct enter 108"
# Restart Oracle
ssh root@10.0.20.201 "pct exec 108 -- docker restart oracle-xe"
# Conexiune SQL*Plus
sqlplus sys/romfastsoft@10.0.20.121:1521/roa as sysdba
```
---
### VM 201 - Windows 11
**Director:** `vm201-windows/`
**IP:** DHCP | **Host:** pvemini | **Rol:** Reverse proxy IIS, client aplicații
| Fișier | Descriere |
|--------|-----------|
| `README.md` | Configurație hardware, servicii, rețea, backup |
| `docs/vm201-certificat-letsencrypt-iis.md` | Certificate SSL Let's Encrypt, Win-ACME, SNI |
| `docs/vm201-troubleshooting-backup-nfs.md` | Incident backup NFS (2025-10-08) |
| `docs/vm201-troubleshooting-pana-curent-2026-01-11.md` | Incident pană curent |
| `scripts/check-ssl-certificates.ps1` | Verificare/reînnoire certificate (Windows) |
| `scripts/monitor-ssl-certificates.sh` | Monitorizare certificate (Proxmox) |
**Quick Start:**
```bash
# Reînnoire certificate SSL (din Proxmox)
ssh root@10.0.20.201 "qm guest exec 201 -- powershell -Command 'cd C:\\Tools\\win-acme; .\\wacs.exe --renew --force'"
ssh root@10.0.20.201 "qm guest exec 201 -- cmd /c iisreset"
# Verificare certificate
echo | openssl s_client -connect roa.romfast.ro:443 -servername roa.romfast.ro 2>/dev/null | openssl x509 -noout -dates
```
---
## Hartă Rapidă Resurse
### Noduri Proxmox Cluster
| Nod | IP | Web GUI |
|-----|-----|---------|
| pve1 | 10.0.20.200 | https://10.0.20.200:8006 |
| **pvemini** | **10.0.20.201** | https://10.0.20.201:8006 |
| pveelite | 10.0.20.202 | https://10.0.20.202:8006 |
### LXC Containers
| VMID | Nume | IP | Serviciu | Documentație |
|------|------|-----|----------|--------------|
| 100 | portainer | 10.0.20.170 | Docker Management | `cluster/README.md` |
| 103 | dokploy | 10.0.20.167 | Deployment Platform | `cluster/README.md` |
| 104 | flowise | 10.0.20.161 | Flowise AI + Ollama | `cluster/README.md` |
| 106 | gitea | 10.0.20.165 | Git Server | `cluster/README.md` |
| **108** | **central-oracle** | **10.0.20.121** | **Oracle XE 21c** | **`lxc108-oracle/`** |
### Virtual Machines
| VMID | Nume | OS | Documentație |
|------|------|----|--------------|
| **201** | **roacentral** | **Windows 11** | **`vm201-windows/`** |
| 300 | Win11-Template | Windows 11 | `cluster/README.md` |
---
## Navigare Rapidă - Am nevoie să...
### Infrastructură
- **Văd toate IP-urile și serviciile** → `cluster/README.md`
- **Configurez SSH** → `cluster/README.md` → "Configurare Inițială SSH"
- **Monitorizez HA cluster** → `cluster/cluster-ha-monitor.sh`
- **Gestionez UPS** → `cluster/ups/README.md`
### Oracle Database (LXC 108)
- **Conectez la Oracle** → `lxc108-oracle/README.md` → "Conexiuni Oracle"
- **Export/Import DMP** → `lxc108-oracle/README.md` → "Export și Import Data Pump"
- **Restart Oracle** → `lxc108-oracle/README.md` → "Restart Oracle"
### Windows VM 201
- **Reînnoiesc certificate SSL** → `vm201-windows/docs/vm201-certificat-letsencrypt-iis.md`
- **Rezolv probleme VM locked** → `vm201-windows/docs/vm201-troubleshooting-backup-nfs.md`
- **Informații generale** → `vm201-windows/README.md`
---
## Servicii Web
| Serviciu | URL |
|----------|-----|
| Proxmox pvemini | https://10.0.20.201:8006 |
| Oracle EM Express | http://10.0.20.121:5500/em |
| Portainer (Oracle) | http://10.0.20.121:9443 |
| Portainer Principal | http://10.0.20.170:9443 |
| Gitea | http://10.0.20.165:3000 |
| Dokploy | http://10.0.20.167:3000 |
| Flowise AI | http://10.0.20.161:3000 |
---
## Task-uri Automate Configurate
| Task | Locație | Frecvență | Scop |
|------|---------|-----------|------|
| SSL Certificate Check | VM 201 Task Scheduler | Zilnic 07:00 | Verifică/reînnoiește certificate |
| SSL Monitor | Proxmox cron | Zilnic 08:00 | Monitorizare externă certificate |
| Win-ACME Renew | VM 201 Task Scheduler | Zilnic 09:00 | Reînnoire automată Let's Encrypt |
| UPS Monthly Test | Proxmox cron | Lunar | Test baterie UPS |
| Backup Job | Proxmox | Zilnic 02:00 | Backup toate LXC/VM |
---
**Ultima actualizare:** 2026-01-27
**Autor:** Marius Mutu
**Proiect:** ROMFASTSQL - Infrastructure Documentation

View File

@@ -1,102 +0,0 @@
#!/bin/bash
HOSTNAME=$(hostname)
DATE=$(date '+%Y-%m-%d %H:%M:%S')
VM_ID=107
LOG_FILE="/var/log/vm107-monitor.log"
STATE_FILE="/var/run/vm107-last-state"
check_vm_status() {
local vm_status=$(qm status $VM_ID 2>/dev/null | grep -oP 'status: \K.*')
if [ -z "$vm_status" ]; then
echo "ERROR:VM_NOT_FOUND"
return 1
fi
if [ "$vm_status" = "running" ]; then
if ps aux | grep -E "(kvm|qemu).*-id $VM_ID" | grep -qv grep; then
echo "RUNNING:OK"
return 0
else
echo "ERROR:PROCESS_MISSING"
return 1
fi
elif [ "$vm_status" = "stopped" ]; then
echo "STOPPED:VM_STOPPED"
return 1
elif [ "$vm_status" = "internal-error" ]; then
echo "ERROR:INTERNAL_ERROR"
return 1
else
echo "ERROR:UNKNOWN_STATE:$vm_status"
return 1
fi
}
RESULT=$(check_vm_status)
CHECK_EXIT=$?
STATUS=$(echo "$RESULT" | cut -d: -f1)
ERROR_TYPE=$(echo "$RESULT" | cut -d: -f2)
# Citește starea anterioară
LAST_STATE=""
[ -f "$STATE_FILE" ] && LAST_STATE=$(cat "$STATE_FILE")
echo "$(date '+%Y-%m-%d %H:%M:%S'): VM $VM_ID status: $STATUS ($ERROR_TYPE)" >> "$LOG_FILE"
# Verifică dacă starea s-a schimbat
CURRENT_STATE="$STATUS:$ERROR_TYPE"
if [ "$LAST_STATE" != "$CURRENT_STATE" ]; then
# Starea s-a schimbat - trimite email
SEND_EMAIL=true
if [ $CHECK_EXIT -eq 0 ]; then
# VM acum e OK
if [[ "$LAST_STATE" == STOPPED:* ]] || [[ "$LAST_STATE" == ERROR:* ]]; then
# Era oprit/eroare, acum e pornit - trimite email de recovery
SUBJECT="✅ VM $VM_ID RECOVERED - Running on $HOSTNAME"
BODY="VM $VM_ID has RECOVERED and is now RUNNING\n"
BODY+="Previous state: $LAST_STATE\n"
BODY+="Current state: RUNNING\n"
BODY+="Recovery time: $DATE\n"
BODY+="Host: $HOSTNAME\n\n"
BODY+="VM is now operating normally."
else
# Altă tranziție către RUNNING - nu trimite email
SEND_EMAIL=false
fi
else
# VM are probleme
SUBJECT="⚠️ VM $VM_ID $STATUS on $HOSTNAME"
BODY="VM $VM_ID Status: $STATUS\n"
BODY+="Error Type: $ERROR_TYPE\n"
BODY+="Check Time: $DATE\n"
BODY+="Host: $HOSTNAME\n\n"
if [ "$STATUS" = "STOPPED" ]; then
BODY+="VM is stopped. To start: qm start $VM_ID"
elif [ "$ERROR_TYPE" = "INTERNAL_ERROR" ]; then
BODY+="VM has internal-error (KVM crash)."
elif [ "$ERROR_TYPE" = "PROCESS_MISSING" ]; then
BODY+="VM marked as running but process missing."
fi
fi
# Trimite email dacă e necesar
if [ "$SEND_EMAIL" = true ]; then
echo -e "$BODY" | mail -s "$SUBJECT" root
echo "$(date '+%Y-%m-%d %H:%M:%S'): Email sent - state changed from '$LAST_STATE' to '$CURRENT_STATE'" >> "$LOG_FILE"
else
echo "$(date '+%Y-%m-%d %H:%M:%S'): State changed but no email needed" >> "$LOG_FILE"
fi
else
echo "$(date '+%Y-%m-%d %H:%M:%S'): No email - state unchanged ($CURRENT_STATE)" >> "$LOG_FILE"
fi
# Salvează starea curentă
echo "$CURRENT_STATE" > "$STATE_FILE"
exit $CHECK_EXIT

View File

@@ -299,7 +299,7 @@ Pentru detalii despre:
- Export/import DMP
- Comenzi SQL și troubleshooting
**Vezi:** `proxmox/oracle-database-lxc108.md`
**Vezi:** `../lxc108-oracle/README.md`
---
@@ -365,7 +365,7 @@ cat /etc/pve/corosync.conf
### Accesuri Rapide
```bash
# Oracle Database (LXC 108) - Vezi proxmox/oracle-database-lxc108.md pentru detalii
# Oracle Database (LXC 108) - Vezi ../lxc108-oracle/README.md pentru detalii
nc -zv 10.0.20.121 1521 # Test port Oracle
sqlplus sys/romfastsoft@10.0.20.121:1521/roa as sysdba
@@ -386,7 +386,7 @@ http://10.0.20.161:3000
```
**Pentru conexiuni Oracle detaliate (PDB-uri, useri, TNS, export DMP):**
Vezi fișierul `proxmox/oracle-database-lxc108.md`
Vezi fișierul `../lxc108-oracle/README.md`
---
@@ -483,114 +483,25 @@ systemctl restart pveproxy
---
## 📖 Documentație Asociată
## Documentație Asociată
### Documentație Index Principal
- **README.md** - Index complet documentație Proxmox cu navigare rapidă
### Index Principal
- **README.md** - `../README.md` - Index complet documentație Proxmox
### LXC Containers - Documentație Detaliată
### LXC Containers
- **LXC 108 - Oracle Database:** `../lxc108-oracle/README.md`
#### LXC 108 - Oracle Database XE 21c
- **Fișier:** `oracle-database-lxc108.md`
- **Când să folosești:** Pentru orice operațiuni legate de Oracle Database
- **Conține:**
- PDB-uri (roa, roa2) - useri, parole, connection strings
- Export/Import Data Pump (expdp, impdp)
- Comenzi SQL pentru verificări (tablespace, obiecte, useri)
- Troubleshooting Oracle specific
- Diferențe Oracle 10g vs 21c (istoric migrare)
### Virtual Machines
- **VM 201 - Windows 11:** `../vm201-windows/README.md`
- SSL Certificates: `../vm201-windows/docs/vm201-certificat-letsencrypt-iis.md`
- Troubleshooting: `../vm201-windows/docs/`
### Virtual Machines - Documentație Detaliată
#### VM 201 - Windows 11 (roacentral)
**Documentație Generală:**
- **Fișier:** `vm201-windows11.md`
- **Când să folosești:** Pentru informații generale despre VM 201
- **Conține:**
- Configurație hardware și software
- Rol și utilizare (client aplicații, SQL*Plus, reverse proxy IIS)
- Servicii instalate (IIS, Win-ACME, WinNUT, RDP)
- Configurare rețea și firewall
- Backup și recovery
- Troubleshooting comun
**Documentație SSL/TLS:**
- **Fișier:** `vm201-certificat-letsencrypt-iis.md`
- **Când să folosești:** Pentru configurare și reînnoire certificate Let's Encrypt
- **Conține:**
- Instalare Win-ACME pentru certificate automate
- Configurare IIS cu SNI (Server Name Indication)
- Binding-uri pentru multiple domenii (roa.romfast.ro, dokploy.romfast.ro, gitea.romfast.ro)
- Reînnoire automată certificate
- Troubleshooting SSL/TLS
- Scripturi PowerShell pentru configurare automată
**Documentație Troubleshooting:**
- **Fișier:** `vm201-troubleshooting-backup-nfs.md`
- **Când să folosești:** Pentru referință troubleshooting probleme similare
- **Conține:**
- Incident VM locked și backup NFS blocat (2025-10-08)
- Diagnostic și rezolvare pas cu pas
- Comenzi HA management (ha-manager)
- Force reboot și recovery
- Lecții învățate și preventie
### Cluster-Wide Resources - Scripts și Sisteme
#### Monitorizare High Availability
- **Fișier:** `cluster-ha-monitor.sh`
- **Când să folosești:** Pentru monitorizare automată HA cluster
- **Conține:**
- Script bash monitorizare HA services (pve-ha-lrm, pve-ha-crm)
- Verificare quorum cluster
- Verificare noduri online
- Notificări prin PVE::Notify (email)
- Template-uri Handlebars pentru emailuri
- Logging automat
**Instalare și rulare:**
```bash
# Instalare
scp proxmox/cluster-ha-monitor.sh root@10.0.20.201:/opt/scripts/
ssh root@10.0.20.201 "chmod +x /opt/scripts/cluster-ha-monitor.sh"
ssh root@10.0.20.201 "/opt/scripts/cluster-ha-monitor.sh --create-templates"
# Rulare verbose
ssh root@10.0.20.201 "/opt/scripts/cluster-ha-monitor.sh -v"
```
#### Sistem UPS pentru Cluster
- **Director:** `ups/`
- **Când să folosești:** Pentru configurare, monitorizare și mentenanță UPS
- **Conține:**
- `ups/README.md` - Ghid complet sistem UPS
- `ups/docs/` - Documentație detaliată (instalare NUT, WinNUT, shutdown orchestrat, test lunar baterie, înlocuire baterie)
- `ups/scripts/` - Scripturi automate (shutdown cluster, test dry-run, test lunar, mentenanță)
- `ups/config/` - Fișiere configurare NUT
**Quick start UPS:**
```bash
# Status UPS
ssh root@10.0.20.201 "upsc nutdev1"
# Test dry-run shutdown
ssh root@10.0.20.201 "/usr/local/bin/ups-shutdown-test.sh"
# Vezi ultimul test lunar baterie
ssh root@10.0.20.201 "tail -50 /var/log/ups-monthly-test.log"
```
### Archived / Decommissioned
#### VM 107 Monitor Script (DECOMMISSIONED)
- **Fișier:** `archived-vm107-monitor.sh`
- **Status:** Script arhivat pentru referință istorică
- **Notă:** VM 107 (Oracle 10g Windows 7) a fost decommissioned și înlocuit cu LXC 108 (Oracle XE 21c)
- **Vezi:** `oracle-database-lxc108.md` pentru sistemul actual
### Cluster Resources (acest director)
- **HA Monitor:** `cluster-ha-monitor.sh`
- **Sistem UPS:** `ups/README.md`
---
**Ultima actualizare:** 2025-11-19
**Ultima actualizare:** 2026-01-27
**Autor:** Marius Mutu
**Proiect:** ROMFASTSQL - Proxmox Infrastructure Documentation

View File

@@ -1,4 +1,4 @@
# Oracle Database XE 21c - LXC 108 (Proxmox)
# Oracle Database XE - LXC 108 (Proxmox)
## 📌 Informații Container LXC
@@ -11,7 +11,14 @@
- **Storage:** 50 GB (local-zfs)
- **Status:** Running
- **OS:** Ubuntu/Debian (LXC)
- **Docker Container:** oracle-xe (Oracle XE 21c)
- **Docker Containers:** oracle-xe (21c), oracle18-xe (18c)
## 📋 Sumar Containere Docker
| Container | Port | Versiune | TSTZ | Utilizare |
|-----------|------|----------|------|-----------|
| oracle-xe | 1521 | 21c | 35 | Dezvoltare, ROA, ROA2 |
| oracle18-xe | 1522 | 18c | 31 | Export compatibil 11g/18c/19c |
---
@@ -30,9 +37,70 @@
| 1521 | Oracle Listener | Conexiuni SQL*Plus, JDBC |
| 5500 | Oracle EM Express | Enterprise Manager Web Interface |
### Volume Docker Montate (oracle-xe)
| Container Path | LXC 108 Path | Descriere |
|----------------|--------------|-----------|
| /opt/oracle/oradata | /opt/oracle/oradata | Date Oracle, tablespaces |
| /opt/oracle/oradata/dmpdir | /opt/oracle/oradata/dmpdir | Export/Import DMP (DMPDIR) |
| /opt/oracle/scripts/setup | /opt/oracle/scripts/setup | Scripturi setup |
| /opt/oracle/scripts/startup | /opt/oracle/scripts/startup | Scripturi startup |
---
## 🔗 Conexiuni Oracle Database
## 🐳 Oracle XE 18c în Docker (Export Compatibil)
> **Scop:** Export DMP compatibil cu Oracle 11g, 18c, 19c (TSTZ version 31)
### Informații Container Docker
- **Container Name:** oracle18-xe
- **Image:** gvenzl/oracle-xe:18
- **Versiune:** Oracle Database 18c Express Edition
- **Port:** 1522
- **TSTZ Version:** 31 (compatibil cu 11g/18c/19c)
### Volume Docker Montate (oracle18-xe)
| Container Path | LXC 108 Path | Descriere |
|----------------|--------------|-----------|
| /opt/oracle/oradata | /opt/oracle/oradata18 | Date Oracle 18c |
| /opt/oracle/oradata/dmpdir | /opt/oracle/oradata/dmpdir | Export/Import DMP (partajat) |
### Conexiune Oracle 18c
```bash
# SQL*Plus
sqlplus sys/romfastsoft@10.0.20.121:1522/XE as sysdba
sqlplus system/romfastsoft@10.0.20.121:1522/XE
# JDBC
jdbc:oracle:thin:@10.0.20.121:1522/XE
```
### Export Compatibil din Oracle 18c
```bash
# Export schema (compatibil cu Oracle 11g, 18c, 19c)
docker exec oracle18-xe expdp system/romfastsoft@localhost:1521/XE \
SCHEMAS=FIRMANOUA DIRECTORY=DMPDIR DUMPFILE=firmanoua_v18.dmp VERSION=11.2
```
### Recreare Container Oracle 18c (dacă e necesar)
```bash
docker pull gvenzl/oracle-xe:18
docker run -d --name oracle18-xe \
-p 1522:1521 \
-e ORACLE_PASSWORD=romfastsoft \
-v /opt/oracle/oradata18:/opt/oracle/oradata \
-v /opt/oracle/oradata/dmpdir:/opt/oracle/oradata/dmpdir \
gvenzl/oracle-xe:18
# Creare DMPDIR
docker exec oracle18-xe bash -c "sqlplus -s sys/romfastsoft@localhost:1521/XE as sysdba <<EOF
CREATE OR REPLACE DIRECTORY DMPDIR AS '/opt/oracle/oradata/dmpdir';
GRANT READ, WRITE ON DIRECTORY DMPDIR TO PUBLIC;
EOF"
```
---
## 🔗 Conexiuni Oracle Database (21c)
### Container Database (CDB)
- **CDB Name:** XE
@@ -182,48 +250,49 @@ docker exec oracle-xe sqlplus sys/romfastsoft@localhost:1521/roa as sysdba
## 📦 Export și Import Data Pump
### Export Schema FIRMANOUA din ROA2
> **DMPDIR** - Director Oracle montat direct pe LXC 108: `/opt/oracle/oradata/dmpdir`
> Fișierele DMP sunt accesibile direct, fără `docker cp`.
### Export Complet ROA2 (Script)
```bash
# Export complet schema
ssh root@10.0.20.201 'pct exec 108 -- docker exec oracle-xe expdp system/romfastsoft@localhost:1521/roa2 \
SCHEMAS=FIRMANOUA \
DIRECTORY=DATA_PUMP_DIR \
DUMPFILE=firmanoua_template_%U.dmp \
LOGFILE=firmanoua_template.log \
PARALLEL=2'
# Rulează din LXC 108
pct exec 108 -- bash /opt/oracle/oradata/export-roa2.sh
```
Rezultat: `/opt/oracle/oradata/dmpdir/roa2_export_YYYYMMDD_HHMMSS.zip`
### Export Individual
```bash
docker exec oracle-xe expdp system/romfastsoft@localhost:1521/roa2 \
SCHEMAS=FIRMANOUA DIRECTORY=DMPDIR DUMPFILE=firmanoua.dmp COMPRESSION=ALL
docker exec oracle-xe expdp system/romfastsoft@localhost:1521/roa2 \
SCHEMAS=CONTAFIN_ORACLE DIRECTORY=DMPDIR DUMPFILE=contafin.dmp COMPRESSION=ALL
```
### Export Schema CONTAFIN_ORACLE din ROA2
### Import în PDB
```bash
ssh root@10.0.20.201 'pct exec 108 -- docker exec oracle-xe expdp system/romfastsoft@localhost:1521/roa2 \
SCHEMAS=CONTAFIN_ORACLE \
DIRECTORY=DATA_PUMP_DIR \
DUMPFILE=contafin_template_%U.dmp \
LOGFILE=contafin_template.log \
PARALLEL=2'
docker exec oracle-xe impdp system/romfastsoft@localhost:1521/roa \
SCHEMAS=FIRMANOUA DIRECTORY=DMPDIR DUMPFILE=firmanoua.dmp LOGFILE=firmanoua_import.log
```
### Import în PDB Nou
### Copiere DMP din LXC 108 în WSL
```bash
# Import schema în PDB existent
ssh root@10.0.20.201 'pct exec 108 -- docker exec oracle-xe impdp system/romfastsoft@localhost:1521/roa \
SCHEMAS=FIRMANOUA \
DIRECTORY=DATA_PUMP_DIR \
DUMPFILE=firmanoua_template_%U.dmp \
LOGFILE=firmanoua_import.log \
PARALLEL=2'
scp root@10.0.20.201:/opt/oracle/oradata/dmpdir/firmanoua.dmp /mnt/e/backups/
```
### Copiere Fișiere DMP din/în Container
### Recreare DMPDIR (dacă e necesar)
```bash
# Copiere DMP din Oracle container în LXC 108
ssh root@10.0.20.201 "pct exec 108 -- docker cp oracle-xe:/opt/oracle/admin/XE/dpdump/firmanoua_template_01.dmp /tmp/"
# 1. Creează folder pe LXC 108
pct exec 108 -- mkdir -p /opt/oracle/oradata/dmpdir
pct exec 108 -- chmod 777 /opt/oracle/oradata/dmpdir
# Copiere DMP din LXC 108 în WSL
scp root@10.0.20.201:/var/lib/lxc/108/rootfs/tmp/firmanoua_template_01.dmp /mnt/e/backups/
# Copiere DMP în Oracle container (pentru import)
ssh root@10.0.20.201 "pct exec 108 -- docker cp /tmp/firmanoua_template_01.dmp oracle-xe:/opt/oracle/admin/XE/dpdump/"
# 2. Creează DIRECTORY Oracle în fiecare PDB
for pdb in XE roa roa2; do
pct exec 108 -- docker exec oracle-xe bash -c "sqlplus -s sys/romfastsoft@localhost:1521/$pdb as sysdba <<EOF
CREATE OR REPLACE DIRECTORY DMPDIR AS '/opt/oracle/oradata/dmpdir';
GRANT READ, WRITE ON DIRECTORY DMPDIR TO PUBLIC;
EOF"
done
```
---
@@ -392,6 +461,15 @@ ssh root@10.0.20.201 "pct exec 108 -- docker exec oracle-xe tail -100 /opt/oracl
## 📝 Notițe Importante
### Compatibilitate TSTZ (Time Zone)
| Versiune | TSTZ | Compatibilitate Import |
|----------|------|------------------------|
| Oracle 21c | 35 | Doar 21c+ |
| Oracle 18c | 31 | 11g, 18c, 19c, 21c |
| Oracle 19c | 32 | 11g, 18c, 19c, 21c |
> **Important:** Pentru export compatibil cu clienți Oracle 11g/18c/19c, folosește **oracle18-xe** (port 1522).
### Diferențe Oracle 10g vs 21c
- **Oracle 10g** folosește SID (ORCL) - sistem vechi, decommissioned
- **Oracle 21c** folosește SERVICE_NAME (roa, roa2) - sistem actual
@@ -409,12 +487,6 @@ ssh root@10.0.20.201 "pct exec 108 -- docker exec oracle-xe tail -100 /opt/oracl
- **Rol:** Client pentru aplicații Windows, SQL*Plus client
- **NU** rulează Oracle Database (migrat în LXC 108 Docker)
### Istoric Migrare
- **VM 107 (Windows 7 Oracle 10g)** - DECOMMISSIONED
- Fostă sursă Oracle 10g pentru migrare DMP
- Archive DMP: firmanoua.zip (backup arhivat)
- Status: Stopped/Removed (înlocuit de LXC 108)
---
## 🔗 Legături Utile
@@ -430,6 +502,6 @@ http://10.0.20.121:9443
---
**Data ultimei actualizări:** 2025-11-19
**Data ultimei actualizări:** 2026-01-27
**Autor:** Marius Mutu
**Proiect:** ROMFASTSQL - Oracle XE 21c în Proxmox LXC
**Proiect:** ROMFASTSQL - Oracle XE 18c/21c în Proxmox LXC

View File

@@ -0,0 +1,186 @@
# Export ROA2 schemas și copiere pe Windows
# Rulează din PowerShell: .\export-roa2.ps1
$BackupDir = "E:\backups\oracle"
$Proxmox = "root@10.0.20.201"
$DmpDir = "/opt/oracle/oradata/dmpdir"
# Creează directorul backup dacă nu există
if (!(Test-Path $BackupDir)) {
New-Item -ItemType Directory -Path $BackupDir | Out-Null
}
function Get-RemoteArchives {
$result = ssh $Proxmox "pct exec 108 -- bash -c 'ls -lt $DmpDir/*.tar.gz 2>/dev/null'" 2>$null
if ($result) {
$archives = @()
foreach ($line in $result) {
if ($line -match '(\S+\.tar\.gz)$') {
$fullPath = $matches[1]
$name = Split-Path $fullPath -Leaf
$size = ($line -split '\s+')[4]
$date = ($line -split '\s+')[5..7] -join ' '
$archives += [PSCustomObject]@{
Name = $name
Size = $size
Date = $date
Path = $fullPath
}
}
}
return $archives
}
return @()
}
function Copy-Archive($archivePath) {
$name = Split-Path $archivePath -Leaf
Write-Host " Copying: $name..." -NoNewline
ssh $Proxmox "pct pull 108 $archivePath /tmp/$name"
scp "${Proxmox}:/tmp/$name" "$BackupDir\" 2>$null
ssh $Proxmox "rm -f /tmp/$name" 2>$null
Write-Host " Done" -ForegroundColor Green
}
function Run-Export {
Write-Host "`nSelecteaza sursa Oracle:" -ForegroundColor Cyan
Write-Host " 1. Oracle 18c (port 1522) - Compatibil 11g/18c/19c (Recomandat)"
Write-Host " 2. Oracle 21c (port 1521) - ROA2"
$srcChoice = Read-Host "Selecteaza sursa [1]"
$oracleVer = switch ($srcChoice) {
'2' { '21' }
default { '18' }
}
if ($oracleVer -eq '18') {
Write-Host "`nExport din Oracle 18c (TSTZ 31 - compatibil 11g/18c/19c)..." -ForegroundColor Green
} else {
Write-Host "`nExport din Oracle 21c ROA2 (TSTZ 35 - doar 21c+)..." -ForegroundColor Yellow
}
ssh $Proxmox "pct exec 108 -- bash /opt/oracle/oradata/export-roa2.sh $oracleVer"
# Copiază cele mai noi 2 arhive
Write-Host "`nCopying new archives..." -ForegroundColor Yellow
$archives = Get-RemoteArchives | Select-Object -First 2
foreach ($archive in $archives) {
Copy-Archive $archive.Path
}
}
function Select-Archives {
$archives = Get-RemoteArchives
if ($archives.Count -eq 0) {
Write-Host "No archives found on LXC 108!" -ForegroundColor Red
return
}
Write-Host "`nAvailable archives:" -ForegroundColor Cyan
for ($i = 0; $i -lt $archives.Count; $i++) {
Write-Host " $($i + 1). $($archives[$i].Name) [$($archives[$i].Size)] - $($archives[$i].Date)"
}
Write-Host " A. All archives"
Write-Host " 0. Cancel"
$choice = Read-Host "`nSelect archives (e.g., 1,3 or A for all)"
if ($choice -eq '0' -or [string]::IsNullOrWhiteSpace($choice)) {
return
}
Write-Host "`nCopying to $BackupDir..." -ForegroundColor Yellow
if ($choice -eq 'A' -or $choice -eq 'a') {
foreach ($archive in $archives) {
Copy-Archive $archive.Path
}
} else {
$indices = $choice -split ',' | ForEach-Object { [int]$_.Trim() - 1 }
foreach ($i in $indices) {
if ($i -ge 0 -and $i -lt $archives.Count) {
Copy-Archive $archives[$i].Path
}
}
}
}
function Clean-RemoteArchives {
$archives = Get-RemoteArchives
if ($archives.Count -eq 0) {
Write-Host "No archives to clean!" -ForegroundColor Yellow
return
}
Write-Host "`nArchives on LXC 108:" -ForegroundColor Cyan
for ($i = 0; $i -lt $archives.Count; $i++) {
Write-Host " $($i + 1). $($archives[$i].Name) [$($archives[$i].Size)] - $($archives[$i].Date)"
}
Write-Host "`n A. Delete ALL archives"
Write-Host " 0. Cancel"
$choice = Read-Host "`nSelect archives to delete (e.g., 1,3 or A for all)"
if ($choice -eq '0' -or [string]::IsNullOrWhiteSpace($choice)) {
return
}
$toDelete = @()
if ($choice -eq 'A' -or $choice -eq 'a') {
$toDelete = $archives
} else {
$indices = $choice -split ',' | ForEach-Object { [int]$_.Trim() - 1 }
foreach ($i in $indices) {
if ($i -ge 0 -and $i -lt $archives.Count) {
$toDelete += $archives[$i]
}
}
}
if ($toDelete.Count -gt 0) {
Write-Host "`nDeleting $($toDelete.Count) archive(s)..." -ForegroundColor Yellow
foreach ($archive in $toDelete) {
ssh $Proxmox "pct exec 108 -- rm -f $($archive.Path)"
Write-Host " Deleted: $($archive.Name)" -ForegroundColor Red
}
}
}
# Main Menu
Clear-Host
Write-Host "=== Export ROA2 ===" -ForegroundColor Cyan
Write-Host ""
Write-Host " 1. Export nou si copiere arhive"
Write-Host " 2. Copiere arhive existente"
Write-Host " 3. Curatare arhive pe LXC 108"
Write-Host " 0. Iesire"
Write-Host ""
$choice = Read-Host "Selecteaza optiune"
switch ($choice) {
'1' {
Run-Export
}
'2' {
Select-Archives
}
'3' {
Clean-RemoteArchives
}
'0' {
Write-Host "Bye!" -ForegroundColor Gray
exit
}
default {
Write-Host "Optiune invalida!" -ForegroundColor Red
exit
}
}
Write-Host "`n=== Done! ===" -ForegroundColor Cyan
Get-ChildItem $BackupDir\*.tar.gz -ErrorAction SilentlyContinue |
Sort-Object LastWriteTime -Descending |
Select-Object -First 6 |
Format-Table Name, @{N='Size(MB)';E={[math]::Round($_.Length/1MB,1)}}, LastWriteTime

View File

@@ -0,0 +1,47 @@
#!/bin/bash
# Export CONTAFIN_ORACLE și FIRMANOUA, arhive separate tar.gz
# Rulează din LXC 108: ./export-roa2.sh [18|21]
# 18 = Oracle 18c (compatibil 11g/18c/19c) | 21 = Oracle 21c (default)
DMPDIR="/opt/oracle/oradata/dmpdir"
DATE=$(date +%Y%m%d_%H%M%S)
SCHEMAS="CONTAFIN_ORACLE FIRMANOUA"
ORACLE_VER=${1:-21}
if [ "$ORACLE_VER" == "18" ]; then
CONTAINER="oracle18-xe"
PORT="1521"
SERVICE="XE"
SUFFIX="_v18"
VERSION="11.2"
echo "=== Export Oracle 18c (compatibil 11g/18c/19c) - $DATE ==="
else
CONTAINER="oracle-xe"
PORT="1521"
SERVICE="roa2"
SUFFIX="_v21"
VERSION="12"
echo "=== Export Oracle 21c - $DATE ==="
fi
cd $DMPDIR
for SCHEMA in $SCHEMAS; do
echo "Exporting $SCHEMA from $CONTAINER..."
docker exec $CONTAINER expdp system/romfastsoft@localhost:$PORT/$SERVICE \
SCHEMAS=$SCHEMA \
DIRECTORY=DMPDIR \
DUMPFILE=${SCHEMA}_${DATE}.dmp \
LOGFILE=${SCHEMA}_${DATE}.log \
VERSION=$VERSION \
EXCLUDE=STATISTICS
# Arhivare individuală
ARCHIVE="${SCHEMA}${SUFFIX}_${DATE}.tar.gz"
echo "Creating archive: $ARCHIVE"
tar -czvf "$ARCHIVE" ${SCHEMA}_${DATE}.dmp ${SCHEMA}_${DATE}.log
rm -f ${SCHEMA}_${DATE}.dmp ${SCHEMA}_${DATE}.log
done
echo "=== Done! ==="
ls -lh $DMPDIR/*_${DATE}.tar.gz

View File

@@ -0,0 +1,84 @@
# Context pentru Sesiunea Următoare - Import Oracle 18c
## Rezumat Situație
### Ce s-a făcut:
1. **Oracle 18c XE instalat** pe LXC 108 (port 1522)
- Container: `oracle18-xe`
- TSTZ Version: **31** (compatibil cu 11g/18c/19c)
- Image: `gvenzl/oracle-xe:18`
2. **Oracle 21c XE** existent (port 1521)
- Container: `oracle-xe`
- TSTZ Version: **35**
- PDB-uri: ROA, ROA2 cu scheme CONTAFIN_ORACLE, FIRMANOUA
3. **Scripturi actualizate:**
- `export-roa2.sh` - suportă export din Oracle 18c sau 21c
- `export-roa2.ps1` - meniu PowerShell pentru export/copiere
4. **DMPDIR** creat pe ambele containere (partajat): `/opt/oracle/oradata/dmpdir`
### Problema TSTZ:
- Oracle 21c are TSTZ 35, Oracle 18c are TSTZ 31
- Import direct din 21c în 18c dă eroarea **ORA-39405**
- Soluție: folosește DMP-uri mai vechi (TSTZ ≤ 31)
## Ce rămâne de făcut:
### 1. Creează DMPDIR în Oracle 18c (dacă nu e deja):
```bash
docker exec oracle18-xe bash -c "sqlplus -s / as sysdba <<EOF
CREATE OR REPLACE DIRECTORY DMPDIR AS '/opt/oracle/oradata/dmpdir';
GRANT READ, WRITE ON DIRECTORY DMPDIR TO PUBLIC;
EOF"
```
### 2. Import DMP-uri vechi în Oracle 18c:
Utilizatorul a copiat fișiere DMP vechi în `/opt/oracle/oradata/dmpdir/`:
- `contafin_oracle.dmp`
- `firmanoua.dmp`
```bash
# Import CONTAFIN_ORACLE
docker exec oracle18-xe impdp system/romfastsoft@localhost:1521/XE \
SCHEMAS=CONTAFIN_ORACLE DIRECTORY=DMPDIR \
DUMPFILE=contafin_oracle.dmp LOGFILE=import_contafin.log
# Import FIRMANOUA
docker exec oracle18-xe impdp system/romfastsoft@localhost:1521/XE \
SCHEMAS=FIRMANOUA DIRECTORY=DMPDIR \
DUMPFILE=firmanoua.dmp LOGFILE=import_firmanoua.log
```
### 3. Verifică schemele importate:
```sql
SELECT owner, COUNT(*) FROM dba_objects
WHERE owner IN ('CONTAFIN_ORACLE', 'FIRMANOUA')
GROUP BY owner;
```
### 4. Test export compatibil:
```bash
./export-roa2.sh 18
# Sau din PowerShell: .\export-roa2.ps1 → Opțiunea 1 → Oracle 18c
```
## Conexiuni:
| Container | Port | Conexiune |
|-----------|------|-----------|
| oracle-xe (21c) | 1521 | `sqlplus sys/romfastsoft@10.0.20.121:1521/XE as sysdba` |
| oracle18-xe (18c) | 1522 | `sqlplus sys/romfastsoft@10.0.20.121:1522/XE as sysdba` |
## Fișiere relevante:
- Documentație: `/mnt/e/proiecte/ROMFASTSQL/proxmox/oracle-database-lxc108.md`
- Script bash: `/mnt/e/proiecte/ROMFASTSQL/proxmox/scripts/export-roa2.sh`
- Script PowerShell: `/mnt/e/proiecte/ROMFASTSQL/proxmox/scripts/export-roa2.ps1`
- DMP-uri vechi: `/opt/oracle/oradata/dmpdir/` (pe LXC 108)
## Scop final:
Export DMP din Oracle 18c (TSTZ 31) compatibil cu Oracle 11g, 18c, 19c pentru clienți.
---
Data: 2026-01-27

View File

@@ -335,20 +335,24 @@ ssh root@10.0.20.201 "qm delsnapshot 201 pre-update-snapshot"
---
## 📖 Documentație Asociată
## Documentație Asociată
### Documentație VM 201 Specifică
- **SSL Certificates IIS:** `vm201-certificat-letsencrypt-iis.md`
- **Troubleshooting Incident 2025-10-08:** `vm201-troubleshooting-backup-nfs.md`
- **Troubleshooting Pană Curent 2026-01-11:** `vm201-troubleshooting-pana-curent-2026-01-11.md`
- **SSL Certificates IIS:** `docs/vm201-certificat-letsencrypt-iis.md`
- **Troubleshooting Incident 2025-10-08:** `docs/vm201-troubleshooting-backup-nfs.md`
- **Troubleshooting Pană Curent 2026-01-11:** `docs/vm201-troubleshooting-pana-curent-2026-01-11.md`
### Scripturi VM 201
- **Verificare certificate (Windows):** `scripts/check-ssl-certificates.ps1`
- **Monitorizare certificate (Proxmox):** `scripts/monitor-ssl-certificates.sh`
### Documentație Infrastructură Generală
- **Proxmox Cluster General:** `proxmox-ssh-guide.md`
- **Oracle Database (LXC 108):** `oracle-database-lxc108.md`
- **Proxmox Cluster General:** `../cluster/README.md`
- **Oracle Database (LXC 108):** `../lxc108-oracle/README.md`
### Documentație UPS
- **Instalare WinNUT Client:** `ups/docs/INSTALARE-WINNUT.md`
- **Sistem UPS Cluster:** `ups/README.md`
- **Instalare WinNUT Client:** `../cluster/ups/docs/INSTALARE-WINNUT.md`
- **Sistem UPS Cluster:** `../cluster/ups/README.md`
---

View File

@@ -156,20 +156,28 @@ Folosește scriptul: `configure-iis-sni.ps1`
## Scripturi Utile
### Script Complet Configurare SNI
Locație: `/mnt/e/proiecte/ROMFASTSQL/proxmox/scripts/configure-iis-sni.ps1`
### Script Verificare/Reînnoire Certificate (PowerShell)
**Locație repo:** `../scripts/check-ssl-certificates.ps1`
**Locație VM 201:** `D:\kit\ssl\check-ssl-certificates.ps1`
```powershell
cd D:\kit\ssl
.\configure-iis-sni.ps1
# Verificare manuală
D:\kit\ssl\check-ssl-certificates.ps1 -Verbose
# Forțare reinstalare toate certificatele
D:\kit\ssl\check-ssl-certificates.ps1 -Force -Verbose
```
### Script Verificare Certificate
Locație: `/mnt/e/proiecte/ROMFASTSQL/proxmox/scripts/verify-letsencrypt.ps1`
### Script Monitorizare Certificate (Bash - Proxmox)
**Locație repo:** `../scripts/monitor-ssl-certificates.sh`
**Locație Proxmox:** `/opt/scripts/monitor-ssl-certificates.sh`
```powershell
cd D:\kit\ssl
.\verify-letsencrypt.ps1
```bash
# Verificare manuală
/opt/scripts/monitor-ssl-certificates.sh
# Verificare log
tail -50 /var/log/ssl-monitor.log
```
## Comenzi Rapide
@@ -192,6 +200,55 @@ cd C:\Tools\win-acme
iisreset
```
## Monitorizare Automată Certificate
### Problema Cunoscută
Win-acme poate reînnoi certificatele, dar IIS uneori nu aplică noile certificate pe binding-uri.
Acest lucru cauzează servirea certificatelor expirate chiar dacă cele noi sunt în Certificate Store.
### Soluția: Scripturi de Monitorizare
#### 1. Script PowerShell pe VM 201
**Locație:** `D:\kit\ssl\check-ssl-certificates.ps1`
**Task Scheduler:** "SSL Certificate Check" - rulează zilnic la 07:00
```powershell
# Verificare manuală
D:\kit\ssl\check-ssl-certificates.ps1 -Verbose
# Forțare reinstalare toate certificatele
D:\kit\ssl\check-ssl-certificates.ps1 -Force -Verbose
```
#### 2. Script Bash pe Proxmox (pvemini)
**Locație:** `/opt/scripts/monitor-ssl-certificates.sh`
**Cron:** Zilnic la 08:00
```bash
# Verificare manuală
/opt/scripts/monitor-ssl-certificates.sh
# Verificare log
tail -50 /var/log/ssl-monitor.log
```
### Ce Fac Scripturile
- Verifică zilele rămase pentru fiecare certificat
- Dacă < 14 zile: forțează reinstalare cu `wacs.exe --force`
- Restart IIS după reinstalare
- Trimite alertă email dacă există probleme
### Verificare Task Schedulers
```powershell
# Pe VM 201
Get-ScheduledTask | Where-Object {$_.TaskName -like "*SSL*" -or $_.TaskName -like "*acme*"}
```
```bash
# Pe Proxmox
grep ssl /etc/crontab
```
## Note Importante
- **SNI este OBLIGATORIU** pentru multiple certificate pe același IP:port
@@ -199,3 +256,4 @@ iisreset
- Task Scheduler reînnoiește automat cu **30 zile** înainte
- Fiecare domeniu trebuie să fie **accesibil pe port 80** din internet pentru validare HTTP-01
- DNS trebuie să pointeze corect către IP-ul public
- **Monitorizarea duală** (Windows + Proxmox) asigură redundanță

View File

@@ -0,0 +1,104 @@
# Script: check-ssl-certificates.ps1
# Locatie: D:\kit\ssl\check-ssl-certificates.ps1
# Scop: Verifica certificatele SSL IIS si forteaza reinstalarea daca expira in < 14 zile
# Rulare: Task Scheduler zilnic sau manual
param(
[int]$DaysBeforeExpiry = 14,
[switch]$Force,
[switch]$Verbose
)
$ErrorActionPreference = "Stop"
$LogFile = "C:\Tools\win-acme\ssl-check.log"
function Write-Log {
param([string]$Message)
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
$logMessage = "[$timestamp] $Message"
Add-Content -Path $LogFile -Value $logMessage
if ($Verbose) { Write-Host $logMessage }
}
# Domenii de verificat
$domains = @(
@{ SiteId = 1; Domain = "roa.romfast.ro" },
@{ SiteId = 2; Domain = "dokploy.romfast.ro" },
@{ SiteId = 3; Domain = "gitea.romfast.ro" },
@{ SiteId = 4; Domain = "roa2web.romfast.ro" }
)
Write-Log "========== Verificare certificate SSL =========="
$renewedCount = 0
$errorCount = 0
foreach ($site in $domains) {
$domain = $site.Domain
$siteId = $site.SiteId
try {
# Verifica certificatul curent via HTTPS
$request = [System.Net.HttpWebRequest]::Create("https://$domain")
$request.AllowAutoRedirect = $false
$request.Timeout = 10000
$request.ServerCertificateValidationCallback = { $true }
try {
$response = $request.GetResponse()
$response.Close()
} catch [System.Net.WebException] {
# Ignoram erorile HTTP, ne intereseaza certificatul
}
$cert = $request.ServicePoint.Certificate
if ($null -eq $cert) {
Write-Log "EROARE: Nu s-a putut obtine certificatul pentru $domain"
$errorCount++
continue
}
$cert2 = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 $cert
$expiryDate = $cert2.NotAfter
$daysLeft = ($expiryDate - (Get-Date)).Days
Write-Log "$domain - Expira: $expiryDate (inca $daysLeft zile)"
# Verifica daca trebuie reinnoirea
if ($daysLeft -lt $DaysBeforeExpiry -or $Force) {
Write-Log "ACTIUNE: Fortez reinstalare certificat pentru $domain (Site ID: $siteId)"
Push-Location "C:\Tools\win-acme"
$output = & .\wacs.exe --target iis --siteid $siteId --installation iis --force 2>&1
Pop-Location
if ($LASTEXITCODE -eq 0) {
Write-Log "SUCCES: Certificat reinstalat pentru $domain"
$renewedCount++
} else {
Write-Log "EROARE: Reinstalare esuata pentru $domain"
Write-Log $output
$errorCount++
}
}
} catch {
Write-Log "EXCEPTIE pentru ${domain}: $($_.Exception.Message)"
$errorCount++
}
}
# Restart IIS daca am reinoit certificate
if ($renewedCount -gt 0) {
Write-Log "Restart IIS..."
iisreset /restart | Out-Null
Write-Log "IIS restartat"
}
Write-Log "========== Sumar: $renewedCount reinnoite, $errorCount erori =========="
# Exit code pentru monitorizare
if ($errorCount -gt 0) {
exit 1
} else {
exit 0
}

View File

@@ -0,0 +1,157 @@
#!/bin/bash
# Script: monitor-ssl-certificates.sh
# Locatie: /opt/scripts/monitor-ssl-certificates.sh (pe pvemini)
# Scop: Verifica certificatele SSL extern si alerteaza/forteaza reinstalare
# Rulare: Cron zilnic sau la cerere
set -e
# Configurare
DAYS_WARNING=14
DAYS_CRITICAL=7
LOG_FILE="/var/log/ssl-monitor.log"
EMAIL_TO="root" # Proxmox trimite la adresa configurata
# Domenii de verificat
DOMAINS=(
"roa.romfast.ro"
"dokploy.romfast.ro"
"gitea.romfast.ro"
"roa2web.romfast.ro"
)
# Site IDs pentru fiecare domeniu (in aceeasi ordine)
SITE_IDS=(1 2 3 4)
log() {
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1" | tee -a "$LOG_FILE"
}
check_certificate() {
local domain=$1
local expiry_date expiry_epoch now_epoch days_left
# Obtine data expirare
expiry_date=$(echo | openssl s_client -servername "$domain" -connect "$domain:443" 2>/dev/null | \
openssl x509 -noout -enddate 2>/dev/null | cut -d= -f2)
if [[ -z "$expiry_date" ]]; then
echo "-1"
return
fi
# Calculeaza zilele ramase
expiry_epoch=$(date -d "$expiry_date" +%s 2>/dev/null)
now_epoch=$(date +%s)
days_left=$(( (expiry_epoch - now_epoch) / 86400 ))
echo "$days_left"
}
force_renew_certificate() {
local site_id=$1
local domain=$2
log "Fortez reinstalare certificat pentru $domain (Site ID: $site_id)..."
# Executa pe VM 201 prin Proxmox guest agent
result=$(qm guest exec 201 -- powershell -Command \
"cd C:\\Tools\\win-acme; .\\wacs.exe --target iis --siteid $site_id --installation iis --force" 2>&1)
if echo "$result" | grep -q '"exitcode" : 0'; then
log "SUCCES: Certificat reinstalat pentru $domain"
return 0
else
log "EROARE: Reinstalare esuata pentru $domain"
log "$result"
return 1
fi
}
restart_iis() {
log "Restart IIS..."
qm guest exec 201 -- cmd /c "iisreset" >/dev/null 2>&1
log "IIS restartat"
}
send_alert() {
local subject=$1
local body=$2
# Foloseste sistemul de notificari Proxmox
if command -v pvesh &>/dev/null; then
echo "$body" | mail -s "$subject" "$EMAIL_TO" 2>/dev/null || true
fi
log "ALERT: $subject"
}
# Main
log "========== Verificare certificate SSL =========="
warnings=()
criticals=()
renewed=0
for i in "${!DOMAINS[@]}"; do
domain="${DOMAINS[$i]}"
site_id="${SITE_IDS[$i]}"
days_left=$(check_certificate "$domain")
if [[ "$days_left" == "-1" ]]; then
log "EROARE: Nu pot verifica $domain"
criticals+=("$domain: Nu pot obtine certificatul")
continue
fi
log "$domain: $days_left zile ramase"
if [[ $days_left -lt 0 ]]; then
criticals+=("$domain: EXPIRAT!")
# Forteaza reinstalare
if force_renew_certificate "$site_id" "$domain"; then
((renewed++))
fi
elif [[ $days_left -lt $DAYS_CRITICAL ]]; then
criticals+=("$domain: expira in $days_left zile")
# Forteaza reinstalare
if force_renew_certificate "$site_id" "$domain"; then
((renewed++))
fi
elif [[ $days_left -lt $DAYS_WARNING ]]; then
warnings+=("$domain: expira in $days_left zile")
# Forteaza reinstalare preventiv
if force_renew_certificate "$site_id" "$domain"; then
((renewed++))
fi
fi
done
# Restart IIS daca am reinoit
if [[ $renewed -gt 0 ]]; then
restart_iis
fi
# Trimite alerte
if [[ ${#criticals[@]} -gt 0 ]]; then
body="Certificate SSL CRITICE:\n\n"
for msg in "${criticals[@]}"; do
body+="- $msg\n"
done
body+="\nActiuni intreprinse: $renewed certificate reinstalate"
send_alert "[CRITICAL] Certificate SSL expirate/aproape de expirare" "$body"
fi
if [[ ${#warnings[@]} -gt 0 && ${#criticals[@]} -eq 0 ]]; then
body="Certificate SSL WARNING:\n\n"
for msg in "${warnings[@]}"; do
body+="- $msg\n"
done
body+="\nActiuni intreprinse: $renewed certificate reinstalate"
send_alert "[WARNING] Certificate SSL aproape de expirare" "$body"
fi
log "========== Sumar: $renewed reinstalate, ${#warnings[@]} warnings, ${#criticals[@]} critice =========="
exit 0