From 02c8117f54a6d6a8b1e6f588b1e03abf34284f60 Mon Sep 17 00:00:00 2001
From: xyc <jc_xiong@hotmail.com>
Date: 星期六, 03 十月 2026 12:22:07 +0800
Subject: [PATCH] feat(部署): 新增 Windows 服务方式开机自启(WinSW)并随包分发
---
HANDOFF.md | 16 +
deploy-templates/README-部署说明.txt | 68 +++++
deploy-templates/backend/install-service.ps1 | 235 +++++++++++++++++++++
.gitignore | 3
docs/打包部署说明.md | 58 ++++
deploy-templates/backend/trafficAudit.xml | 45 ++++
deploy-templates/backend/install-autostart.ps1 | 109 +++++++++
deploy-templates/backend/start-backend-service.cmd | 49 ++++
pack-deploy.ps1 | 49 ++++
9 files changed, 622 insertions(+), 10 deletions(-)
diff --git a/.gitignore b/.gitignore
index 07483f0..0e06315 100644
--- a/.gitignore
+++ b/.gitignore
@@ -72,6 +72,9 @@
web/
traffic-audit-server/web/
+# ==== Windows 鏈嶅姟鍖呰鍣紙WinSW 浜岃繘鍒讹紝17.4MB锛涚敱 pack-deploy.ps1 涓嬭浇骞舵牎楠� SHA-256锛屼笉鍏ュ簱锛�====
+deploy-templates/tools/
+
# ==== 閮ㄧ讲浜х墿锛堜笉鍏ュ簱锛�====
deploy/
traffic-audit-deploy-*.zip
diff --git a/HANDOFF.md b/HANDOFF.md
index a6b9243..ba45b9b 100644
--- a/HANDOFF.md
+++ b/HANDOFF.md
@@ -28,6 +28,22 @@
- **Git/宸ヤ綔鍖猴紙鏈鏇存柊鍓嶏級**锛歚HEAD = origin/main = 37f5209`锛涘綋鍓嶆棤宸茶窡韪枃浠舵敼鍔ㄣ�傛湭璺熻釜椤规湁 `_tmp_holiday_verify/`锛堝巻鍙查獙璇佷骇鐗╋級鍜� `docs.zip`锛堢害 31.6 MB锛岀敤鎴锋湰鍦颁骇鐗╋級锛涗簩鑰呭潎淇濈暀锛屾柊瀵硅瘽涓嶈璇垹鎴栬鎻愪氦銆�
- **涓嬩竴姝�**锛氬闇�閮ㄧ讲锛岀洿鎺ヤ娇鐢ㄤ笂闈㈠彂甯冪洰褰曟垨 zip锛涘闇�缁х画淇鍙戝竷宸ュ叿锛屽厛瀹炵幇鈥滃崰浣嶇妯℃澘鑷姩鍒囨崲 + `backend/web` 鑷姩缁勮 + jar 鍘诲瘑鑷鈥濆悗鍐嶉噸鏂颁骇鍑哄彂甯冨寘銆�
+### Windows 寮�鏈鸿嚜鍚紙10-03 杩藉姞锛岀敤鎴烽�夆�滄柟妗� B鈥濓細娉ㄥ唽鎴� Windows 鏈嶅姟锛�
+- **鍏堝洖绛旇繃鐨勯棶棰�**锛歚start-backend.cmd` **涓嶈兘**鐩存帴鍋氬紑鏈鸿嚜鍚紙鏈熬鏈� `pause`銆佹棤鏃ュ織閲嶅畾鍚戙�佷緷璧� PATH锛夈�傜粰鍑� A锛堣鍒掍换鍔★級/B锛圵indows 鏈嶅姟锛�/C 涓夋柟妗堝悗锛岀敤鎴烽�� **B**銆�
+- **鏂板妯℃澘锛堝凡鍏ュ簱锛�**锛�
+ - `deploy-templates/backend/trafficAudit.xml`锛歐inSW 鏈嶅姟閰嶇疆鈥斺�攊d `TrafficAuditBackend`銆乣startmode=Automatic` + `delayedAutoStart=true`锛堢瓑 MySQL 鍏堝氨缁級銆乣onfailure restart 10s/30s/60s` + `resetfailure 1 hour`銆乣workingdirectory=%BASE%`銆佹棩蹇� `logs\trafficAudit.out.log|err.log`锛�10MB 脳 10 婊氬姩锛夈��
+ - `deploy-templates/backend/install-service.ps1`锛氱鐞嗗憳瀹夎/鏌ョ湅/閲嶅惎/鍒犻櫎锛坄-Status/-Restart/-Remove/-NoStart/-JavaPath`锛夛紱鑷姩瀹氫綅 java锛圝AVA_HOME 鈫� PATH 鈫� JavaSoft 娉ㄥ唽琛� 鈫� Program Files锛夊苟鎶婄粷瀵硅矾寰勫啓杩� XML 鐨� `executable` 鍏冪礌锛涢噸澶嶆墽琛屽箓绛夛紱闈炵鐞嗗憳鐩存帴鎷掔粷銆�
+ - `start-backend-service.cmd` + `install-autostart.ps1`锛堣鍒掍换鍔℃柟寮忥級淇濈暀涓�**澶囬��**锛涙敞鎰� `New-ScheduledTask*` 闇� Win8/Server 2012+锛屼笖**涓嶅彲涓庢湇鍔℃柟寮忓悓鏃跺惎鐢�**锛堜細鎶� 8090锛夈��
+ - `pack-deploy.ps1`锛氭柊澧� WinSW 鑾峰彇锛堢紦瀛� `deploy-templates/tools/winsw.exe` 骞舵牎 SHA-256锛岀己鍒欎粠 GitHub 涓嬭浇 v2.12.0 x64锛変笌 `-SkipServiceWrapper`锛涘寘鍐呰緭鍑� `backend\trafficAudit.exe`锛堟敼鍚嶄互鍖归厤 XML 鏂囦欢鍚嶏級銆俙.gitignore` 鏂板 `deploy-templates/tools/`锛�17.4MB 浜岃繘鍒朵笉鍏ュ簱锛夈��
+- **WinSW = Windows Service Wrapper**锛氭妸鏅�氱▼搴忓寘鎴� Windows 鏈嶅姟銆俲ava.exe 鑷繁涓嶆槸鏈嶅姟绋嬪簭锛岀洿鎺� `sc create` 浼氭姤鈥滄湇鍔℃病鏈夊強鏃跺搷搴斿惎鍔ㄦ垨鎺у埗璇锋眰鈥濓紱WinSW 瀹炵幇浜嗘湇鍔℃帶鍒跺崗璁啀鎷夎捣 `java -jar`锛屽苟绠¢噸鍚笌鏃ュ織銆�
+- **瀹炴祴楠岃瘉锛堟湰鏈猴紝鏈湡姝e畨瑁呮湇鍔★級**锛歚trafficAudit.exe status` 鑳借鎵撳寘 XML 骞惰緭鍑� `NonExistent`锛堣В鏋愰�氳繃锛夛紱鏁呮剰鍐欏潖 XML 鈫� `FATAL - The configuration file cound not be loaded`锛堣瘉鏄庤鏍¢獙璺緞鐪熷疄鏈夋晥锛夛紱`install-service.ps1 -Status` 姝e父杈撳嚭鈥滄湭瀹夎鈥濓紝鏃犲弬鏁� / `-Remove` 鍦ㄩ潪绠$悊鍛樹笅鎶涒�滃繀椤荤鐞嗗憳鈥濅笖涓嶄骇鐢熸敞鍐岄」銆�
+- **韪╁潙锛堥噸瑕侊級**锛歑ML 鏀瑰啓鏈�鍒濈敤姝e垯 `(?s)<executable>.*?</executable>`锛屼細**鍏堝懡涓敞閲婇噷鐨� `<executable>` 瀛楁牱**锛屾妸娉ㄩ噴澶翠笌 service 寮�澶存暣娈靛悶鎺� 鈫� XML 闈炴硶銆傚凡鏀逛负 DOM锛坄SelectSingleNode('/service/executable')`锛夊苟鎶婃敞閲婇噷鐨勮8鏍囩鏀规帀銆傚彟锛氭柊澧炴墦鍖呬唬鐮佹浘澶氫竴涓� `}` 瀵艰嚧璇硶閿欙紝宸茬敤 `Parser::ParseFile` AST 澶嶆牳锛屼袱涓� ps1 鐜板湪璇硶 OK 涓斿潎涓� UTF-8 with BOM銆�
+- **鍏煎鎬э紙鐢ㄦ埛闂�淲in7/Win10/Win11/Server 鏄笉鏄兘鍙互鈥濓級**锛氭湇鍔℃満鍒跺畬鍏ㄤ竴鏍凤紙鑷姩鍚姩/寤惰繜鍚姩/澶辫触閲嶅惎閮芥槸绯荤粺鑳藉姏锛夛紝宸埆鍙湪鍖呰鍣ㄤ緷璧栦粈涔堣繍琛屾椂銆傚疄娴嬩簩杩涘埗锛歚WinSW-x64.exe` 2.12.0 鏄�**鑷寘鍚� .NET 6 鍗曟枃浠�**锛堝惈 `singlefilehost`/`System.Private.CoreLib`/`Microsoft.NETCore.App 6.0.13`/`net6.0`锛夛紝**涓嶉渶瑕佽 .NET Framework**锛涜�佺郴缁燂紙Win7 SP1/2008R2/2012R2锛夎嫢鎶� `api-ms-win-*.dll` 缂哄け锛屽彲鎹㈠畼鏂� `WinSW.NET461.exe`锛�0.6MB锛岄渶 .NET 4.6.1+锛屾敼鍚嶆垚 `trafficAudit.exe` 鍗冲彲锛孹ML 涓嶅姩锛夛紱32 浣嶇郴缁熸崲 `WinSW-x86.exe`銆�
+- **瀹夊叏鎻愮ず**锛歐inSW 瀹樻柟浜х墿**鏈仛 Authenticode 绛惧悕**锛堟湰鏈� `Get-AuthenticodeSignature` = NotSigned锛夛紝鍥犳浠ュ浐瀹� SHA-256 浣滃畬鏁存�ф牎楠岋細`05B82D46AD331CC16BDC00DE5C6332C1EF818DF8CEEFCD49C726553209B3A0DA`锛堜笌 GitHub 鍙戝竷璧勪骇 18,243,033 瀛楄妭涓�鑷达級銆�
+- **鏈獙璇侀」锛堥渶鍦ㄧ洰鏍囨満鍋氫竴娆★級**锛氭湰鏈哄綋鍓嶄笉鏄鐞嗗憳锛�**娌$湡姝� install 杩囨湇鍔�**锛涘紑鏈鸿嚜鍚�佸け璐ラ噸鍚�佹棩蹇楁粴鍔ㄨ鍦ㄦ湇鍔″櫒涓婃寜 README 3.1 鎵ц涓�娆$‘璁ゃ��
+- **鏂板寘锛堟湰鍦帮紝涓嶅叆搴擄級**锛歚deploy/traffic-audit-deploy-20261003-3/`锛�393 鏂囦欢 / 110.49 MB锛寊ip 83.77 MB锛夈�傚凡楠岃瘉锛氭湇鍔′笁浠跺鍦� `backend\`銆佸寘鍐� `trafficAudit.exe` SHA-256 涓庡浐瀹氬�间竴鑷淬�乣backend\web` 涓� `frontend/dist` 鍚� 44 鏂囦欢銆乯ar 鍘诲瘑鑷閫氳繃銆佹棤鏄庢枃 key銆�**鏃х殑 `traffic-audit-deploy-20261003/` 涓� `-2/` 宸茶鍙栦唬**锛岄儴缃茶鐢� `-3`锛堟棫鍖呭緟鐢ㄦ埛纭鍚庡啀鍒狅級銆�
+- **杩愯鐘舵�侊紙鍐欐湰鏉℃椂锛�**锛氬紑鍙戠敤鍚庣 8090锛圥ID 43040锛夈�佸墠绔� 8080锛圥ID 43152锛夊潎鍦ㄨ窇锛涙暟鎹簱 `127.0.0.1:3305/traffic_audit`銆�
+
## 鏈�鏂帮紙2026-10-02锛�
- **鏂版ā鍧楋紙鐢ㄦ埛宸查獙鏀讹紝鏈鎻愪氦/鎺ㄩ�侊級**锛氭柊澧炩�滀笓椤圭粺璁�-閲嶈鑺傚亣鏃モ�濇ā鍧楋紝鍚妭鍋囨棩閰嶇疆銆佽惀涓氭�у娴併�侀潪钀ヤ笟鎬ц溅娴併�佸杩愮郴鏁� 4 寮犺〃锛涚郴缁熼厤缃彍鍗曚粎 admin 鍙淮鎶わ紝涓撻」缁熻-鑺傚亣鏃ユ敮鎸佸鍏ャ�佸鍑恒�佹ā鏉夸笅杞藉拰 Word 蹇姤涓嬭浇銆�
diff --git "a/deploy-templates/README-\351\203\250\347\275\262\350\257\264\346\230\216.txt" "b/deploy-templates/README-\351\203\250\347\275\262\350\257\264\346\230\216.txt"
index 942ac50..da56932 100644
--- "a/deploy-templates/README-\351\203\250\347\275\262\350\257\264\346\230\216.txt"
+++ "b/deploy-templates/README-\351\203\250\347\275\262\350\257\264\346\230\216.txt"
@@ -6,7 +6,12 @@
traffic-audit-server-1.0.0-SNAPSHOT.jar 鍚庣绋嬪簭锛堝惈鍏ㄩ儴渚濊禆锛�**宸插唴宓屽墠绔�**锛�
docs/ 鎶ヨ〃妯℃澘涓庤繍琛屾暟鎹洰褰曪紙蹇呴渶锛屽嬁鍒狅級
application.yml 澶栭儴閰嶇疆锛堟敼杩欓噷鍗冲彲锛屾棤闇�閲嶆柊鎵撳寘锛�
- start-backend.cmd / start-backend.sh 鍚姩鑴氭湰
+ start-backend.cmd / start-backend.sh 鍓嶅彴鍚姩鑴氭湰锛堜汉宸ヨ皟璇曠敤锛屽叧浜嗙獥鍙e氨鍋滐級
+ trafficAudit.exe WinSW 鏈嶅姟鍖呰鍣紙鎶� java 鍙樻垚 Windows 鏈嶅姟锛屽嬁鍒犲嬁鏀瑰悕锛�
+ trafficAudit.xml WinSW 鏈嶅姟閰嶇疆锛堟湇鍔″悕/鍚姩鏂瑰紡/鏃ュ織/澶辫触閲嶅惎绛栫暐锛�
+ install-service.ps1 娉ㄥ唽/鏌ョ湅/閲嶅惎/鍒犻櫎 Windows 鏈嶅姟锛堝紑鏈鸿嚜鍚紝鎺ㄨ崘锛�
+ start-backend-service.cmd 闈炰氦浜掑惎鍔ㄥ櫒锛堟棤 pause銆佸啓 app.log锛岄厤鍚堣鍒掍换鍔$敤锛�
+ install-autostart.ps1 澶囬�夛細娉ㄥ唽鈥滆鍒掍换鍔♀�濇柟寮忕殑寮�鏈鸿嚜鍚�
frontend/
dist/ 鍓嶇鏋勫缓浜х墿锛堝鐢細鎯崇敤 nginx 鎵樼鏃剁敤锛�
nginx.conf.example nginx 閰嶇疆绀轰緥
@@ -25,6 +30,21 @@
MySQL 5.7 / 8.0锛堝繀闇�锛�
**涓嶉渶瑕� Redis**锛堜唬鐮佹湭浣跨敤锛涙棫鐗堣鏄庨噷鐨� Redis 鏄仐鐣欓厤缃紝鍙拷鐣ワ級
**涓嶉渶瑕� nginx**锛堝墠绔凡鍐呭祵杩� jar锛岃闂� 8090 鍗冲彲锛沶ginx 浠呬负澶囬�夋柟妗堬級
+
+銆愭搷浣滅郴缁熷吋瀹规�с��
+ 寮�鏈鸿嚜鍚敤鐨勬槸 Windows 鏈嶅姟锛岃�屸�滆嚜鍔ㄥ惎鍔� / 寤惰繜鍚姩 / 澶辫触鑷姩閲嶅惎鈥濇槸绯荤粺鑷甫鑳藉姏锛�
+ 浠� Win7 SP1 鍒� Win11銆丼erver 2008 R2 鍒� Server 2022/2025 鏈哄埗瀹屽叏涓�鏍枫�傚樊鍒彧鍦ㄦ湇鍔″寘瑁呭櫒
+ trafficAudit.exe 渚濊禆浠�涔堣繍琛屾椂锛�
+ - 鏈寘鍐呯殑 trafficAudit.exe 鏄� WinSW 2.12.0 鐨� x64 鑷寘鍚瀯寤猴紙鑷甫 .NET 6 杩愯鏃讹紝宸叉牎楠� SHA-256锛夛紝
+ **涓嶉渶瑕佸彟澶栧畨瑁� .NET Framework**锛涙帹鑽愮敤浜� 64 浣� Win10 / Win11 / Server 2016 鍙婁互涓娿��
+ - Win7 SP1 / Server 2008 R2 / Server 2012(R2)锛氳嚜鍖呭惈鐗堥�氬父涔熻兘璺戯紙Win7 SP1 闇�鍏堟墦 KB2533623锛夛紱
+ 鑻ユ姤缂哄皯 api-ms-win-*.dll 涔嬬被锛屾崲鎴愬畼鏂� thin 鏋勫缓锛氭妸 WinSW.NET461.exe 涓嬭浇鍚庢敼鍚嶆垚
+ trafficAudit.exe 瑕嗙洊锛堥厤缃� trafficAudit.xml 涓嶇敤鏀癸級锛屽畠闇� .NET Framework 4.6.1+锛�
+ https://github.com/winsw/winsw/releases/download/v2.12.0/WinSW.NET461.exe
+ - 32 浣嶇郴缁燂細鎶婂寘瑁呭櫒鎹㈡垚 WinSW-x86.exe锛堝悓涓�涓嬭浇椤碉級銆�
+ - Win7 / Server 2012 鏈韩宸茶繃寰蒋鏀寔鏈燂紝鏂版湇鍔″櫒寤鸿鐩存帴涓� Server 2016 鍙婁互涓娿��
+ - 鑴氭湰瑕佹眰锛歩nstall-service.ps1 鍦� Windows PowerShell 2.0+ 涓嬪彲鐢紙Win7 鑷甫 2.0锛屽凡鍋氬吋瀹癸級锛�
+ 3.2 鐨勮鍒掍换鍔¤剼鏈敤鍒颁簡 New-ScheduledTask* 鍛戒护锛岄渶瑕� Win8 / Server 2012 鍙婁互涓娿��
銆愰儴缃叉楠ゃ��
1. 鍒濆鍖栨暟鎹簱锛�4 涓剼鏈兘瑕佹墽琛岋紝椤哄簭濡備笅锛�
@@ -45,6 +65,40 @@
Windows锛氬弻鍑� start-backend.cmd
Linux锛� sh start-backend.sh
鎴愬姛鏍囧織锛氬嚭鐜� "Started TrafficAuditApplication" 涓� "Tomcat started on port(s): 8090"
+
+ 3.1 Windows 寮�鏈鸿嚜鍚紙鎺ㄨ崘锛氭敞鍐屾垚 Windows 鏈嶅姟锛屼竴娆¢厤缃暱鏈熺敓鏁堬級
+ 鍓嶆彁锛歜ackend 鐩綍涓嬬殑 trafficAudit.exe / trafficAudit.xml / install-service.ps1 閮藉凡闅忔湰閮ㄧ讲鍖呮彁渚涳紝
+ 涓嶉渶瑕佸彟澶栦笅杞� WinSW锛屼篃涓嶉渶瑕佺粰 java 瑁呭埆鐨勪笢瑗裤��
+ 鍦� backend 鐩綍涓嬶紝鐢ㄣ�愮鐞嗗憳銆慞owerShell 鎵ц锛�
+ powershell -NoProfile -ExecutionPolicy Bypass -File install-service.ps1
+ 鏁堟灉锛氭敞鍐� Windows 鏈嶅姟 TrafficAuditBackend锛屽紑鏈鸿嚜鍔ㄥ惎鍔紙寤惰繜鍚姩锛屽厛绛� MySQL 灏辩华锛夛紝
+ 涓嶉渶瑕佷换浣曠敤鎴风櫥褰曪紱java 杩涚▼寮傚父閫�鍑虹敱鏈嶅姟绠$悊鍣ㄨ嚜鍔ㄩ噸鍚紙10 绉� / 30 绉� / 60 绉掗�掑閲嶈瘯锛�
+ 1 灏忔椂鍚庨噸璇曡鏁版竻闆讹級銆傛湇鍔′互 LocalSystem 韬唤杩愯銆�
+ 鑴氭湰浼氳嚜鍔ㄥ畾浣� java.exe锛圝AVA_HOME 鈫� PATH 鈫� JavaSoft 娉ㄥ唽琛� 鈫� Program Files锛夛紝
+ 骞舵妸缁濆璺緞鍐欒繘 trafficAudit.xml锛圫YSTEM 鏈嶅姟鐨� PATH 涓庣櫥褰曠敤鎴蜂笉鍚岋紝鍐欑粷瀵硅矾寰勬洿绋筹級銆�
+ 甯哥敤鍙傛暟锛�
+ -Status 鏌ョ湅鏈嶅姟鐘舵�侊紙涓嶉渶瑕佺鐞嗗憳锛�
+ -Restart 閲嶅惎鏈嶅姟 -Remove 鍋滄骞跺垹闄ゆ湇鍔�
+ -NoStart 鍙敞鍐屼笉鍚姩 -JavaPath "D:\jdk8\bin\java.exe" 鎵嬪姩鎸囧畾 JDK
+ 鏃ュ織锛歜ackend\logs\trafficAudit.out.log锛堣繍琛岃緭鍑猴級涓� trafficAudit.err.log锛堥敊璇緭鍑猴級锛�
+ 鍗曚釜鏂囦欢 10MB锛屼繚鐣� 10 涓粴鍔ㄦ枃浠躲��
+ 楠岃瘉锛氭祻瑙堝櫒鎵撳紑 http://<閮ㄧ讲鏈篒P>:8090 锛屾垨
+ (Invoke-WebRequest http://127.0.0.1:8090 -UseBasicParsing).StatusCode
+ 娉ㄦ剰锛�
+ - 寮�鏈鸿嚜鍚潬鏈嶅姟鐨勨�滆嚜鍔ㄢ�濆惎鍔ㄧ被鍨嬶紱濡傛灉鎶婂畠鏀规垚鈥滄墜鍔ㄢ�濓紝灏变笉浼氬啀闅忔満鍣ㄥ惎鍔ㄣ��
+ - 閲嶅鎵ц install-service.ps1 鏄畨鍏ㄧ殑锛氫細鍏堝仠鏈嶅姟鍐嶉噸鏂版敞鍐屽苟鍚姩銆�
+ - 鍚屼竴鍙版満涓嶈鍚屾椂鍚敤涓嬮潰鐨勮鍒掍换鍔℃柟寮忥紝涓や釜杩涚▼浼氭姠 8090 绔彛銆�
+ - 寤鸿鎶婇儴缃插寘鏀惧湪 D:\trafficAudit 杩欑被绠�鍗曡矾寰勶紱鏀惧湪鏌愪簺鐢ㄦ埛鐩綍涓嬫椂 LocalSystem
+ 鍙兘娌℃湁鍐欐潈闄愶紝鏃ュ織浼氭姤鏉冮檺閿欒銆�
+
+ 3.2 澶囬�夛細璁″垝浠诲姟鏂瑰紡锛堜笉鎯虫妸鍚庣瑁呮垚鏈嶅姟鏃剁敤锛屼笌 3.1 浜岄�変竴锛�
+ 鍦� backend 鐩綍涓嬶紝鐢ㄣ�愮鐞嗗憳銆慞owerShell 鎵ц锛�
+ powershell -NoProfile -ExecutionPolicy Bypass -File install-autostart.ps1
+ 鏁堟灉锛氭敞鍐岃鍒掍换鍔� TrafficAuditBackend锛屽紑鏈哄欢杩� 60 绉掑悗浠� SYSTEM 韬唤杩愯 start-backend-service.cmd锛�
+ 涓嶉渶瑕佺敤鎴风櫥褰曪紝澶辫触鑷姩閲嶈瘯 3 娆★紝杩愯鏃ュ織鍐欏湪 backend\app.log銆�
+ 甯哥敤鍙傛暟锛�-DelaySeconds 90锛堟敼寤惰繜绉掓暟锛� -StartNow锛堟敞鍐屽悗绔嬪嵆鍚姩涓�娆★級
+ -Status锛堟煡鐪嬬姸鎬侊級 -Remove锛堝垹闄ゅ紑鏈鸿嚜鍚級
+ 娉細鍚姩鍣ㄤ紭鍏堢敤 JAVA_HOME\bin\java.exe锛屾壘涓嶅埌鏃跺洖閫� PATH锛涙娴嬪埌 8090 宸插湪鐩戝惉鍒欑洿鎺ラ��鍑恒��
4. 璁块棶绯荤粺
娴忚鍣ㄦ墦寮� http://<閮ㄧ讲鏈篒P>:8090 锛堝墠绔凡鍐呭祵锛岄〉闈笌鎺ュ彛鍚屾簮锛�
@@ -69,7 +123,15 @@
3. 8090 绔彛琚崰鐢細鏀� application.yml 鐨� server.port 鍚庨噸鍚��
4. 椤甸潰鎵撳紑鏄┖鐧斤細纭璁块棶鐨勬槸 http://<IP>:8090 鏍硅矾寰勶紝涓旀祻瑙堝櫒寮哄埗鍒锋柊锛圕trl+F5锛夈��
5. 涓婁紶澶ф枃浠跺け璐ワ細鍚庣闄愬埗 100MB锛屽凡閰嶇疆锛涘鍓嶉潰杩樻寕浜� nginx锛岄渶鍚屾鏀惧ぇ client_max_body_size銆�
+ 6. 鏈嶅姟宸叉敞鍐屼絾 8090 鎵撲笉寮�锛氱湅 backend\logs\trafficAudit.err.log 鐨勬姤閿欏唴瀹癸紱
+ 鏈嶅姟鏂瑰紡涓嬬敤鐨勬槸 backend\application.yml锛宲assword 蹇呴』鏄湡瀹� MySQL 瀵嗙爜锛堝崰浣嶆枃瀛椾細瀵艰嚧 using password: NO锛夈��
+ 7. 鏈嶅姟鎶モ�滄嫆缁濊闂�濇垨鍐欎笉浜嗘棩蹇楋細閮ㄧ讲鐩綍鏉冮檺涓嶈冻銆�
+ 鎶婇儴缃插寘鏀惧埌 D:\trafficAudit 杩欑被绠�鍗曡矾寰勶紝鎴栫粰 LocalSystem 鎺堜簣璇ョ洰褰曠殑璇诲啓鏉冮檺銆�
+ 8. 鎯充复鏃跺彇娑堝紑鏈鸿嚜鍚絾淇濈暀鏈嶅姟锛歋et-Service TrafficAuditBackend -StartupType Manual
銆愬仠姝㈡湇鍔°��
- Windows锛氬叧闂� start-backend.cmd 绐楀彛
- Linux锛� Ctrl+C锛屾垨 kill 瀵瑰簲 java 杩涚▼锛坧s -ef | grep java锛�
+ 鏈嶅姟鏂瑰紡锛� Stop-Service TrafficAuditBackend 锛堥噸鏂板惎鍔細Start-Service TrafficAuditBackend锛�
+ 褰诲簳鍒犻櫎寮�鏈鸿嚜鍚細install-service.ps1 -Remove
+ 鍓嶅彴鍚姩锛� 鍏抽棴 start-backend.cmd 绐楀彛
+ 璁″垝浠诲姟锛� Stop-ScheduledTask -TaskName TrafficAuditBackend
+ Linux锛� Ctrl+C锛屾垨 kill 瀵瑰簲 java 杩涚▼锛坧s -ef | grep java锛�
diff --git a/deploy-templates/backend/install-autostart.ps1 b/deploy-templates/backend/install-autostart.ps1
new file mode 100644
index 0000000..7507d98
--- /dev/null
+++ b/deploy-templates/backend/install-autostart.ps1
@@ -0,0 +1,109 @@
+锘�<#
+ Register / remove / inspect a Windows Scheduled Task that starts the TrafficAudit
+ backend at machine boot, with no user session required.
+
+ Run from an ELEVATED PowerShell in the backend folder (jar + application.yml +
+ this script + start-backend-service.cmd):
+
+ powershell -NoProfile -ExecutionPolicy Bypass -File install-autostart.ps1
+ powershell -NoProfile -ExecutionPolicy Bypass -File install-autostart.ps1 -DelaySeconds 90
+ powershell -NoProfile -ExecutionPolicy Bypass -File install-autostart.ps1 -StartNow
+ powershell -NoProfile -ExecutionPolicy Bypass -File install-autostart.ps1 -Status
+ powershell -NoProfile -ExecutionPolicy Bypass -File install-autostart.ps1 -Remove
+
+ What it does:
+ - trigger : AtStartup, delayed by -DelaySeconds (default 60s, so MySQL is up first)
+ - principal: SYSTEM, highest privileges, "run whether user is logged on or not"
+ - settings : no execution time limit, start when available, restart 3x / 1 min on failure
+ - action : cmd.exe /c start-backend-service.cmd (logs to app.log next to the jar)
+
+ Notes:
+ - Re-running without -Remove is idempotent (-Force overwrites the task).
+ - Start/stop manually with: Start-ScheduledTask / Stop-ScheduledTask -TaskName <name>
+ - Keep this file ASCII-only: Windows PowerShell 5.1 reads a BOM-less .ps1 as ANSI.
+#>
+param(
+ [string]$TaskName = 'TrafficAuditBackend',
+ [int]$DelaySeconds = 60,
+ [switch]$Remove,
+ [switch]$Status,
+ [switch]$StartNow
+)
+
+$ErrorActionPreference = 'Stop'
+$root = Split-Path -Parent $MyInvocation.MyCommand.Path
+$launcher = Join-Path $root 'start-backend-service.cmd'
+$logFile = Join-Path $root 'app.log'
+
+function Assert-Admin {
+ $identity = [Security.Principal.WindowsIdentity]::GetCurrent()
+ $principal = New-Object Security.Principal.WindowsPrincipal($identity)
+ if (-not $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
+ throw 'This script must run from an elevated (Run as Administrator) PowerShell.'
+ }
+}
+
+if ($Status) {
+ $task = Get-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue
+ if (-not $task) { Write-Host "Scheduled task '$TaskName' is not registered."; exit 1 }
+ $task | Select-Object TaskName, TaskPath, State | Format-List
+ Get-ScheduledTaskInfo -TaskName $TaskName |
+ Select-Object LastRunTime, LastTaskResult, NextRunTime, NumberOfMissedRuns | Format-List
+ exit 0
+}
+
+if ($Remove) {
+ Assert-Admin
+ if (Get-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue) {
+ Unregister-ScheduledTask -TaskName $TaskName -Confirm:$false
+ Write-Host "Removed scheduled task '$TaskName'."
+ } else {
+ Write-Host "Scheduled task '$TaskName' was not registered; nothing to remove."
+ }
+ exit 0
+}
+
+Assert-Admin
+if (-not (Test-Path $launcher)) { throw "Missing launcher: $launcher" }
+if (-not (Test-Path (Join-Path $root 'traffic-audit-server-1.0.0-SNAPSHOT.jar'))) {
+ Write-Host "WARN: jar not found in $root - the task will be registered, but startup will fail until the jar is there."
+}
+
+$action = New-ScheduledTaskAction -Execute 'cmd.exe' -Argument ('/c "' + $launcher + '"') -WorkingDirectory $root
+
+$trigger = New-ScheduledTaskTrigger -AtStartup
+if ($DelaySeconds -gt 0) { $trigger.Delay = 'PT' + $DelaySeconds + 'S' }
+
+$principal = New-ScheduledTaskPrincipal -UserId 'SYSTEM' -LogonType ServiceAccount -RunLevel Highest
+
+$settings = New-ScheduledTaskSettingsSet `
+ -AllowStartIfOnBatteries `
+ -DontStopIfGoingOnBatteries `
+ -StartWhenAvailable `
+ -MultipleInstances IgnoreNew `
+ -RestartCount 3 `
+ -RestartInterval (New-TimeSpan -Minutes 1) `
+ -ExecutionTimeLimit ([TimeSpan]::Zero)
+
+Register-ScheduledTask `
+ -TaskName $TaskName `
+ -Action $action `
+ -Trigger $trigger `
+ -Principal $principal `
+ -Settings $settings `
+ -Description 'TrafficAudit backend auto-start at machine boot (script-managed).' `
+ -Force | Out-Null
+
+Write-Host "Registered scheduled task '$TaskName'."
+Write-Host " Trigger : At startup, +${DelaySeconds}s"
+Write-Host " Principal: SYSTEM (highest privileges, no logon required)"
+Write-Host " Launcher : $launcher"
+Write-Host " Log : $logFile"
+Write-Host ''
+Write-Host "Service address after boot: http://<server-ip>:8090"
+Write-Host "Manage it with: -Status | -StartNow | -Remove"
+
+if ($StartNow) {
+ Start-ScheduledTask -TaskName $TaskName
+ Write-Host "Started task '$TaskName' now."
+}
diff --git a/deploy-templates/backend/install-service.ps1 b/deploy-templates/backend/install-service.ps1
new file mode 100644
index 0000000..16193e8
--- /dev/null
+++ b/deploy-templates/backend/install-service.ps1
@@ -0,0 +1,235 @@
+锘�<#
+ Install / update / remove the TrafficAudit backend as a Windows service.
+
+ The service is a WinSW (Windows Service Wrapper) host: trafficAudit.exe reads
+ trafficAudit.xml and runs "java -jar traffic-audit-server-<version>.jar".
+ Because it is a real Windows service it starts at boot with no user logged on,
+ is listed in services.msc / Get-Service, and is restarted by the Service
+ Control Manager when the java process dies.
+
+ Run from an ELEVATED PowerShell in the backend folder
+ (the folder that contains the jar, application.yml, docs, web and trafficAudit.exe):
+
+ powershell -NoProfile -ExecutionPolicy Bypass -File install-service.ps1
+ powershell -NoProfile -ExecutionPolicy Bypass -File install-service.ps1 -Status
+ powershell -NoProfile -ExecutionPolicy Bypass -File install-service.ps1 -Restart
+ powershell -NoProfile -ExecutionPolicy Bypass -File install-service.ps1 -Remove
+ powershell -NoProfile -ExecutionPolicy Bypass -File install-service.ps1 -NoStart
+ powershell -NoProfile -ExecutionPolicy Bypass -File install-service.ps1 -JavaPath 'D:\jdk8\bin\java.exe'
+
+ What it does:
+ 1. locates java.exe (JAVA_HOME -> PATH -> JavaSoft registry -> Program Files)
+ 2. writes that absolute path into trafficAudit.xml (<executable>)
+ 3. installs or reinstalls the service and starts it (unless -NoStart)
+
+ Notes:
+ - Re-running is idempotent: an existing service is stopped and reinstalled.
+ - Logs: logs\trafficAudit.out.log / logs\trafficAudit.err.log (10 MB x 10 roll).
+ - Do NOT enable the scheduled-task autostart (install-autostart.ps1) at the
+ same time: two hosts would race for the same jar and port 8090.
+ - Keep this file ASCII-only; Windows PowerShell 5.1 reads a BOM-less .ps1 as ANSI.
+#>
+param(
+ [switch]$Remove,
+ [switch]$Status,
+ [switch]$Restart,
+ [switch]$NoStart,
+ [string]$JavaPath
+)
+
+$ErrorActionPreference = 'Stop'
+
+$root = Split-Path -Parent $MyInvocation.MyCommand.Path
+$wrapper = Join-Path $root 'trafficAudit.exe'
+$config = Join-Path $root 'trafficAudit.xml'
+$appConfig = Join-Path $root 'application.yml'
+$serviceId = 'TrafficAuditBackend'
+
+function Assert-Admin {
+ $identity = [Security.Principal.WindowsIdentity]::GetCurrent()
+ $principal = New-Object Security.Principal.WindowsPrincipal($identity)
+ if (-not $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
+ throw 'This script must run from an elevated (Run as Administrator) PowerShell.'
+ }
+}
+
+function Resolve-JavaPath {
+ param([string]$Explicit)
+
+ if ($Explicit) {
+ if (-not (Test-Path $Explicit)) { throw "JavaPath does not exist: $Explicit" }
+ return (Resolve-Path $Explicit).Path
+ }
+
+ if ($env:JAVA_HOME) {
+ $candidate = Join-Path $env:JAVA_HOME 'bin\java.exe'
+ if (Test-Path $candidate) { return (Resolve-Path $candidate).Path }
+ }
+
+ $onPath = Get-Command java.exe -ErrorAction SilentlyContinue
+ if ($onPath -and $onPath.Source) { return $onPath.Source }
+
+ # A SYSTEM service inherits the machine PATH, which often lacks the JDK.
+ # Fall back to the install locations used by Oracle / OpenJDK installers.
+ foreach ($reg in @('HKLM:\SOFTWARE\JavaSoft\JDK', 'HKLM:\SOFTWARE\JavaSoft\Java Development Kit')) {
+ if (-not (Test-Path $reg)) { continue }
+ foreach ($ver in (Get-ChildItem $reg -ErrorAction SilentlyContinue | Sort-Object Name -Descending)) {
+ $home = (Get-ItemProperty -Path $ver.PSPath -Name JavaHome -ErrorAction SilentlyContinue).JavaHome
+ if ($home) {
+ $candidate = Join-Path $home 'bin\java.exe'
+ if (Test-Path $candidate) { return (Resolve-Path $candidate).Path }
+ }
+ }
+ }
+
+ $roots = @($env:ProgramFiles)
+ if (${env:ProgramFiles(x86)}) { $roots += ${env:ProgramFiles(x86)} }
+ foreach ($base in $roots) {
+ foreach ($vendor in @('Java', 'Eclipse Adoptium', 'AdoptOpenJDK', 'Microsoft')) {
+ $hit = Get-ChildItem -Path (Join-Path $base ($vendor + '\*\bin\java.exe')) -ErrorAction SilentlyContinue |
+ Sort-Object FullName -Descending | Select-Object -First 1
+ if ($hit) { return $hit.FullName }
+ }
+ }
+
+ throw 'java.exe not found. Install a JDK 8 and re-run, or pass -JavaPath "D:\path\to\bin\java.exe".'
+}
+
+function Set-WrapperJavaPath {
+ param([string]$JavaExe)
+
+ if (-not (Test-Path $config)) { throw "Missing config file: $config" }
+
+ # Edit through the DOM: a regex would also hit the executable mention inside
+ # the header comment and would mangle the whole document.
+ $doc = New-Object System.Xml.XmlDocument
+ $doc.PreserveWhitespace = $true
+ $doc.Load($config)
+
+ $node = $doc.SelectSingleNode('/service/executable')
+ if (-not $node) { throw "No /service/executable element found in $config" }
+
+ if ($node.InnerText -eq $JavaExe) {
+ Write-Host "Config already points at $JavaExe"
+ return
+ }
+
+ $node.InnerText = $JavaExe
+
+ $settings = New-Object System.Xml.XmlWriterSettings
+ $settings.Encoding = New-Object System.Text.UTF8Encoding $false
+ $settings.Indent = $true
+ $settings.IndentChars = ' '
+ $writer = [System.Xml.XmlWriter]::Create($config, $settings)
+ try { $doc.Save($writer) } finally { $writer.Close() }
+ Write-Host "Updated $config -> $JavaExe"
+}
+
+function Get-ServiceState {
+ Get-Service -Name $serviceId -ErrorAction SilentlyContinue
+}
+
+# ---------- read-only status: no elevation needed ----------
+if ($Status) {
+ $service = Get-ServiceState
+ if (-not $service) {
+ Write-Host "Service '$serviceId' is NOT installed."
+ exit 1
+ }
+ $service | Select-Object Name, DisplayName, Status, StartType | Format-List
+ # Get-CimInstance needs PowerShell 3+; fall back to WMI for Windows 7 / PowerShell 2.
+ $detail = $null
+ try {
+ $detail = Get-CimInstance Win32_Service -Filter "Name='$serviceId'" -ErrorAction Stop
+ } catch {
+ $detail = Get-WmiObject Win32_Service -Filter "Name='$serviceId'" -ErrorAction SilentlyContinue
+ }
+ if ($detail) { $detail | Select-Object ProcessId, StartMode, DelayedAutoStart, PathName | Format-List }
+ if (Test-Path $wrapper) { & $wrapper status }
+ exit 0
+}
+
+if ($Restart) {
+ Assert-Admin
+ if (-not (Get-ServiceState)) { throw "Service '$serviceId' is not installed; run this script without -Restart first." }
+ Write-Host "Restarting service '$serviceId'..."
+ Restart-Service -Name $serviceId -Force
+ Start-Sleep -Seconds 3
+ Get-ServiceState | Select-Object Name, Status | Format-List
+ exit 0
+}
+
+if ($Remove) {
+ Assert-Admin
+ if (-not (Test-Path $wrapper)) { throw "Missing wrapper executable: $wrapper" }
+ if (Get-ServiceState) {
+ Write-Host "Stopping and removing service '$serviceId'..."
+ & $wrapper stop | Out-Null
+ Start-Sleep -Seconds 3
+ & $wrapper uninstall | Out-Null
+ Write-Host "Removed service '$serviceId'. Files in $root were left untouched."
+ } else {
+ Write-Host "Service '$serviceId' is not installed; nothing to remove."
+ }
+ exit 0
+}
+
+# ---------- install / reinstall ----------
+Assert-Admin
+
+if (-not (Test-Path $wrapper)) {
+ throw "Missing wrapper executable: $wrapper`nRebuild the deploy package with pack-deploy.ps1 (it provides WinSW), or copy WinSW-x64.exe here renamed to trafficAudit.exe."
+}
+if (-not (Test-Path $appConfig)) {
+ Write-Host "WARN: application.yml is missing next to the jar."
+ Write-Host " The built-in password placeholder resolves to an empty string and startup will fail with"
+ Write-Host " Java SQLException: Access denied for user 'root'@'localhost' (using password: NO)."
+} else {
+ $line = Select-String -LiteralPath $appConfig -Pattern '^\s*password\s*:' | Select-Object -First 1
+ if (-not $line) {
+ Write-Host "WARN: no 'password:' entry found in application.yml; check the datasource block."
+ } else {
+ $value = ($line.Line -replace '^\s*password\s*:\s*', '').Trim(' ''', '"')
+ if ($value -eq '') {
+ Write-Host "WARN: spring.datasource.password is empty in application.yml; startup may fail with '(using password: NO)'."
+ } elseif ($value -match '[^\x00-\x7F]') {
+ Write-Host "WARN: the datasource password contains non-ASCII characters."
+ Write-Host " If it is still the Chinese placeholder text, replace it with the real MySQL password first."
+ }
+ }
+}
+
+$java = Resolve-JavaPath -Explicit $JavaPath
+Set-WrapperJavaPath -JavaExe $java
+
+$existing = Get-ServiceState
+if ($existing) {
+ Write-Host "Service '$serviceId' already exists (status: $($existing.Status)); reinstalling..."
+ if ($existing.Status -ne 'Stopped') {
+ & $wrapper stop | Out-Null
+ Start-Sleep -Seconds 3
+ }
+ & $wrapper uninstall | Out-Null
+ Start-Sleep -Seconds 2
+}
+
+Write-Host "Installing service '$serviceId'..."
+& $wrapper install
+if ($LASTEXITCODE -ne 0) { throw "WinSW install failed with exit code $LASTEXITCODE" }
+
+if (-not $NoStart) {
+ Write-Host "Starting service '$serviceId' (delayed auto-start is used at boot)..."
+ & $wrapper start
+ Start-Sleep -Seconds 8
+ $service = Get-ServiceState
+ $service | Select-Object Name, DisplayName, Status, StartType | Format-List
+ $serviceDir = Join-Path $root 'logs'
+ Write-Host ''
+ Write-Host "Logs : $serviceDir\trafficAudit.out.log / trafficAudit.err.log"
+ Write-Host "Health check: (Invoke-WebRequest http://127.0.0.1:8090 -UseBasicParsing).StatusCode"
+ Write-Host ''
+ Write-Host "Manage it with: Stop-Service $serviceId | Start-Service $serviceId"
+ Write-Host "Or: .\install-service.ps1 -Status | -Restart | -Remove"
+ Write-Host ''
+ Write-Host 'The service auto-starts on every boot (Automatic, delayed start).'
+}
diff --git a/deploy-templates/backend/start-backend-service.cmd b/deploy-templates/backend/start-backend-service.cmd
new file mode 100644
index 0000000..e3e8c16
--- /dev/null
+++ b/deploy-templates/backend/start-backend-service.cmd
@@ -0,0 +1,49 @@
+@echo off
+rem ============================================================
+rem Non-interactive launcher for Task Scheduler / boot auto-start.
+rem Differences from start-backend.cmd (which is meant for a human):
+rem - no "pause" at the end (nobody can press a key during boot)
+rem - all output goes to app.log next to this file
+rem - resolves java via JAVA_HOME first, then PATH
+rem - exits 0 immediately if port 8090 is already listening
+rem ASCII-only on purpose: cmd.exe reads this file with the OEM
+rem code page, so non-ASCII text here would be garbled.
+rem Registered by install-autostart.ps1; run under the account that
+rem owns the deployment folder (SYSTEM by default).
+rem ============================================================
+setlocal
+cd /d "%~dp0"
+
+set "APP_JAR=traffic-audit-server-1.0.0-SNAPSHOT.jar"
+set "LOG=%~dp0app.log"
+
+netstat -ano | findstr /C:":8090" | findstr /I "LISTENING" >nul 2>nul
+if not errorlevel 1 (
+ echo [%date% %time%] port 8090 is already listening; nothing to do. >> "%LOG%"
+ exit /b 0
+)
+
+if not exist "%~dp0%APP_JAR%" (
+ echo [%date% %time%] ERROR: %APP_JAR% not found in "%CD%". >> "%LOG%"
+ exit /b 1
+)
+
+set "JAVA_EXE="
+if defined JAVA_HOME if exist "%JAVA_HOME%\bin\java.exe" set "JAVA_EXE=%JAVA_HOME%\bin\java.exe"
+if not defined JAVA_EXE for %%J in (java.exe) do set "JAVA_EXE=%%~$PATH:J"
+if not defined JAVA_EXE (
+ echo [%date% %time%] ERROR: java.exe not found. Install JDK 8 or set JAVA_HOME / PATH. >> "%LOG%"
+ exit /b 1
+)
+
+if not exist "%~dp0application.yml" (
+ echo [%date% %time%] WARN: application.yml is missing next to the jar. >> "%LOG%"
+ echo [%date% %time%] The DB password placeholder will resolve to empty and startup will fail with >> "%LOG%"
+ echo [%date% %time%] "Access denied ... (using password: NO)". >> "%LOG%"
+)
+
+echo [%date% %time%] starting backend: "%JAVA_EXE%" -jar "%APP_JAR%" (cwd "%CD%") >> "%LOG%"
+"%JAVA_EXE%" -jar "%~dp0%APP_JAR%" >> "%LOG%" 2>&1
+set "RC=%ERRORLEVEL%"
+echo [%date% %time%] backend exited with code %RC%. >> "%LOG%"
+endlocal & exit /b %RC%
diff --git a/deploy-templates/backend/trafficAudit.xml b/deploy-templates/backend/trafficAudit.xml
new file mode 100644
index 0000000..6c6919a
--- /dev/null
+++ b/deploy-templates/backend/trafficAudit.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ WinSW (Windows Service Wrapper) configuration for the TrafficAudit backend.
+
+ Layout requirement: this file MUST stay in the same folder as the wrapper
+ executable named trafficAudit.exe, the application jar, application.yml,
+ docs\ and web\. WinSW looks for a config file whose name matches the
+ executable (trafficAudit.exe -> trafficAudit.xml).
+
+ %BASE% is expanded by WinSW to the folder that holds this file, so the
+ service always runs with that folder as its working directory.
+
+ The executable element below is rewritten with an absolute java.exe path by
+ install-service.ps1 (a SYSTEM service does not inherit the interactive
+ user PATH, so relying on PATH alone is fragile).
+-->
+<service>
+ <id>TrafficAuditBackend</id>
+ <name>TrafficAudit Backend</name>
+ <description>TrafficAudit freight statistics audit backend (Spring Boot, HTTP port 8090).</description>
+
+ <executable>java.exe</executable>
+ <arguments>-Dfile.encoding=UTF-8 -jar "%BASE%\traffic-audit-server-1.0.0-SNAPSHOT.jar"</arguments>
+ <workingdirectory>%BASE%</workingdirectory>
+
+ <!-- Start at boot, but delayed so a local MySQL service is ready first. -->
+ <startmode>Automatic</startmode>
+ <delayedAutoStart>true</delayedAutoStart>
+
+ <!-- Restart on crash: quickly at first, then back off. Counter resets after 1 hour. -->
+ <onfailure action="restart" delay="10 sec"/>
+ <onfailure action="restart" delay="30 sec"/>
+ <onfailure action="restart" delay="60 sec"/>
+ <resetfailure>1 hour</resetfailure>
+
+ <stoptimeout>30 sec</stoptimeout>
+
+ <logpath>%BASE%\logs</logpath>
+ <log mode="roll-by-size">
+ <sizeThreshold>10240</sizeThreshold>
+ <keepFiles>10</keepFiles>
+ </log>
+ <outfile>trafficAudit.out.log</outfile>
+ <errfile>trafficAudit.err.log</errfile>
+</service>
diff --git "a/docs/\346\211\223\345\214\205\351\203\250\347\275\262\350\257\264\346\230\216.md" "b/docs/\346\211\223\345\214\205\351\203\250\347\275\262\350\257\264\346\230\216.md"
index 4433eca..b976c16 100644
--- "a/docs/\346\211\223\345\214\205\351\203\250\347\275\262\350\257\264\346\230\216.md"
+++ "b/docs/\346\211\223\345\214\205\351\203\250\347\275\262\350\257\264\346\230\216.md"
@@ -55,7 +55,13 @@
鈹� 鈹溾攢 traffic-audit-server-1.0.0-SNAPSHOT.jar 鍚庣 + 鍐呭祵鍓嶇锛堢害 55 MB锛�
鈹� 鈹溾攢 docs/ 妯℃澘涓庤繍琛屾暟鎹紙蹇呴渶锛屽嬁鍒狅級
鈹� 鈹溾攢 application.yml 澶栭儴閰嶇疆锛堟敼杩欓噷鍗冲彲锛屾棤闇�閲嶆墦鍖咃級
-鈹� 鈹斺攢 start-backend.cmd / start-backend.sh 鍚姩鑴氭湰
+鈹� 鈹溾攢 start-backend.cmd / start-backend.sh 鍚姩鑴氭湰锛堜汉宸ュ弻鍑�/鍛戒护琛岋級
+鈹� 鈹溾攢 trafficAudit.exe WinSW 鏈嶅姟鍖呰鍣紙2.12.0 x64锛岃嚜鍖呭惈 .NET 6锛�
+鈹� 鈹溾攢 trafficAudit.xml WinSW 鏈嶅姟閰嶇疆锛堣嚜鍔�/寤惰繜鍚姩銆佸け璐ラ噸鍚�佹棩蹇楁粴鍔級
+鈹� 鈹溾攢 install-service.ps1 娉ㄥ唽/鏌ョ湅/閲嶅惎/鍒犻櫎 Windows 鏈嶅姟锛堝紑鏈鸿嚜鍚紝鎺ㄨ崘锛�
+鈹� 鈹溾攢 start-backend-service.cmd 澶囬�夛細闈炰氦浜掑惎鍔ㄥ櫒锛堟棤 pause銆佸啓 app.log锛�
+鈹� 鈹溾攢 install-autostart.ps1 澶囬�夛細娉ㄥ唽/鏌ョ湅/鍒犻櫎 Windows 寮�鏈鸿嚜鍚鍒掍换鍔�
+鈹� 鈹斺攢 web/ 鍓嶇闈欐�佹枃浠讹紙鐢� dist 鑷姩鍚屾锛�8090 鍗曠鍙fā寮忓繀闇�锛�
鈹溾攢 frontend/
鈹� 鈹溾攢 dist/ 鍓嶇浜х墿锛堜粎 nginx 鏂规闇�瑕侊級
鈹� 鈹斺攢 nginx.conf.example nginx 閰嶇疆绀轰緥
@@ -163,7 +169,41 @@
鎴愬姛鏍囧織锛氭棩蹇楀嚭鐜� `Started TrafficAuditApplication` 涓� `Tomcat started on port(s): 8090`銆�
-### 5.4 璁块棶
+### 5.4 Windows 寮�鏈鸿嚜鍚紙鎺ㄨ崘锛氭敞鍐屾垚 Windows 鏈嶅姟锛�
+
+鍦� `backend` 鐩綍涓嬬敤**绠$悊鍛�** PowerShell 鎵ц锛坄trafficAudit.exe` / `trafficAudit.xml` / `install-service.ps1` 宸查殢鍖呮彁渚涳級锛�
+
+```powershell
+powershell -NoProfile -ExecutionPolicy Bypass -File install-service.ps1
+```
+
+| 椤� | 鍊� |
+|----|----|
+| 鏈嶅姟鍚� | `TrafficAuditBackend`锛坰ervices.msc 閲屾樉绀轰负 TrafficAudit Backend锛� |
+| 鍚姩绫诲瀷 | 鑷姩 + 寤惰繜鍚姩锛堝厛绛� MySQL 灏辩华锛夛紝涓嶉渶瑕佷换浣曠敤鎴风櫥褰� |
+| 杩愯韬唤 | LocalSystem |
+| 澶辫触閲嶅惎 | 10s / 30s / 60s 閫掑锛�1 灏忔椂鍚庤鏁版竻闆讹紙鐢辨湇鍔℃帶鍒剁鐞嗗櫒鎵ц锛� |
+| 鏃ュ織 | `backend\logs\trafficAudit.out.log`銆乣trafficAudit.err.log`锛�10MB 脳 10 婊氬姩锛� |
+
+甯哥敤鍙傛暟锛歚-Status`锛堟棤闇�绠$悊鍛橈級銆乣-Restart`銆乣-Remove`銆乣-NoStart`銆乣-JavaPath "D:\jdk8\bin\java.exe"`銆�
+鑴氭湰浼氳嚜鍔ㄥ畾浣� `java.exe`锛圝AVA_HOME 鈫� PATH 鈫� JavaSoft 娉ㄥ唽琛� 鈫� Program Files锛夊苟鎶�**缁濆璺緞**鍐欒繘 `trafficAudit.xml`锛圫YSTEM 鏈嶅姟鐨� PATH 涓庣櫥褰曠敤鎴蜂笉鍚岋紝鍐欑粷瀵硅矾寰勬洿绋筹級銆傞噸澶嶆墽琛屾槸骞傜瓑鐨勶細鍏堝仠鏈嶅姟鍐嶉噸鏂版敞鍐屽苟鍚姩銆�
+
+> 鍚屼竴鍙版満**涓嶈**鍚屾椂鍚敤璁″垝浠诲姟鏂瑰紡锛坄install-autostart.ps1`锛夛紝涓や釜瀹夸富浼氭姠 8090 绔彛銆�
+
+#### 鎿嶄綔绯荤粺鍏煎鎬�
+
+鏈嶅姟鏈韩锛堣嚜鍔ㄥ惎鍔� / 寤惰繜鍚姩 / 澶辫触閲嶅惎锛変粠 Win7 SP1 鍒� Win11銆丼erver 2008 R2 鍒� Server 2022/2025 鏈哄埗涓�鑷达紝宸埆鍙湪鍖呰鍣ㄤ緷璧栫殑杩愯鏃讹細
+
+| 鐩爣绯荤粺 | 鐢ㄥ摢涓寘瑁呭櫒 | 棰濆渚濊禆 |
+|----------|--------------|----------|
+| Win10 / Win11 / Server 2016 鍙婁互涓婏紙鎺ㄨ崘锛� | 鍖呭唴 `trafficAudit.exe`锛圵inSW 2.12.0 x64 鑷寘鍚級 | 鏃狅紙鑷甫 .NET 6 杩愯鏃讹級 |
+| Win7 SP1 / Server 2008 R2 / Server 2012(R2) | 鍏堣瘯鍖呭唴鑷寘鍚増锛圵in7 闇� KB2533623锛夛紱鎶� `api-ms-win-*.dll` 缂哄け鏃舵崲 `WinSW.NET461.exe` 鏀瑰悕鎴� `trafficAudit.exe` | .NET Framework 4.6.1+ |
+| 32 浣嶇郴缁� | `WinSW-x86.exe` 鏀瑰悕鎴� `trafficAudit.exe` | 鏃狅紙鑷甫 .NET 6 杩愯鏃讹級 |
+
+涓嬭浇椤碉細<https://github.com/winsw/winsw/releases/tag/v2.12.0> 鈥斺�� 浠讳綍鏋勫缓閮界敤鍚屼竴浠� `trafficAudit.xml`锛屾敼鐨勫彧鏄寘瑁呭櫒鏂囦欢鍚嶃��
+`install-service.ps1` 鍦� Windows PowerShell 2.0+ 鍙敤锛沗install-autostart.ps1` 鐢ㄥ埌 `New-ScheduledTask*`锛岄渶 Win8 / Server 2012 鍙婁互涓娿��
+
+### 5.5 璁块棶
娴忚鍣ㄦ墦寮� `http://<閮ㄧ讲鏈篒P>:8090`锛堝墠绔凡鍐呭祵锛岄〉闈笌鎺ュ彛鍚屾簮锛屾棤闇� nginx锛夛紝璐﹀彿 `admin / admin123`銆�
@@ -211,6 +251,10 @@
| 鏁版嵁搴撹繛鎺ュけ璐� | 妫�鏌� `application.yml`锛涚‘璁� 5 涓� SQL 鑴氭湰宸叉墽琛� |
| 鍚姩鎶� `Access denied ... (using password: NO)` | 鍚庣鎷垮埌鐨勫簱鍙d护鏄�**绌轰覆**锛歫ar 鍐呯疆 `${TRAFFIC_DB_PASSWORD:}` 鏈澶栫疆閰嶇疆瑕嗙洊銆傛妸 `backend/application.yml` 鏀惧湪 jar 鍚岀骇骞跺~ `spring.datasource.password`锛屾垨璁剧幆澧冨彉閲� `TRAFFIC_DB_PASSWORD`锛涙敼瀹岄噸鍚紝鏃犻渶閲嶆墦鍖� |
| 绔彛鍗犵敤 | 鏀� `server.port`锛涘墠绔紑鍙戠鍙� 8080 |
+| 鏈嶅姟宸叉敞鍐屼絾 8090 鎵撲笉寮� | 鐪� `backend\logs\trafficAudit.err.log`锛涙湇鍔℃柟寮忚鐨勬槸 `backend\application.yml`锛宍password` 蹇呴』鏄湡瀹炲彛浠� |
+| 鏈嶅姟鎶モ�滄嫆缁濊闂��/鍐欎笉浜嗘棩蹇� | 閮ㄧ讲鐩綍鏉冮檺涓嶈冻锛氭崲鍒� `D:\trafficAudit` 杩欑被绠�鍗曡矾寰勶紝鎴栫粰 LocalSystem 鎺堝啓鏉冮檺 |
+| 涓嶆兂寮�鏈鸿嚜鍚絾淇濈暀鏈嶅姟 | `Set-Service TrafficAuditBackend -StartupType Manual` |
+| Win7/2008R2 涓婃湇鍔″惎涓嶄簡锛堟姤 `api-ms-win-*.dll`锛� | 瑙� 5.4銆屾搷浣滅郴缁熷吋瀹规�с�嶏細鎶� `WinSW.NET461.exe` 鏀瑰悕鎴� `trafficAudit.exe` 鏇挎崲 |
## 鍗併�佸紑鍙戠幆澧冩棩甯稿惎鍔�
@@ -222,6 +266,7 @@
## 鍗佷竴銆佸彉鏇磋褰�
+- **2026-10-03**锛歚pack-deploy.ps1` 琛ラ綈澶栫疆 `application.yml`/`docs`/`db`/鍚姩鑴氭湰骞跺悓姝� `backend\web`锛堜慨 `Access denied ... (using password: NO)`锛夛紱妯℃澘绔彛 8080鈫�8090锛涙柊澧� Windows 鏈嶅姟鏂瑰紡寮�鏈鸿嚜鍚紙WinSW 2.12.0 `trafficAudit.exe` + `trafficAudit.xml` + `install-service.ps1`锛岃嚜鍔�/寤惰繜鍚姩銆佸け璐ラ噸鍚�佹棩蹇楁粴鍔級锛岃鍒掍换鍔℃柟寮忛檷涓哄閫夛紱琛ユ搷浣滅郴缁熷吋瀹规�ц鏄庛��
- **2026-09-13**锛氭柊澧炰竴閿墦鍖呰剼鏈� `package-deploy.py`锛沯ar 鏀逛负鍐呭祵鍓嶇锛堥儴缃叉満涓嶅啀闇�瑕� nginx锛夛紱鍒犻櫎 Redis 鐩稿叧璇存槑锛堜唬鐮佹湭浣跨敤锛夛紱琛� `sql_wyc.sql` 涓� `summary.template-dir`锛涜ˉ `jwt.secret` 鍙栧�艰鍒欙紱琛ラ儴缃插悗楠岃瘉娓呭崟銆�
- 2026-08-27锛氶鐗堬紙zip 閮ㄧ讲鍖� + nginx 鏂规锛夈��
@@ -272,14 +317,17 @@
1. 鐢� `deploy-templates/jar-application.yml`锛堝叏鍗犱綅绗︼級涓存椂鏇挎崲婧愮爜 `application.yml`锛屽啀 `mvn clean package -DskipTests`锛屾瀯寤哄悗鑷姩杩樺師寮�鍙戞満鐪熷疄閰嶇疆锛�
2. **瑙e帇 jar 鑷**锛氭鏌� `BOOT-INF/classes/application.yml` 鏄惁鍏ㄤ负鍗犱綅绗︹�斺�斾竴鏃﹀彂鐜� `sk-` 鎴栨槑鏂囧彛浠�**鐩存帴涓鎵撳寘**锛�
3. `npm run build` 閲嶅缓鍓嶇 `dist`锛�
-4. 鎸� `deploy-templates/` 缁勮瀹屾暣閮ㄧ讲鍖咃紙backend / frontend / db / README-閮ㄧ讲璇存槑.txt锛夆�斺�擿backend/` 鍚� jar銆乣application.yml`銆佸惎鍔ㄨ剼鏈�乣docs/`銆乣web/`锛堢敱 dist 鑷姩鍚屾锛屼緵 8090 鍗曠鍙fā寮忥級锛岃緭鍑哄埌 `<OutRoot>\traffic-audit-deploy-<yyyyMMdd>`锛�
+4. 鎸� `deploy-templates/` 缁勮瀹屾暣閮ㄧ讲鍖咃紙backend / frontend / db / README-閮ㄧ讲璇存槑.txt锛夆�斺�擿backend/` 鍚� jar銆乣application.yml`銆佸惎鍔ㄨ剼鏈�乣docs/`銆乣web/`锛堢敱 dist 鑷姩鍚屾锛屼緵 8090 鍗曠鍙fā寮忥級锛屼互鍙� Windows 鏈嶅姟涓変欢濂� `trafficAudit.exe` + `trafficAudit.xml` + `install-service.ps1`锛岃緭鍑哄埌 `<OutRoot>\traffic-audit-deploy-<yyyyMMdd>`锛�
+ WinSW 浼樺厛鐢� `deploy-templates\tools\winsw.exe` 缂撳瓨锛堟牎楠� SHA-256锛夛紝缂撳瓨缂哄け鎴栧搱甯屼笉绗︽椂鑷姩浠� GitHub 瀹樻柟鍙戝竷椤典笅杞� v2.12.0 x64锛堣浜х墿鏈仛 Authenticode 绛惧悕锛屽洜姝や互鍥哄畾 SHA-256 浣滃畬鏁存�ф牎楠岋級锛�
5. 瀵圭粍瑁呭悗鐨勬暣鍖呭啀鎵竴閬嶆槑鏂囧瘑閽ャ��
-鍙�夊弬鏁帮細`-OutRoot` 鎸囧畾杈撳嚭鐩綍锛堥粯璁や粨搴� `deploy\`锛夈�乣-SkipFrontend` 澶嶇敤鐜版湁 dist銆乣-SkipBackend` 澶嶇敤鐜版湁 jar锛堝彧閲嶇粍鍖呫�佷笉閲嶇紪璇戯紝鐢ㄤ簬蹇�熻ˉ鍖咃級銆�
+鍙�夊弬鏁帮細`-OutRoot` 鎸囧畾杈撳嚭鐩綍锛堥粯璁や粨搴� `deploy\`锛夈�乣-SkipFrontend` 澶嶇敤鐜版湁 dist銆乣-SkipBackend` 澶嶇敤鐜版湁 jar锛堝彧閲嶇粍鍖呫�佷笉閲嶇紪璇戯紝鐢ㄤ簬蹇�熻ˉ鍖咃級銆乣-SkipServiceWrapper` 涓嶆妸 WinSW 鏈嶅姟鍖呰鍣ㄦ墦杩涘寘锛堝嵆涓嶈鈥滄敞鍐屾垚 Windows 鏈嶅姟鈥濈殑寮�鏈鸿嚜鍚級銆�
> 璁板綍锛�2026-10-03锛夛細姝ゅ墠鎵嬪伐浜у嚭鐨� 10-02 鍖呭彧鏈� jar+web+dist锛岀己 `application.yml`/`docs`/`db`/鍚姩鑴氭湰锛岄儴缃叉満鍚姩鎶� `Access denied ... (using password: NO)`銆傜幇宸茬敱鑴氭湰鑷姩琛ラ綈杩欎簺鏂囦欢骞跺湪鎵撳寘鍓嶆浛鎹㈠崰浣嶇閰嶇疆銆�
-妯℃澘浠剁粺涓�鏀惧湪 **`deploy-templates/`**锛堝凡鍏ュ簱锛夛細澶栭儴 `application.yml`銆乣start-backend.cmd/.sh`銆乣nginx.conf.example`銆乣db\{init.sql,sql_city_bus,sql_city_taxi,sql_wyc}.sql`銆乣README-閮ㄧ讲璇存槑.txt`銆傛敼妯℃澘鍗虫敼鎵撳寘浜х墿銆�
+妯℃澘浠剁粺涓�鏀惧湪 **`deploy-templates/`**锛堝凡鍏ュ簱锛夛細澶栭儴 `application.yml`銆乣start-backend.cmd/.sh`銆乣trafficAudit.xml`銆乣install-service.ps1`銆乣start-backend-service.cmd`銆乣install-autostart.ps1`銆乣nginx.conf.example`銆乣db\{init.sql,sql_city_bus,sql_city_taxi,sql_wyc}.sql`銆乣README-閮ㄧ讲璇存槑.txt`銆傛敼妯℃澘鍗虫敼鎵撳寘浜х墿銆�
+
+> `deploy-templates\tools\`锛圵inSW 浜岃繘鍒讹紝17.4MB锛�**涓嶅叆搴�**锛堝凡鍔� `.gitignore`锛夛紝鐢辨墦鍖呰剼鏈寜闇�涓嬭浇骞舵牎楠� SHA-256銆�
### 杞崲瀵嗛挜鍚庡悓姝ユ湰鏈�
diff --git a/pack-deploy.ps1 b/pack-deploy.ps1
index 1e31977..6a3dd55 100644
--- a/pack-deploy.ps1
+++ b/pack-deploy.ps1
@@ -9,7 +9,9 @@
鎵ц mvn clean package锛涙棤璁烘垚璐ラ兘杩樺師寮�鍙戞満鐪熷疄閰嶇疆
2) 瑙e帇 jar 妫�鏌ュ唴缃� application.yml锛氬繀椤诲叏鏄崰浣嶇锛堢姝� sk- 瀵嗛挜 / 鏄庢枃鍙d护锛夛紝涓嶅悎鏍肩洿鎺ヤ腑姝�
3) npm run build 閲嶅缓鍓嶇 dist锛堝彲 -SkipFrontend锛�
- 4) 缁勮瀹屾暣閮ㄧ讲鍖咃細backend(jar + application.yml + 鍚姩鑴氭湰 + docs + web) / frontend/dist / db / README
+ 4) 缁勮瀹屾暣閮ㄧ讲鍖咃細backend(jar + application.yml + 鍚姩鑴氭湰 + 鏈嶅姟鍖呰鍣� + docs + web) / frontend/dist / db / README
+ Windows 鏈嶅姟鍖呰鍣� WinSW锛氫紭鍏堢敤 deploy-templates\tools\winsw.exe 缂撳瓨锛堟牎楠� SHA-256锛夛紝
+ 缂哄け鏃惰嚜鍔ㄤ笅杞� v2.12.0 x64 鍒拌缂撳瓨鐩綍锛涢殢鍖呰緭鍑轰负 backend\trafficAudit.exe
5) 瀵圭粍瑁呭悗鐨勬暣鍖呭啀鎵竴閬嶆槑鏂囧瘑閽�
淇鑳屾櫙锛�2026-10-03锛夛細2026-10-02 鎵嬪伐浜у嚭鐨勫寘缂� application.yml / docs / db / 鍚姩鑴氭湰锛�
@@ -20,7 +22,8 @@
param(
[string]$OutRoot = '',
[switch]$SkipFrontend,
- [switch]$SkipBackend # 澶嶇敤宸插瓨鍦ㄧ殑 jar锛堜笉閲嶇紪璇戙�佷笉鍔ㄦ簮鐮侀厤缃級锛屼粎鐢ㄤ簬琛ュ叏/閲嶇粍鍙戝竷鍖�
+ [switch]$SkipBackend, # 澶嶇敤宸插瓨鍦ㄧ殑 jar锛堜笉閲嶇紪璇戙�佷笉鍔ㄦ簮鐮侀厤缃級锛屼粎鐢ㄤ簬琛ュ叏/閲嶇粍鍙戝竷鍖�
+ [switch]$SkipServiceWrapper # 涓嶆妸 WinSW 鏈嶅姟鍖呰鍣ㄦ墦杩涘寘锛堝嵆涓嶆彁渚涒�滄敞鍐屾垚 Windows 鏈嶅姟鈥濈殑寮�鏈鸿嚜鍚級
)
$ErrorActionPreference = 'Stop'
@@ -117,6 +120,40 @@
}
if (-not (Test-Path $webDist)) { throw "鏈壘鍒板墠绔骇鐗╋細$webDist锛堝幓鎺� -SkipFrontend 閲嶆柊鏋勫缓锛�" }
+# ---------- WinSW锛圵indows 鏈嶅姟鍖呰鍣級鍑嗗锛氭湰鍦扮紦瀛樹紭鍏堬紝缂哄け鏃朵粠瀹樻柟鍙戝竷椤典笅杞藉苟鏍¢獙 SHA-256 ----------
+# WinSW v2.12.0 瀹樻柟浜х墿鏈仛 Authenticode 绛惧悕锛屾墍浠ヤ互鍥哄畾 SHA-256 浣滀负瀹屾暣鎬ф牎楠屻��
+$winswUrl = 'https://github.com/winsw/winsw/releases/download/v2.12.0/WinSW-x64.exe'
+$winswSha256 = '05B82D46AD331CC16BDC00DE5C6332C1EF818DF8CEEFCD49C726553209B3A0DA'
+$winswSrc = Join-Path $tplDir 'tools\winsw.exe'
+
+function Test-WinswCache {
+ param([string]$Path)
+ if (-not (Test-Path -LiteralPath $Path)) { return $false }
+ $hash = (Get-FileHash -LiteralPath $Path -Algorithm SHA256).Hash
+ if ($hash -ne $winswSha256) {
+ Write-Host (' 璀﹀憡锛歐inSW 缂撳瓨 SHA-256 涓嶅尮閰嶏紝灏嗛噸鏂颁笅杞斤紙鏈熸湜 {0}...锛屽疄闄� {1}...锛�' -f $winswSha256.Substring(0, 12), $hash.Substring(0, 12))
+ return $false
+ }
+ return $true
+}
+
+if ($SkipServiceWrapper) {
+ Write-Host ' 宸叉寜 -SkipServiceWrapper 璺宠繃锛氬寘鍐呬笉鍚� Windows 鏈嶅姟鏂瑰紡寮�鏈鸿嚜鍚�'
+} else {
+ if (-not (Test-WinswCache $winswSrc)) {
+ New-Item -ItemType Directory -Force -Path (Split-Path -Parent $winswSrc) | Out-Null
+ Write-Host ' 涓嬭浇 WinSW v2.12.0 x64 ...'
+ try {
+ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
+ Invoke-WebRequest -Uri $winswUrl -OutFile $winswSrc -UseBasicParsing
+ } catch {
+ throw ("涓嬭浇 WinSW 澶辫触锛歿0}銆俙n璇锋墜鍔ㄤ笅杞� {1} 瀛樹负 {2} 鍚庨噸璇曪紝鎴栫敤 -SkipServiceWrapper 璺宠繃銆�" -f $_.Exception.Message, $winswUrl, $winswSrc)
+ }
+ if (-not (Test-WinswCache $winswSrc)) { throw "WinSW 鏍¢獙澶辫触锛屽凡涓鎵撳寘锛�$winswSrc" }
+ }
+ Write-Host (' WinSW 灏辩华锛圫HA-256 宸叉牎楠岋級锛歿0:N1} MB' -f ((Get-Item -LiteralPath $winswSrc).Length / 1MB))
+}
+
# ---------- [4/5] 缁勮瀹屾暣閮ㄧ讲鐩綍 ----------
Write-Host '[4/5] 缁勮閮ㄧ讲鐩綍...'
$stamp = Get-Date -Format 'yyyyMMdd'
@@ -129,6 +166,14 @@
Copy-Item (Join-Path $tplDir 'backend\application.yml') (Join-Path $dest 'backend') -Force
Copy-Item (Join-Path $tplDir 'backend\start-backend.cmd') (Join-Path $dest 'backend') -Force
Copy-Item (Join-Path $tplDir 'backend\start-backend.sh') (Join-Path $dest 'backend') -Force
+Copy-Item (Join-Path $tplDir 'backend\start-backend-service.cmd') (Join-Path $dest 'backend') -Force
+Copy-Item (Join-Path $tplDir 'backend\install-autostart.ps1') (Join-Path $dest 'backend') -Force
+if (-not $SkipServiceWrapper) {
+ # WinSW 瑕佹眰閰嶇疆鏂囦欢鍚嶄笌 exe 鍚屽悕锛歵rafficAudit.exe 璇诲悓鐩綍鐨� trafficAudit.xml
+ Copy-Item -LiteralPath $winswSrc (Join-Path $dest 'backend\trafficAudit.exe') -Force
+ Copy-Item (Join-Path $tplDir 'backend\trafficAudit.xml') (Join-Path $dest 'backend') -Force
+ Copy-Item (Join-Path $tplDir 'backend\install-service.ps1') (Join-Path $dest 'backend') -Force
+}
Copy-Item $webDist (Join-Path $dest 'frontend') -Recurse -Force
Copy-Item (Join-Path $tplDir 'frontend\nginx.conf.example') (Join-Path $dest 'frontend') -Force
Copy-Item (Join-Path $tplDir 'db\*.sql') (Join-Path $dest 'db') -Force
--
Gitblit v1.9.1