diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..935a340 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,38 @@ +# AGENTS + +이 문서는 dfxagent 코드베이스를 다루는 자동화 에이전트를 위한 작업 지침이다. + +## 프로젝트 개요 +- Spring Boot 기반의 메시지/파일 전송 에이전트 +- 알려진 에이전트 간 라우팅, DB 연동, 파일 전송을 수행 +- 설정 파일(JSON)을 읽어 동작하며, MyBatis 매퍼를 사용 + +## 주요 흐름 요약 +- 추후 작성 예정 + +## 실행 방법 +- Gradle 실행 (예시) + - bootRun --args="--setting.file=D:\projects\bsm-lab\dfx\dfxagent\src\docs\agent-bsm-lab-postgres\conf\dfxagent-bsm-lab-postgres.json" +- JAR 실행 (예시) + - `java -jar dfxagent.jar --setting.file=/path/to/settings.json` + +### CLI 옵션 +- `--setting.check`: 설정 파일 기반 DB 연결/에이전트 연결 점검 +- `--parse.message.file=/path/to/file`: 직렬화된 메시지 파일을 JSON으로 출력 + +## 메시지 처리 규약 +- 추후 작성 예정 + +## HTTP 엔드포인트 +- `POST /listen`: 메시지 수신 (JSON 또는 multipart) +- `POST /telegram`: 처리 결과 ACK 수신 +- `POST /command`: ALIVE/INFORMATION 명령 응답 + +## 작업 시 주의사항 +- dfxagent-bsm-lab-postgres.json 파일과 같이 설정파일 기반으로 동작하므로 매번 설정파일 확인 필요 +- 설정 예시 파일에 실제 접속 정보가 포함될 수 있으니 외부 공유 금지 +- 메시지 저장 디렉터리는 날짜 기반 폴더 구조를 사용 +- MyBatis 매퍼 경로는 설정 파일의 `sqlMapperLocations`에 의존 + +## 테스트/검증 +- 추후 작성 예정 diff --git a/build.gradle b/build.gradle index 3f52b92..2349cb6 100644 --- a/build.gradle +++ b/build.gradle @@ -5,27 +5,20 @@ plugins { } group = 'com.bsmlab.dfx' -version = '1.0.8' +version = '1.0.9' -// git commit hash -> application.yml -def gitCommitId = '' -try { - def stdout = new ByteArrayOutputStream() - providers.exec { - commandLine 'git', 'rev-parse', '--short', 'HEAD' - standardOutput = stdout; - }.result.get() - gitCommitId = stdout.toString().trim() -} -catch (Exception ignored) { - print "git commit ID is not available." -} - -// gradle project properties -> application.yml -processResources { - filesMatching('**/application.yml') { - expand(project.properties + [commitId: gitCommitId, version: version]) - } +tasks.processResources { + filteringCharset = 'UTF-8' + filesMatching('**/application.yml') { + def commitId = providers.exec { + commandLine 'git', 'rev-parse', '--short', 'HEAD' + }.standardOutput.asText.get() + expand([ + commitId: commitId, + version : project.version, + user : [home: System.getProperty('user.home')] + ]) + } } java { diff --git a/src/docs/agent-bsm-lab-postgres/conf/dfxagent-bsm-lab-postgres.json b/src/docs/agent-bsm-lab-postgres/conf/dfxagent-bsm-lab-postgres.json index cdf86a2..01db109 100644 --- a/src/docs/agent-bsm-lab-postgres/conf/dfxagent-bsm-lab-postgres.json +++ b/src/docs/agent-bsm-lab-postgres/conf/dfxagent-bsm-lab-postgres.json @@ -1,6 +1,7 @@ { "description": "bsm-lab 서버에서 실행함. postgres 연결.", "myHostId": "agent-bsm-lab-postgres", + "myHostName": "192.168.0.41", "myListenPort": 17801, "sslEnabled": true, "keyStorePath": "D:/projects/bsm-lab/dfx/dfxagent/src/docs/agent-bsm-lab-postgres/cert/dfxagent-bsm-lab-postgres.p12", @@ -11,7 +12,7 @@ "knownAgentList": [ { "hostId": "agent-tuf-a15-defree-oracle", - "hostName": "localhost", + "hostName": "192.168.0.41", "listenPort": 63801, "sslEnabled": true, "dropBoxIdList": [ @@ -23,9 +24,9 @@ ], "statusChecker": { "cron": "0/5 * * * * *", - "consoleHostName": "", - "consoleListenPort": 0, - "consoleSslEnabled": false + "consoleHostName": "tof.bsm-lab.com", + "consoleListenPort": 443, + "consoleSslEnabled": true }, "dataSourceConfig": [ { diff --git a/src/docs/agent-bsm-lab-postgres/startup.cmd b/src/docs/agent-bsm-lab-postgres/startup.cmd index 0bb128f..7255086 100644 --- a/src/docs/agent-bsm-lab-postgres/startup.cmd +++ b/src/docs/agent-bsm-lab-postgres/startup.cmd @@ -8,6 +8,6 @@ set "AGENT_HOME=D:\projects\bsm-lab\dfx\dfxagent\src\docs\agent-bsm-lab-postgres for /f %%i in ('powershell -NoProfile -Command "Get-Date -Format yyyyMMdd"') do set "TODAY=%%i" chcp 65001 -start "" "%JAVA_HOME%\bin\java.exe" -Dfile.encoding=UTF-8 -jar "%AGENT_HOME%\..\..\..\build\libs\dfxagent-1.0.8.jar" -Xms2048m -Xmx8192m --setting.file="%AGENT_HOME%\conf\dfxagent-bsm-lab-postgres.json" +start "" "%JAVA_HOME%\bin\java.exe" -Dfile.encoding=UTF-8 -jar "%AGENT_HOME%\..\..\..\build\libs\dfxagent-1.0.9.jar" -Xms2048m -Xmx8192m --setting.file="%AGENT_HOME%\conf\dfxagent-bsm-lab-postgres.json" endlocal diff --git a/src/docs/agent-bsm-lab-postgres/wget.exe b/src/docs/agent-bsm-lab-postgres/wget.exe new file mode 100644 index 0000000..0aa4437 Binary files /dev/null and b/src/docs/agent-bsm-lab-postgres/wget.exe differ diff --git a/src/docs/agent-tuf-a15-defree-oracle/conf/dfxagent-tuf-a15-defree-oracle.json b/src/docs/agent-tuf-a15-defree-oracle/conf/dfxagent-tuf-a15-defree-oracle.json index 02aa077..8281cfb 100644 --- a/src/docs/agent-tuf-a15-defree-oracle/conf/dfxagent-tuf-a15-defree-oracle.json +++ b/src/docs/agent-tuf-a15-defree-oracle/conf/dfxagent-tuf-a15-defree-oracle.json @@ -1,12 +1,20 @@ { "description": "로컬에서 실행함. defree.ddns.net의 oracle 연결", "myHostId": "agent-tuf-a15-defree-oracle", + "myHostName": "192.168.0.41", "myListenPort": 63801, + "sslEnabled": true, + "keyStorePath": "D:/projects/bsm-lab/dfx/dfxagent/src/docs/agent-tuf-a15-defree-oracle/cert/dfxagent-bsm-lab-oracle.p12", + "keyStorePassword": "qortpals1!", + "keyStoreAlias": "agent-tuf-a15-defree-oracle", + "trustStorePath": "D:/projects/bsm-lab/dfx/dfxagent/src/docs/agent-tuf-a15-defree-oracle/cert/truststore-bsm-lab-oracle.jks", + "trustStorePassword": "qortpals1!", "knownAgentList": [ { "hostId": "agent-bsm-lab-postgres", - "hostName": "localhost", + "hostName": "192.168.0.41", "listenPort": 17801, + "sslEnabled": true, "dropBoxIdList": [ "dropbox-ttoBd" ], @@ -17,9 +25,9 @@ ], "statusChecker": { "cron": "0/5 * * * * *", - "consoleHostName": "", - "consoleListenPort": 0, - "consoleSslEnabled": false + "consoleHostName": "tof.bsm-lab.com", + "consoleListenPort": 443, + "consoleSslEnabled": true }, "dataSourceConfig": [ { @@ -60,6 +68,7 @@ ] }, "dropBoxConfig": { + "sentMessageStorageRoot": "D:/projects/bsm-lab/dfx/dfxagent/src/docs/agent-tuf-a15-defree-oracle/messages/sent", "receivedMessageStorageRoot": "D:/projects/bsm-lab/dfx/dfxagent/src/docs/agent-tuf-a15-defree-oracle/messages/received", "processedMessageStorageRoot": "D:/projects/bsm-lab/dfx/dfxagent/src/docs/agent-tuf-a15-defree-oracle/messages/processed", "failureMessageStorageRoot": "D:/projects/bsm-lab/dfx/dfxagent/src/docs/agent-tuf-a15-defree-oracle/messages/failure",