5a9d60e8a80088dec721166e915e6275dcdec276
진단 보고서(plans/...phase5-사용자체크리스트.md) 기반 7건 코드 이슈
수정 + Phase 6 잔여 항목 중 최우선인 run_sql 가드 구현.
핫픽스:
- nl2sql_worker.py: _list_drawings 파싱 버그(문자열 분리) HIGH
- nl2sql_worker.py: 5개 async 함수 blocking DB 연결 → to_thread MED
- ExperionDbContext.cs: KB DDL의 {} 문자가 String.Format placeholder로
오인되어 부팅 실패 → 별도 NpgsqlCommand 사용 HIGH
- KbIngestWorker: 단일 청크 임베딩 실패 시 전체 abort → 부분 인덱싱 LOW
- KbAuthService: 초기 비번 로그 평문 → 마스킹 + 콘솔 분리 출력 LOW
- KbQdrantClient: new HttpClient → IHttpClientFactory LOW
- OllamaController: plant_context.md 매 요청 파일 읽기 → mtime 캐시 LOW
Phase 6 — run_sql 가드:
- _validate_sql 강화: \b 단어 경계로 updated_at 오탐 제거, WITH 허용,
TRUNCATE/COPY 추가, 다중 세미콜론 차단
- _apply_sql_guards: LIMIT 미지정 시 SELECT * FROM (...) _capped LIMIT 1000
- _execute_sql_internal: 매 호출 SET statement_timeout = 30000
- SQL_MAX_ROWS / SQL_STATEMENT_TIMEOUT_MS 환경변수화
- 응답 JSON에 row_limit 필드 추가
- nl2sql_worker.py의 _run_sql / _query_with_nl에도 동일 적용
기타:
- .gitignore: storage/ 추가 (KB 업로드 원본 디렉토리)
- opencode.json: 모델 항목을 실제 서빙 모델(Qwen3.6-27B-FP8 / 256K)로 동기화
검증:
- dotnet build: 경고 0건, 에러 0건
- python3 -m py_compile: OK
- _apply_sql_guards / _validate_sql 스모크 테스트 통과
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
ExperionCrawler
Honeywell Experion OPC UA 서버를 위한 웹 기반 데이터 수집 도구.
아키텍처
ExperionCrawler/
└── src/
├── Core/
│ ├── Domain/Entities/ # ExperionTag, ExperionRecord, ExperionServerConfig ...
│ ├── Application/
│ │ ├── Interfaces/ # IExperionCertificateService, IExperionOpcClient ...
│ │ ├── Services/ # ExperionCrawlService
│ │ └── DTOs/ # ExperionServerConfigDto, ExperionCrawlRequestDto ...
│ └── (Domain 은 Infrastructure 에 의존하지 않음)
│
├── Infrastructure/
│ ├── Certificates/ # ExperionCertificateService (pki/ 폴더 관리)
│ ├── OpcUa/ # ExperionOpcClient, ExperionStatusCodeService
│ ├── Csv/ # ExperionCsvService (CsvHelper)
│ └── Database/ # ExperionDbContext + ExperionDbService (EF Core / SQLite)
│
└── Web/
├── Controllers/ # ExperionCertificateController, ConnectionController ...
├── Program.cs # DI 등록, 미들웨어
└── wwwroot/ # index.html + css/style.css + js/app.js
기능
| 메뉴 | 설명 |
|---|---|
| 01 인증서 관리 | OPC UA 클라이언트 X.509 인증서 생성 / 상태 확인 |
| 02 서버 접속 테스트 | OPC UA 서버 연결 테스트, 단일 태그 읽기, 노드 탐색 |
| 03 데이터 크롤링 | 복수 노드 주기 수집 → CSV 저장 |
| 04 DB 저장 | CSV 파일 → SQLite DB 임포트, 레코드 조회 |
Ubuntu 서버 배포
사전 요구사항
# .NET 8 SDK (없으면 deploy.sh 가 자동 설치)
dotnet --version
한 번에 배포
git clone <repo> ExperionCrawler
cd ExperionCrawler
sudo bash deploy.sh
수동 실행 (개발/테스트)
cd src/Web
dotnet run
# → http://localhost:5000
서비스 관리
sudo systemctl status experioncrawler
sudo systemctl restart experioncrawler
sudo systemctl stop experioncrawler
sudo journalctl -u experioncrawler -f # 실시간 로그
PKI 디렉토리 구조 (원본 Program.cs 준수)
<실행 위치>/
└── pki/
├── own/certs/{clientHostName}.pfx ← 생성된 클라이언트 인증서
├── trusted/certs/ ← 신뢰 피어 인증서
├── issuers/certs/ ← 신뢰 발급자 (필수 경로)
└── rejected/certs/ ← 거부된 인증서
데이터 저장 위치
<실행 위치>/
└── data/
├── experion.db ← SQLite DB
└── csv/ ← 크롤링 CSV 파일
API 엔드포인트
GET /api/certificate/status?clientHostName=dbsvr
POST /api/certificate/create { clientHostName, subjectAltNames, pfxPassword }
POST /api/connection/test { serverHostName, port, clientHostName, userName, password }
POST /api/connection/read { serverConfig, nodeId }
POST /api/connection/browse { serverConfig, startNodeId? }
POST /api/crawl/start { serverConfig, nodeIds[], intervalSeconds, durationSeconds }
GET /api/database/files
POST /api/database/import { fileName }
GET /api/database/records?limit=100&from=&to=
Swagger UI: http://<서버IP>:5000/swagger (Development 모드)
패키지 버전
| 패키지 | 버전 |
|---|---|
| OPCFoundation.NetStandard.Opc.Ua.Client | 1.5.374.85 |
| OPCFoundation.NetStandard.Opc.Ua.Core | 1.5.374.85 |
| CsvHelper | 33.0.1 |
| Microsoft.EntityFrameworkCore.Sqlite | 8.0.13 |
| Swashbuckle.AspNetCore | 6.8.1 |
Description
Languages
C#
43.4%
Python
31.1%
JavaScript
16.2%
HTML
4.6%
CSS
4%
Other
0.7%