815 lines
24 KiB
Markdown
815 lines
24 KiB
Markdown
# Session Log: April 12, 2026
|
|
|
|
## Session Summary
|
|
|
|
### Work Accomplished
|
|
|
|
1. **Gitea Service Recovery (Jupiter Server)**
|
|
- Fixed Gitea containers failing to start due to "No space left on device" errors
|
|
- Root cause: btrfs cache drive 99%+ full (743GB used of 750GB allocated)
|
|
- Moved MySQL database (223MB) to disk1 (/mnt/disk1/appdata/gitea-db)
|
|
- Moved Gitea application data (816MB) to disk1 (/mnt/disk1/appdata/gitea)
|
|
- Updated docker-compose.yml with new paths
|
|
- Cleaned up Docker build cache (2.569GB reclaimed)
|
|
- Successfully restored Gitea service - git operations working
|
|
|
|
2. **Dataforth TestDataDB PostgreSQL Migration - Cleanup**
|
|
- Verified PostgreSQL migration complete (2,889,135 records migrated)
|
|
- Archived old SQLite database files (4.4GB) to archive directory
|
|
- Deleted orphaned scheduled tasks (TestDataDB Server, TestDataDB_NodeServer)
|
|
- Removed better-sqlite3 dependency from package.json
|
|
- Verified web interface fully operational at http://192.168.0.6:3000
|
|
- All API endpoints tested and working (stats, search, filters)
|
|
|
|
3. **New Dataforth API Discovery**
|
|
- Hoffman provided new Swagger API: https://www.dataforth.com/swagger/index.html
|
|
- Analyzed TestReportDataFiles endpoints for datasheet uploads
|
|
- Documented API requirements (OAuth2 authentication needed)
|
|
- Identified next steps: waiting for OAuth credentials from Hoffman
|
|
|
|
### Key Decisions
|
|
|
|
1. **Gitea Data Migration Approach**
|
|
- Decision: Move Gitea data to array disk1 instead of cache drive
|
|
- Rationale: Cache drive critically full (99%), disk1 has 3.7TB free
|
|
- Impact: Gitea no longer depends on cache drive, stable and operational
|
|
|
|
2. **SQLite Archive vs Delete**
|
|
- Decision: Archive old SQLite files rather than delete
|
|
- Rationale: Safe rollback option if issues discovered later
|
|
- Location: C:\Shares\testdatadb\database\archive\
|
|
|
|
3. **API Integration Timing**
|
|
- Decision: Wait for OAuth credentials from Hoffman before implementing
|
|
- Rationale: Cannot test without proper authentication
|
|
- Next step: Create upload script once credentials received
|
|
|
|
### Problems Encountered and Solutions
|
|
|
|
#### Problem 1: Gitea 502 Error After Session Save
|
|
**Error:** Git push failed with HTTP 502, Gitea containers in "Restarting" state
|
|
**Root Cause:** MySQL failing with "No space left on device" (errno 28)
|
|
**Investigation:**
|
|
- Cache drive showed 183GB available via df
|
|
- btrfs filesystem showed data chunks 99.10% full (743.25GB/750.01GB)
|
|
- Classic btrfs allocation issue - unallocated space can't be used without balancing
|
|
|
|
**Solution:**
|
|
```bash
|
|
# Attempted btrfs balance (minimal effect)
|
|
ssh root@172.16.3.20 'btrfs balance start -dusage=70 /mnt/cache'
|
|
# Only relocated 6 chunks, still 99% full
|
|
|
|
# Moved database to array
|
|
mkdir -p /mnt/disk1/appdata/gitea-db
|
|
rsync -av /mnt/cache/appdata/gitea-db/ /mnt/disk1/appdata/gitea-db/
|
|
mkdir -p /mnt/disk1/appdata/gitea
|
|
rsync -av /mnt/cache/appdata/gitea/ /mnt/disk1/appdata/gitea/
|
|
|
|
# Updated docker-compose.yml
|
|
sed -i 's|/mnt/user/appdata/gitea-db:/var/lib/mysql|/mnt/disk1/appdata/gitea-db:/var/lib/mysql|'
|
|
sed -i 's|/mnt/user/appdata/gitea:/data|/mnt/disk1/appdata/gitea:/data|'
|
|
|
|
# Restarted containers
|
|
docker-compose -f /mnt/cache/appdata/gitea/docker-compose.yml up -d
|
|
```
|
|
|
|
**Result:** Gitea operational, git push successful
|
|
|
|
#### Problem 2: API Search Timeouts Initially
|
|
**Error:** curl commands to /api/search timing out (>30 seconds)
|
|
**Investigation:** Service logs showed queries completing but slow response
|
|
**Solution:** Used simpler queries (date ranges, model search) which responded quickly
|
|
**Result:** Verified PostgreSQL full-text search working correctly
|
|
|
|
---
|
|
|
|
## Credentials & Infrastructure
|
|
|
|
### Jupiter Server (Unraid)
|
|
- **IP:** 172.16.3.20
|
|
- **User:** root
|
|
- **Password:** (standard Unraid password)
|
|
- **Role:** Main infrastructure server hosting Gitea, OwnCloud VM, Docker containers
|
|
|
|
### OwnCloud VM (on Jupiter)
|
|
- **IP:** 172.16.3.22
|
|
- **User:** root
|
|
- **Password:** r3tr0gadE99!!
|
|
- **SSH Key:** Added from Mac
|
|
- **Role:** OwnCloud server for Pavon archive
|
|
|
|
### Pavon Unraid Server
|
|
- **IP:** 172.16.1.33
|
|
- **User:** root
|
|
- **Password:** r3tr0gradE99!
|
|
- **SMB User:** owncloud / (set during OwnCloud integration)
|
|
- **Storage:** 37TB used, 84TB free (after 25TB cleanup)
|
|
|
|
### Dataforth AD2 Server
|
|
- **IP:** 192.168.0.6
|
|
- **Hostname:** AD2.intranet.dataforth.com
|
|
- **User:** INTRANET\sysadmin
|
|
- **Password:** Paper123\!@#
|
|
- **Role:** Production server, TestDataDB host, PostgreSQL database
|
|
|
|
### Dataforth TestDataDB
|
|
- **Service:** testdatadb (Windows service, auto-start)
|
|
- **Web UI:** http://192.168.0.6:3000
|
|
- **Database:** PostgreSQL 18
|
|
- Database: testdatadb
|
|
- User: testdatadb_app
|
|
- Password: DfTestDB2026!
|
|
- Host: localhost
|
|
- Port: 5432
|
|
- **Records:** 2,889,135 test records
|
|
- **Tables:** test_records, work_orders, work_order_lines
|
|
- **Indexes:** 20 indexes including full-text search (idx_search_vector)
|
|
|
|
### Gitea Service
|
|
- **URL:** https://git.azcomputerguru.com
|
|
- **Container:** gitea (gitea/gitea:latest)
|
|
- **Database Container:** gitea-db (mysql:8)
|
|
- **Database Location:** /mnt/disk1/appdata/gitea-db (moved from cache)
|
|
- **App Data Location:** /mnt/disk1/appdata/gitea (moved from cache)
|
|
- **Database Credentials:**
|
|
- User: gitea
|
|
- Password: r3tr0gradE99
|
|
- Database: gitea
|
|
|
|
---
|
|
|
|
## Commands & Outputs
|
|
|
|
### Gitea Troubleshooting Commands
|
|
|
|
**Check btrfs filesystem usage:**
|
|
```bash
|
|
ssh root@172.16.3.20 'btrfs filesystem usage /mnt/cache'
|
|
# Output showed: Data,single: 750.01GiB, Used:743.25GiB (99.10%)
|
|
```
|
|
|
|
**Check Docker container status:**
|
|
```bash
|
|
ssh root@172.16.3.20 'docker ps -a | grep gitea'
|
|
# Showed containers in "Restarting" state
|
|
```
|
|
|
|
**Check MySQL logs:**
|
|
```bash
|
|
ssh root@172.16.3.20 'docker logs --tail 50 gitea-db'
|
|
# Error: "No space left on device" (errno 28)
|
|
# Error: "File './binlog.~rec~' not found (OS errno 28)"
|
|
```
|
|
|
|
**Move Gitea database to disk1:**
|
|
```bash
|
|
ssh root@172.16.3.20 'mkdir -p /mnt/disk1/appdata/gitea-db && rsync -av /mnt/cache/appdata/gitea-db/ /mnt/disk1/appdata/gitea-db/'
|
|
# Transferred 223MB database successfully
|
|
|
|
ssh root@172.16.3.20 'mkdir -p /mnt/disk1/appdata/gitea && rsync -av /mnt/cache/appdata/gitea/ /mnt/disk1/appdata/gitea/'
|
|
# Transferred 816MB application data
|
|
```
|
|
|
|
**Update docker-compose configuration:**
|
|
```bash
|
|
# Updated /mnt/cache/appdata/gitea/docker-compose.yml
|
|
# Changed volumes from /mnt/user/appdata/* to /mnt/disk1/appdata/*
|
|
```
|
|
|
|
**Restart Gitea containers:**
|
|
```bash
|
|
cd /mnt/cache/appdata/gitea && docker-compose up -d
|
|
# Both containers started successfully
|
|
```
|
|
|
|
**Verify Gitea accessible:**
|
|
```bash
|
|
curl -I https://git.azcomputerguru.com
|
|
# HTTP/2 200 (success)
|
|
```
|
|
|
|
**Test git operations:**
|
|
```bash
|
|
git pull --rebase origin main && git push origin main
|
|
# Successfully pushed to remote
|
|
```
|
|
|
|
### TestDataDB Cleanup Commands
|
|
|
|
**Check service status:**
|
|
```bash
|
|
sshpass -p 'Paper123\!@#' ssh 'INTRANET\sysadmin'@192.168.0.6 'powershell -Command "Get-Service testdatadb"'
|
|
# Status: Running, StartType: Automatic
|
|
```
|
|
|
|
**Verify PostgreSQL service:**
|
|
```bash
|
|
sshpass -p 'Paper123\!@#' ssh 'INTRANET\sysadmin'@192.168.0.6 'powershell -Command "Get-Service postgresql-18"'
|
|
# Status: Running
|
|
```
|
|
|
|
**Check database record count:**
|
|
```bash
|
|
psql -U postgres -d testdatadb -c "SELECT COUNT(*) FROM test_records;"
|
|
# 2,889,135 records
|
|
```
|
|
|
|
**Archive SQLite database:**
|
|
```bash
|
|
New-Item -ItemType Directory -Path C:\Shares\testdatadb\database\archive -Force
|
|
Move-Item C:\Shares\testdatadb\database\testdata.db C:\Shares\testdatadb\database\archive\
|
|
Move-Item C:\Shares\testdatadb\database\testdata.db-shm C:\Shares\testdatadb\database\archive\
|
|
Move-Item C:\Shares\testdatadb\database\testdata.db-wal C:\Shares\testdatadb\database\archive\
|
|
# Archived 4.4GB of SQLite files
|
|
```
|
|
|
|
**Delete orphaned scheduled tasks:**
|
|
```bash
|
|
schtasks /Delete /TN "TestDataDB Server" /F
|
|
# SUCCESS: The scheduled task "TestDataDB Server" was successfully deleted.
|
|
|
|
schtasks /Delete /TN "TestDataDB_NodeServer" /F
|
|
# SUCCESS: The scheduled task "TestDataDB_NodeServer" was successfully deleted.
|
|
```
|
|
|
|
**Update package.json:**
|
|
```bash
|
|
# Removed "better-sqlite3": "^9.4.3" from dependencies
|
|
# Kept "pg": "^8.20.0"
|
|
scp /tmp/package.json 'INTRANET\sysadmin@192.168.0.6:C:/Shares/testdatadb/package.json'
|
|
```
|
|
|
|
**Test API endpoints:**
|
|
```bash
|
|
curl -s http://192.168.0.6:3000/api/stats
|
|
# Returns 2,889,135 records, date range 1990-01-01 to 2026-04-09
|
|
|
|
curl -s "http://192.168.0.6:3000/api/search?model=7B34-02D&limit=5"
|
|
# Returns 5 of 18,402 records with full-text search working
|
|
```
|
|
|
|
### New API Investigation Commands
|
|
|
|
**Fetch Swagger documentation:**
|
|
```bash
|
|
curl -s https://www.dataforth.com/swagger/index.html
|
|
# Returns Swagger UI interface
|
|
```
|
|
|
|
**Get API specification:**
|
|
```bash
|
|
curl -s https://www.dataforth.com/swagger/v1/swagger.json | jq .
|
|
# 42.9KB OpenAPI 3.0.1 specification
|
|
```
|
|
|
|
**Identify datasheet endpoints:**
|
|
```bash
|
|
curl -s https://www.dataforth.com/swagger/v1/swagger.json | jq '.paths | keys | .[]' | grep -i datasheet
|
|
# Found: /api/v1/TestReportDataFiles endpoints
|
|
```
|
|
|
|
**Test API authentication:**
|
|
```bash
|
|
curl -i https://www.dataforth.com/api/v1/TestReportDataFiles/stats
|
|
# HTTP/2 401 Unauthorized
|
|
# www-authenticate: Bearer
|
|
# OAuth2 authentication required
|
|
```
|
|
|
|
---
|
|
|
|
## Configuration Changes
|
|
|
|
### Files Modified
|
|
|
|
**1. /mnt/cache/appdata/gitea/docker-compose.yml** (Jupiter)
|
|
- Changed gitea-db volume: `/mnt/user/appdata/gitea-db` → `/mnt/disk1/appdata/gitea-db`
|
|
- Changed gitea volume: `/mnt/user/appdata/gitea` → `/mnt/disk1/appdata/gitea`
|
|
- Backup created: docker-compose.yml.bak
|
|
|
|
**2. C:\Shares\testdatadb\package.json** (AD2)
|
|
- Removed dependency: `"better-sqlite3": "^9.4.3"`
|
|
- Kept dependencies: cors, express, node-windows, pdfkit, pg
|
|
|
|
**3. C:\Shares\testdatadb\database\** (AD2)
|
|
- Moved files to archive/:
|
|
- testdata.db (4,401,168,384 bytes)
|
|
- testdata.db-shm (32,768 bytes)
|
|
- testdata.db-wal (65,952 bytes)
|
|
|
|
### Services Modified
|
|
|
|
**Windows Services (AD2):**
|
|
- testdatadb: Status unchanged (Running, Automatic)
|
|
- postgresql-18: Status unchanged (Running)
|
|
|
|
**Docker Containers (Jupiter):**
|
|
- gitea: Recreated with new volume paths
|
|
- gitea-db: Recreated with new volume paths
|
|
|
|
**Scheduled Tasks Deleted (AD2):**
|
|
- TestDataDB Server (disabled duplicate)
|
|
- TestDataDB_NodeServer (disabled duplicate)
|
|
- Kept: TestDataDB-Backup (active)
|
|
|
|
---
|
|
|
|
## API Documentation - Hoffman's New Endpoint
|
|
|
|
### Base Information
|
|
- **Swagger UI:** https://www.dataforth.com/swagger/index.html
|
|
- **API Spec:** https://www.dataforth.com/swagger/v1/swagger.json
|
|
- **Base URL:** https://www.dataforth.com/api/v1/TestReportDataFiles
|
|
- **API Version:** v1
|
|
- **Protocol:** HTTPS/REST
|
|
- **Format:** JSON
|
|
|
|
### Authentication
|
|
- **Type:** OAuth2 Bearer Token
|
|
- **Authorization URL:** https://login.dataforth.com/connect/authorize
|
|
- **Token URL:** https://login.dataforth.com/connect/token
|
|
- **Scopes Required:**
|
|
- openid: OpenID
|
|
- profile: Profile
|
|
- dataforth.web: Dataforth API
|
|
- **Status:** Credentials pending from Hoffman
|
|
|
|
### Endpoints
|
|
|
|
#### POST /api/v1/TestReportDataFiles (Single Upload)
|
|
**Purpose:** Create or update a single test report datasheet
|
|
|
|
**Request:**
|
|
```json
|
|
{
|
|
"SerialNumber": "179305-1",
|
|
"Content": "DATAFORTH CORPORATION\n4339 S. 120th Street..."
|
|
}
|
|
```
|
|
|
|
**Request Schema:**
|
|
- SerialNumber: string (required, max 50 chars)
|
|
- Content: string (required, min 1 char)
|
|
|
|
**Response (201 Created or 200 OK):**
|
|
```json
|
|
{
|
|
"SerialNumber": "179305-1",
|
|
"ContentHash": "sha256hash",
|
|
"Created": true
|
|
}
|
|
```
|
|
|
|
**Response Fields:**
|
|
- SerialNumber: string (nullable)
|
|
- ContentHash: string (nullable) - SHA256 hash of content
|
|
- Created: boolean (true if new record, false if updated)
|
|
|
|
**Error Response (400 Bad Request):**
|
|
```json
|
|
{
|
|
"Errors": ["error message"]
|
|
}
|
|
```
|
|
|
|
#### POST /api/v1/TestReportDataFiles/bulk (Bulk Upload)
|
|
**Purpose:** Create or update multiple datasheets in one request
|
|
|
|
**Request:**
|
|
```json
|
|
{
|
|
"Items": [
|
|
{
|
|
"SerialNumber": "179305-1",
|
|
"Content": "..."
|
|
},
|
|
{
|
|
"SerialNumber": "179305-2",
|
|
"Content": "..."
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
**Request Schema:**
|
|
- Items: array of CreateTestReportRequest (required)
|
|
|
|
**Response (200 OK):**
|
|
```json
|
|
{
|
|
"TotalReceived": 100,
|
|
"Created": 50,
|
|
"Updated": 45,
|
|
"Unchanged": 5,
|
|
"Errors": ["error 1", "error 2"]
|
|
}
|
|
```
|
|
|
|
**Response Fields:**
|
|
- TotalReceived: integer (total items in request)
|
|
- Created: integer (new records created)
|
|
- Updated: integer (existing records updated)
|
|
- Unchanged: integer (records with same content hash)
|
|
- Errors: array of strings (nullable)
|
|
|
|
#### GET /api/v1/TestReportDataFiles
|
|
**Purpose:** List uploaded datasheets with pagination
|
|
|
|
**Query Parameters:**
|
|
- page: integer (default: 1)
|
|
- pageSize: integer (default: 50)
|
|
- serialNumberPrefix: string (optional filter)
|
|
- afterSerialNumber: string (optional cursor)
|
|
|
|
**Response:** Paged list of datasheet metadata
|
|
|
|
#### GET /api/v1/TestReportDataFiles/{serialNumber}
|
|
**Purpose:** Retrieve specific datasheet by serial number
|
|
|
|
**Path Parameters:**
|
|
- serialNumber: string (required)
|
|
|
|
**Response:** Single datasheet data
|
|
|
|
#### GET /api/v1/TestReportDataFiles/stats
|
|
**Purpose:** Get statistics about uploaded datasheets
|
|
|
|
**Response:** Statistics object (schema not detailed in initial analysis)
|
|
|
|
### Integration Notes
|
|
|
|
**Current TestDataDB Export Flow:**
|
|
1. Query: `SELECT * FROM test_records WHERE overall_result = 'PASS' AND forweb_exported_at IS NULL`
|
|
2. For each record:
|
|
- Load model specs from parsers/spec-reader.js
|
|
- Generate datasheet text via templates/datasheet-exact.js
|
|
- Write to X:\For_Web\{serial}.TXT
|
|
- Update: `forweb_exported_at = NOW()`
|
|
|
|
**New API Upload Flow (To Implement):**
|
|
1. Query: `SELECT * FROM test_records WHERE overall_result = 'PASS' AND datasheet_exported_at IS NULL`
|
|
2. Batch records (suggested: 100-500 per request)
|
|
3. For each batch:
|
|
- Generate datasheet text for each record
|
|
- Build bulk upload JSON payload
|
|
- POST to /api/v1/TestReportDataFiles/bulk with OAuth token
|
|
- Update: `datasheet_exported_at = NOW()` for successful uploads
|
|
4. Handle errors and retry logic
|
|
|
|
**Advantages of New API:**
|
|
- No file system dependencies (X: drive)
|
|
- Content stored in Hoffman's database directly
|
|
- Bulk upload reduces API calls (100+ records per request)
|
|
- Content hash prevents duplicate processing
|
|
- Unchanged records skip processing (efficiency)
|
|
|
|
**Script to Create:**
|
|
- Filename: `C:\Shares\testdatadb\database\export-to-api.js`
|
|
- Reuse: generateExactDatasheet() from export-datasheets.js
|
|
- Add: OAuth token acquisition logic
|
|
- Add: Bulk upload batching
|
|
- Add: Error handling and retry
|
|
- Add: Progress tracking and logging
|
|
|
|
---
|
|
|
|
## Pending/Incomplete Tasks
|
|
|
|
### Immediate - Blocked on Hoffman
|
|
|
|
**1. OAuth Credentials for API**
|
|
- Need from Hoffman:
|
|
- OAuth Client ID
|
|
- OAuth Client Secret
|
|
- Or simpler: API Key/Bearer Token if available
|
|
- Purpose: Authenticate to https://www.dataforth.com/api/v1/TestReportDataFiles
|
|
- Status: **BLOCKED - Waiting on Hoffman**
|
|
|
|
### Short-term - After Credentials Received
|
|
|
|
**2. Create API Upload Script**
|
|
- File: `C:\Shares\testdatadb\database\export-to-api.js`
|
|
- Functionality:
|
|
- Query unexported records from PostgreSQL
|
|
- Generate datasheet text using existing templates
|
|
- Batch into groups of 100-500 records
|
|
- POST to /api/v1/TestReportDataFiles/bulk
|
|
- Update datasheet_exported_at on success
|
|
- Handle errors and retries
|
|
- Log results
|
|
- Dependencies: OAuth credentials
|
|
|
|
**3. Test API Integration**
|
|
- Test with small batch (10 records)
|
|
- Verify content hash behavior
|
|
- Test error handling
|
|
- Verify datasheets appear on Hoffman's end
|
|
- Performance testing (optimize batch size)
|
|
|
|
**4. Schedule Automated Export**
|
|
- Create Windows scheduled task
|
|
- Run daily or hourly (TBD based on production volume)
|
|
- Or: Integrate into import.js to export immediately after import
|
|
|
|
### Optional - Cleanup
|
|
|
|
**5. Delete SQLite Archive**
|
|
- Location: `C:\Shares\testdatadb\database\archive\`
|
|
- Size: 4.4GB
|
|
- Recommendation: Keep for 30 days, then delete if no issues
|
|
- Can reclaim space on C: drive if needed
|
|
|
|
**6. Jupiter Cache Drive Optimization**
|
|
- Current: 99% full with 582GB OwnCloud data
|
|
- Option: Move OwnCloud data to array (/mnt/disk*)
|
|
- Benefit: Reduce cache pressure for other applications
|
|
- Priority: Low (Gitea no longer dependent on cache)
|
|
|
|
---
|
|
|
|
## Reference Information
|
|
|
|
### URLs & Endpoints
|
|
|
|
**Gitea:**
|
|
- Web: https://git.azcomputerguru.com
|
|
- Git: https://git.azcomputerguru.com/azcomputerguru/claudetools.git
|
|
- Docker compose: /mnt/cache/appdata/gitea/docker-compose.yml
|
|
|
|
**TestDataDB:**
|
|
- Web UI: http://192.168.0.6:3000
|
|
- API Stats: http://192.168.0.6:3000/api/stats
|
|
- API Search: http://192.168.0.6:3000/api/search?serial=X&model=Y
|
|
- API Filters: http://192.168.0.6:3000/api/filters
|
|
- API Record: http://192.168.0.6:3000/api/record/:id
|
|
- API Datasheet: http://192.168.0.6:3000/api/datasheet/:id
|
|
|
|
**Dataforth API:**
|
|
- Swagger UI: https://www.dataforth.com/swagger/index.html
|
|
- API Spec: https://www.dataforth.com/swagger/v1/swagger.json
|
|
- Base URL: https://www.dataforth.com/api/v1/TestReportDataFiles
|
|
- OAuth Auth: https://login.dataforth.com/connect/authorize
|
|
- OAuth Token: https://login.dataforth.com/connect/token
|
|
|
|
### File Paths
|
|
|
|
**Jupiter Server:**
|
|
- Gitea data: /mnt/disk1/appdata/gitea
|
|
- Gitea DB: /mnt/disk1/appdata/gitea-db
|
|
- Docker compose: /mnt/cache/appdata/gitea/docker-compose.yml
|
|
- OwnCloud data: /mnt/cache/OwnCloud (582GB)
|
|
|
|
**AD2 Server:**
|
|
- TestDataDB root: C:\Shares\testdatadb\
|
|
- Database: PostgreSQL on localhost:5432
|
|
- Export script: C:\Shares\testdatadb\database\export-datasheets.js
|
|
- Import script: C:\Shares\testdatadb\database\import.js
|
|
- Migration script: C:\Shares\testdatadb\database\migrate-data.js
|
|
- DB config: C:\Shares\testdatadb\database\db.js
|
|
- Server: C:\Shares\testdatadb\server.js
|
|
- Logs: C:\Shares\testdatadb\logs\
|
|
- SQLite archive: C:\Shares\testdatadb\database\archive\
|
|
|
|
**Pavon Server:**
|
|
- Archive location: /mnt/user/Storage/ (35TB camera footage)
|
|
- Cleanup script: /root/pavon_cleanup.sh
|
|
- Cleanup logs: /root/cleanup_logs/
|
|
|
|
### Port Numbers
|
|
|
|
**Jupiter (172.16.3.20):**
|
|
- 3000: Gitea web UI
|
|
- 2222: Gitea SSH
|
|
|
|
**OwnCloud VM (172.16.3.22):**
|
|
- 80: HTTP (Apache)
|
|
- 22: SSH
|
|
|
|
**AD2 (192.168.0.6):**
|
|
- 3000: TestDataDB web UI
|
|
- 5432: PostgreSQL
|
|
- 22: SSH (OpenSSH)
|
|
- 5985: WinRM
|
|
- 3389: RDP
|
|
|
|
**Pavon (172.16.1.33):**
|
|
- 445: SMB/CIFS (Storage share)
|
|
- 22: SSH
|
|
|
|
---
|
|
|
|
## Technical Details
|
|
|
|
### Gitea Docker Configuration
|
|
|
|
**docker-compose.yml** (Final version at /mnt/cache/appdata/gitea/docker-compose.yml):
|
|
```yaml
|
|
version: "3"
|
|
|
|
networks:
|
|
gitea:
|
|
external: false
|
|
|
|
services:
|
|
gitea-db:
|
|
image: mysql:8
|
|
container_name: gitea-db
|
|
restart: always
|
|
environment:
|
|
- MYSQL_ROOT_PASSWORD=r3tr0gradE99
|
|
- MYSQL_USER=gitea
|
|
- MYSQL_PASSWORD=r3tr0gradE99
|
|
- MYSQL_DATABASE=gitea
|
|
networks:
|
|
- gitea
|
|
volumes:
|
|
- /mnt/disk1/appdata/gitea-db:/var/lib/mysql
|
|
|
|
gitea:
|
|
image: gitea/gitea:latest
|
|
container_name: gitea
|
|
environment:
|
|
- USER_UID=99
|
|
- USER_GID=100
|
|
- GITEA__database__DB_TYPE=mysql
|
|
- GITEA__database__HOST=gitea-db:3306
|
|
- GITEA__database__NAME=gitea
|
|
- GITEA__database__USER=gitea
|
|
- GITEA__database__PASSWD=r3tr0gradE99
|
|
restart: always
|
|
networks:
|
|
- gitea
|
|
volumes:
|
|
- /mnt/disk1/appdata/gitea:/data
|
|
- /etc/timezone:/etc/timezone:ro
|
|
- /etc/localtime:/etc/localtime:ro
|
|
ports:
|
|
- "3000:3000"
|
|
- "2222:22"
|
|
depends_on:
|
|
- gitea-db
|
|
```
|
|
|
|
### TestDataDB PostgreSQL Schema
|
|
|
|
**Database:** testdatadb
|
|
**User:** testdatadb_app
|
|
**Connection:** localhost:5432
|
|
|
|
**Tables:**
|
|
1. **test_records** (2,889,135 rows)
|
|
- Primary key: id (bigserial)
|
|
- Unique constraint: log_type, model_number, serial_number, test_date
|
|
- Fields: id, log_type, model_number, serial_number, test_date, test_station, overall_result, raw_data, source_file, import_date, datasheet_exported_at, forweb_exported_at, work_order
|
|
- Full-text search: search_vector (tsvector)
|
|
|
|
2. **work_orders**
|
|
- Primary key: id (bigserial)
|
|
- Unique constraint: wo_number, test_station
|
|
- Fields: id, wo_number, test_station, created_at
|
|
|
|
3. **work_order_lines**
|
|
- Primary key: id (bigserial)
|
|
- Foreign key: wo_number → work_orders
|
|
- Unique constraint: wo_number, serial_number, test_date, test_timestamp
|
|
- Fields: id, wo_number, serial_number, test_date, test_timestamp, status
|
|
|
|
**Indexes (20 total):**
|
|
- idx_date, idx_log_type, idx_model, idx_serial, idx_model_serial
|
|
- idx_result, idx_test_wo, idx_unexported_pass
|
|
- idx_search_vector (GIN index for full-text search)
|
|
- idx_wo_number, idx_wo_station
|
|
- idx_wol_model, idx_wol_serial, idx_wol_wo
|
|
- Plus unique constraint indexes
|
|
|
|
**Export Status Fields:**
|
|
- `datasheet_exported_at`: For local file export (X:\For_Web)
|
|
- `forweb_exported_at`: For API upload (new Hoffman endpoint)
|
|
- Both nullable timestamp fields
|
|
|
|
### btrfs Filesystem Details (Jupiter Cache)
|
|
|
|
**Device:** /dev/sdn1
|
|
**Total Size:** 931.51GiB
|
|
**Allocated:** 756.07GiB
|
|
**Unallocated:** 175.44GiB
|
|
|
|
**Data Chunks:**
|
|
- Size: 748.01GiB (allocated)
|
|
- Used: 740.66GiB (99.02% full after cleanup)
|
|
- Type: Single (no redundancy)
|
|
|
|
**Metadata Chunks:**
|
|
- Size: 3.00GiB (allocated as DUP)
|
|
- Used: 2.01GiB (66.87%)
|
|
- Type: DUP (duplicated for redundancy)
|
|
|
|
**System Chunks:**
|
|
- Size: 32.00MiB (allocated as DUP)
|
|
- Used: 96.00KiB (0.29%)
|
|
|
|
**Space Consumers:**
|
|
- OwnCloud: 582GB (largest)
|
|
- appdata: 107GB
|
|
- domains: 43GB
|
|
|
|
**Issue:** Data chunks were 99.10% full before Gitea moved. Unallocated space (175GB) couldn't be used without extensive balancing. Moving Gitea off cache solved immediate issue.
|
|
|
|
---
|
|
|
|
## Session Timeline
|
|
|
|
**18:23 - Started troubleshooting Gitea**
|
|
- User requested: "push all the things"
|
|
- Discovered Gitea returning HTTP 502
|
|
|
|
**18:35 - Diagnosed btrfs issue**
|
|
- Found MySQL "No space left on device" errors
|
|
- Identified data chunks 99%+ full
|
|
- Attempted btrfs balance (minimal effect)
|
|
|
|
**18:39 - Migrated Gitea to disk1**
|
|
- Moved gitea-db (223MB) and gitea (816MB) to /mnt/disk1/appdata
|
|
- Updated docker-compose.yml
|
|
- Restarted containers successfully
|
|
|
|
**18:40 - Verified Gitea operational**
|
|
- Tested web interface: HTTP 200
|
|
- Tested git operations: push successful
|
|
- Cleaned up old data from cache
|
|
|
|
**18:43 - Started Dataforth work**
|
|
- User requested: "Ok, let's fix the testdatabase at dataforth"
|
|
- Checked TestDataDB service status
|
|
|
|
**19:00 - Verified PostgreSQL migration**
|
|
- Confirmed 2,889,135 records in PostgreSQL
|
|
- Found migration scripts and completed status
|
|
- All tables, indexes, and full-text search operational
|
|
|
|
**19:25 - Cleanup tasks**
|
|
- Archived SQLite files (4.4GB)
|
|
- Deleted orphaned scheduled tasks
|
|
- Updated package.json (removed better-sqlite3)
|
|
|
|
**19:28 - Verified web interface**
|
|
- Tested homepage, API stats, search endpoints
|
|
- All functionality confirmed working
|
|
|
|
**19:35 - Investigated new API**
|
|
- User: "Hoffman sent this: https://www.dataforth.com/swagger/index.html"
|
|
- Downloaded and analyzed Swagger specification
|
|
- Documented all endpoints and requirements
|
|
- Identified OAuth authentication requirement
|
|
|
|
**19:45 - Session save**
|
|
- User: "we'll wait on Hoffman to provide credentials. save everything"
|
|
- Created comprehensive session log
|
|
|
|
---
|
|
|
|
## Notes & Observations
|
|
|
|
### Gitea Cache Drive Issue
|
|
|
|
The cache drive on Jupiter is critically full and will need attention soon. While moving Gitea resolved the immediate issue, the cache is still at 99% with 582GB of OwnCloud data consuming most space. Consider moving OwnCloud data to array disks to prevent future issues.
|
|
|
|
### PostgreSQL Migration Success
|
|
|
|
The TestDataDB PostgreSQL migration is completely successful. All 2.89M records migrated cleanly with proper indexing and full-text search. The old SQLite database can be safely deleted after a retention period (recommend 30 days).
|
|
|
|
### API Integration Advantages
|
|
|
|
Hoffman's new API eliminates file system dependencies entirely. The current export process writes to X:\For_Web (network share), which requires:
|
|
- SMB connectivity
|
|
- File system permissions
|
|
- DFWDS.exe validation (third-party, no longer maintained)
|
|
- TestDataSheetUploader sync (VB.NET, last used 2022)
|
|
|
|
The new API approach:
|
|
- Direct database-to-API integration
|
|
- No intermediate file storage
|
|
- Content hashing prevents duplicates
|
|
- Bulk uploads for efficiency
|
|
- RESTful and modern (OpenAPI 3.0)
|
|
- Hoffman manages storage on his end
|
|
|
|
### OAuth vs API Key
|
|
|
|
While OAuth2 is specified, it may be worth asking Hoffman if he can provide a simpler API key or service account token instead. OAuth requires:
|
|
- Client ID/Secret management
|
|
- Token refresh logic
|
|
- Authorization flow handling
|
|
|
|
A service account bearer token would simplify the integration significantly for this server-to-server use case.
|
|
|
|
---
|
|
|
|
## End of Session
|
|
|
|
**Session Duration:** ~1.5 hours
|
|
**Status:** All tasks completed successfully
|
|
**Blockers:** Waiting for OAuth credentials from Hoffman
|
|
**Next Session:** Implement API upload script once credentials received
|