Skip to content
This repository was archived by the owner on Feb 20, 2021. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added redis.service.conf that turns on logging to the Windows event v…
…iewer. This required that we also log to a file with the logfile setting, otherwise messages are not written to the event viewer...probably a mishandling of Windows OS. The event viewer requires a messages resource in the form of a DLL, so I updated the Win32_Interop project to have a custom build step to compile EventLog.res into EventLog.dll. Updated the WiX project to create the Windows event source and also the directory where the event log file will be written.
  • Loading branch information
NickMRamirez committed Mar 9, 2015
commit 253761278aabcbcbcdb631bbb1a37086d1711b2c
80 changes: 60 additions & 20 deletions msvs/msi/RedisWindowsX64/Components/WindowsServiceComponents.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,33 @@
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
xmlns:fw="http://schemas.microsoft.com/wix/FirewallExtension">
<Fragment>
<Fragment>
<!--This references a WiX property that gives us the localized name of the NETWORK SERVICE user-->
<PropertyRef Id="WIX_ACCOUNT_NETWORKSERVICE" />

<ComponentGroup Id="WindowsServiceComponents" Directory="INSTALLFOLDER">
<!--
The following component installs Redis as a Windows service.
-->
<Component Id="cmp_redis_server" Guid="{959AF3FA-9324-49CB-8915-0563398CDDF6}">
<File Id="file_redis_serverEXE" Source="$(var.RedisServer.TargetDir)redis-server.exe" KeyPath="yes" />
<File Id="file_redis_windowsCONF" Source="!(wix.DocumentationFolder)\redis.windows.conf" />
<ServiceInstall Id="redisService"
<File Id="file_redis_serviceCONF" Source="!(wix.DocumentationFolder)\redis.service.conf" />

<ServiceInstall Id="redisService"
Name="Redis"
DisplayName="Redis"
Description="This service runs the Redis server"
Start="auto"
ErrorControl="normal"
Type="ownProcess"
Arguments="--service-run &quot;[#file_redis_windowsCONF]&quot;"
DisplayName="Redis"
Description="This service runs the Redis server"
Start="auto"
ErrorControl="normal"
Type="ownProcess"
Arguments="--service-run &quot;[#file_redis_serviceCONF]&quot;"
Account="[WIX_ACCOUNT_NETWORKSERVICE]" />
<ServiceControl Id="redisServiceControl"
Name="Redis"
Start="install"
Stop="both"
Remove="uninstall"

<ServiceControl Id="redisServiceControl"
Name="Redis"
Start="install"
Stop="both"
Remove="uninstall"
Wait="yes" />
</Component>

Expand All @@ -37,11 +37,11 @@
-->
<Component Id="cmp_firewall_exception" Guid="{1D39F01C-6C53-4DC1-B189-65F03F7E5E31}" KeyPath="yes">
<Condition><![CDATA[FIREWALL_ON = 1]]></Condition>

<fw:FirewallException Id="fw_redis_server"
Program="[#file_redis_serverEXE]"
Description="Exception for Redis server"
Name="Redis"
Name="Redis"
Scope="any" />
</Component>

Expand All @@ -54,6 +54,46 @@
<util:PermissionEx User="[WIX_ACCOUNT_NETWORKSERVICE]" GenericAll="yes" />
</CreateFolder>
</Component>

<!--
Sets up the Windows event log event source. Note that for this to work the following
must be set in the redis config file:
* logfile "Logs/redis_log.txt" (or any other non-empty value; without a logfile, events are not logged to eventvwr for some reason)
* syslog-enabled yes
* syslog-ident redis
You can verify that the event source was created by inspecting the Windows registry at
HKLM\SYSTEM\CurrentControlSet\Services\EventLog\Application\redis. The Win32_Interop
project compiles EventLog.mc into EventLog.dll via a custom build action (view that file's
properties in Visual Studio for details).
-->
<Component Id="cmp_EventLogDLL" Guid="{5BF66AB1-DC93-4FBB-9A16-005CE9C523BC}">
<File Id="file_EventLogDLL" Source="$(var.RedisServer.TargetDir)EventLog.dll" />
<util:EventSource KeyPath="yes"
EventMessageFile="[#file_EventLogDLL]"
Name="redis"
Log="Application" />
</Component>

<!--
This ensures that the LogsFolder is created even though it starts out empty.
It also ensures that it is removed (along with the log file(s) within) during uninstall.
-->
<Component Id="cmp_LogsFolder" Guid="{C88495B4-469A-4DE7-AA84-653D0FA6628F}" KeyPath="yes">
<CreateFolder Directory="LogsFolder" />
<RemoveFolder Id="removeLogsFolder" Directory="LogsFolder" On="uninstall" />
<RemoveFile Id="removeLogFile" Directory="LogsFolder" Name="*" On="uninstall" />
</Component>
</ComponentGroup>
</Fragment>

<!--
Custom actions that update the redis config file during installation
-->
<Binary Id="RedisCADLL" SourceFile="$(var.RedisWindowsX64.CustomActions.TargetDir)RedisWindowsX64.CustomActions.CA.dll" />
<CustomAction Id="ca_UpdateRedisConfig" BinaryKey="RedisCADLL" DllEntry="UpdateRedisConfig" Execute="deferred" Return="check" />
<SetProperty Id="ca_UpdateRedisConfig" Value="CONFIG_PATH=[#file_redis_serviceCONF];PORT=[PORT];" Sequence="execute" Before="ca_UpdateRedisConfig" />

<InstallExecuteSequence>
<Custom Action="ca_UpdateRedisConfig" After="InstallFiles"><![CDATA[NOT Installed]]></Custom>
</InstallExecuteSequence>
</Fragment>
</Wix>
15 changes: 4 additions & 11 deletions msvs/msi/RedisWindowsX64/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
xmlns:fw="http://schemas.microsoft.com/wix/FirewallExtension">
<!--
32-bit installer
64-bit installer

Example installation (command-line):
default install:
Expand Down Expand Up @@ -33,15 +33,6 @@
<!--User interface hook-->
<UIRef Id="CustomInstallDir"/>

<!--Custom actions-->
<Binary Id="RedisCustomActionsDLL" SourceFile="$(var.RedisWindowsX64.CustomActions.TargetDir)RedisWindowsX64.CustomActions.CA.dll" />
<CustomAction Id="ca_UpdateRedisConfig" BinaryKey="RedisCustomActionsDLL" DllEntry="UpdateRedisConfig" Execute="deferred" Return="check" />
<SetProperty Id="ca_UpdateRedisConfig" Value="CONFIG_PATH=[#file_redis_windowsCONF];PORT=[PORT]" Sequence="execute" Before="ca_UpdateRedisConfig" />

<InstallExecuteSequence>
<Custom Action="ca_UpdateRedisConfig" After="InstallFiles"><![CDATA[NOT Installed]]></Custom>
</InstallExecuteSequence>

<!--Properties-->
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
<Property Id="ARPURLINFOABOUT" Value="https://github.com/MSOpenTech/redis" />
Expand All @@ -66,7 +57,9 @@
<!--Directory structure to create-->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id="INSTALLFOLDER" Name="Redis-Windows" />
<Directory Id="INSTALLFOLDER" Name="Redis-Windows">
<Directory Id="LogsFolder" Name="Logs" />
</Directory>
</Directory>
</Directory>
</Fragment>
Expand Down
Loading