33
44#define AppName " ThingConnect Pulse"
55#define AppVersion " 1.0.0"
6- #define AppPublisher " MachDatum "
7- #define AppURL " https://github.com/MachDatum/ThingConnect.Pulse "
6+ #define AppPublisher " ThingConnect "
7+ #define AppURL " https://thingconnect.io/pulse "
88#define AppExeName " ThingConnect.Pulse.Server.exe"
99#define ServiceName " ThingConnectPulseSvc"
1010#define ServiceDisplayName " ThingConnect Pulse Server"
@@ -23,7 +23,7 @@ DefaultDirName={autopf}\ThingConnect.Pulse
2323DefaultGroupName = {#AppName}
2424DisableProgramGroupPage = yes
2525OutputDir = installer
26- OutputBaseFilename = ThingConnect. Pulse. Setup
26+ OutputBaseFilename = ThingConnect Pulse - Setup {#AppVersion}
2727Compression = lzma
2828SolidCompression = yes
2929WizardStyle = modern
@@ -35,6 +35,12 @@ DisableReadyPage=no
3535MinVersion = 10.0 .17763
3636ArchitecturesAllowed = x64
3737
38+ ; Enable installation logging
39+ SetupLogging = yes
40+
41+ ; Icon configuration
42+ SetupIconFile = brand\favicon.ico
43+
3844[Languages]
3945Name : " english" ; MessagesFile : " compiler:Default.isl"
4046
@@ -43,17 +49,23 @@ Name: "english"; MessagesFile: "compiler:Default.isl"
4349Source : " publish\*" ; DestDir : " {app} " ; Flags : ignoreversion recursesubdirs createallsubdirs
4450
4551[Icons]
46- Name : " {group} \{#AppName}" ; Filename : " http://localhost:8080" ; IconFilename: " {app} \{#AppExeName}"
47- Name : " {group} \Configuration" ; Filename : " {commonappdata} \ThingConnect.Pulse\config\config.yaml"
48- Name : " {group} \Logs Directory" ; Filename : " {commonappdata} \ThingConnect.Pulse\logs"
52+ Name : " {group} \{#AppName}" ; Filename : " http://localhost:8090" ; IconFilename: " {app} \wwwroot\favicon.ico"
53+ Name : " {group} \Logs Directory" ; Filename : " {commonappdata} \ThingConnect.Pulse\logs" ;
54+ Name : " {group} \Installation Log" ; Filename : " {log} "
55+ Name : " {group} \Documentation" ; Filename : " https://docs.thingconnect.io/pulse"
4956Name : " {group} \{cm:UninstallProgram,{#AppName}}" ; Filename : " {uninstallexe} "
50-
57+
5158[Run]
52- Filename : " http://localhost:8080" ; Description : " Open {#AppName} Web Interface" ; Flags : nowait postinstall shellexec skipifsilent
59+ ; Install and start the Windows service
60+ Filename : " {sys} \sc.exe" ; Parameters : " create " " {#ServiceName}" " start= auto DisplayName= " " {#ServiceDisplayName}" " binPath= " " {app} \{#AppExeName}" " " ; Flags : runhidden ; StatusMsg : " Creating Windows service..."
61+ Filename : " {sys} \sc.exe" ; Parameters : " description " " {#ServiceName}" " " " {#ServiceDescription}" " " ; Flags : runhidden ; StatusMsg : " Setting service description..."
62+ Filename : " {sys} \sc.exe" ; Parameters : " failure " " {#ServiceName}" " reset= 86400 actions= restart/5000/restart/5000/restart/5000" ; Flags : runhidden ; StatusMsg : " Configuring service recovery..."
63+ Filename : " {sys} \sc.exe" ; Parameters : " start " " {#ServiceName}" " " ; Flags : runhidden ; StatusMsg : " Starting Windows service..."
64+ Filename : " http://localhost:8090" ; Description : " Open {#AppName} Web Interface" ; Flags : nowait postinstall shellexec skipifsilent
5365
5466[UninstallRun]
55- Filename : " sc.exe" ; Parameters : " stop " " {#ServiceName}" " " ; Flags : runhidden
56- Filename : " sc.exe" ; Parameters : " delete " " {#ServiceName}" " " ; Flags : runhidden
67+ Filename : " {sys} \ sc.exe" ; Parameters : " stop " " {#ServiceName}" " " ; Flags : runhidden
68+ Filename : " {sys} \ sc.exe" ; Parameters : " delete " " {#ServiceName}" " " ; Flags : runhidden
5769
5870[Code]
5971function IsServiceInstalled (): Boolean;
8395 Sleep(1000 ); // Wait for service removal
8496end ;
8597
86- function InstallService (): Boolean;
87- var
88- ServicePath: String;
89- ResultCode: Integer;
90- begin
91- ServicePath := ' "' + ExpandConstant(' {app}' ) + ' \{#AppExeName}"' ;
92- Log(' Installing service: {#ServiceName} at ' + ServicePath);
93-
94- Result := Exec(' sc.exe' , Format(' create "{#ServiceName}" binPath= "%s" DisplayName= "{#ServiceDisplayName}" start= auto' , [ServicePath]), ' ' , SW_HIDE, ewWaitUntilTerminated, ResultCode);
95-
96- if Result then
97- begin
98- // Set service description
99- Exec(' sc.exe' , ' description "{#ServiceName}" "{#ServiceDescription}"' , ' ' , SW_HIDE, ewWaitUntilTerminated, ResultCode);
100- end ;
101- end ;
102-
103- function StartService (): Boolean;
104- var
105- ResultCode: Integer;
106- begin
107- Log(' Starting service: {#ServiceName}' );
108- Result := Exec(' sc.exe' , ' start "{#ServiceName}"' , ' ' , SW_HIDE, ewWaitUntilTerminated, ResultCode);
109- end ;
98+ // Service installation is now handled by [Run] section
11099
111100procedure CreateDirectoryStructure ();
112101var
@@ -120,73 +109,50 @@ begin
120109 VersionsDir := ProgramDataRoot + ' \versions' ;
121110 LogsDir := ProgramDataRoot + ' \logs' ;
122111 DataDir := ProgramDataRoot + ' \data' ;
123- ConfigFile := ConfigDir + ' \config.yaml' ;
124112
125113 Log(' Creating directory structure at: ' + ProgramDataRoot);
126114
127115 ForceDirectories(ConfigDir);
128116 ForceDirectories(VersionsDir);
129117 ForceDirectories(LogsDir);
130118 ForceDirectories(DataDir);
131-
132- // Create default config file if it doesn't exist
133- if not FileExists(ConfigFile) then
134- begin
135- DefaultConfig :=
136- ' # ThingConnect Pulse Configuration' + #13 #10 +
137- ' # This is the main configuration file for network monitoring' + #13 #10 +
138- ' # ' + #13 #10 +
139- ' # For configuration syntax and examples, see:' + #13 #10 +
140- ' # https://github.com/MachDatum/ThingConnect.Pulse/blob/main/docs/config.schema.json' + #13 #10 +
141- ' ' + #13 #10 +
142- ' # Example configuration:' + #13 #10 +
143- ' # targets:' + #13 #10 +
144- ' # - name: "Router"' + #13 #10 +
145- ' # endpoints:' + #13 #10 +
146- ' # - host: "192.168.1.1"' + #13 #10 +
147- ' # type: "icmp"' + #13 #10 +
148- ' # - name: "Web Services"' + #13 #10 +
149- ' # endpoints:' + #13 #10 +
150- ' # - host: "www.example.com"' + #13 #10 +
151- ' # type: "http"' + #13 #10 +
152- ' # path: "/health"' + #13 #10 +
153- ' ' + #13 #10 +
154- ' # Empty configuration - add your monitoring targets above' + #13 #10 +
155- ' targets: []' + #13 #10 ;
156-
157- SaveStringToFile(ConfigFile, DefaultConfig, False);
158- Log(' Created default config file' );
159- end ;
160119end ;
161120
162121procedure CurStepChanged (CurStep: TSetupStep);
163122begin
164123 case CurStep of
165124 ssInstall:
166125 begin
126+ Log(' === Installation Step: Preparing installation ===' );
127+ Log(' Installation target directory: ' + ExpandConstant(' {app}' ));
128+
167129 // Stop and remove existing service if present
168130 if IsServiceInstalled() then
169131 begin
170- StopService();
171- RemoveService();
132+ Log(' Existing service detected, will be stopped and removed...' );
133+ if StopService() then
134+ Log(' Existing service stopped successfully' )
135+ else
136+ Log(' WARNING: Failed to stop existing service' );
137+
138+ if RemoveService() then
139+ Log(' Existing service removed successfully' )
140+ else
141+ Log(' WARNING: Failed to remove existing service' );
142+ end else
143+ begin
144+ Log(' No existing service found' );
172145 end ;
173146 end ;
174147
175148 ssPostInstall:
176149 begin
150+ Log(' === Post-Install Step: Creating directory structure ===' );
151+
177152 // Create directory structure
153+ Log(' Creating application data directories...' );
178154 CreateDirectoryStructure();
179-
180- // Install and start the Windows service
181- if InstallService() then
182- begin
183- Log(' Service installed successfully' );
184- if not StartService() then
185- MsgBox(' Service installed but failed to start. You can start it manually from Services.msc' , mbInformation, MB_OK);
186- end else
187- begin
188- MsgBox(' Failed to install Windows service. You may need to install manually using install-service.ps1' , mbError, MB_OK);
189- end ;
155+ Log(' Directory structure created successfully' );
190156 end ;
191157 end ;
192158end ;
0 commit comments