|
Jun16Written by:Martin 16.06.2010 07:31 
In the software industry "eat your own dog food" means to use the software you create for yourself. At Swyx we did this from the beginning. We never had another PBX*. Every new SwyxWare version is used internally first. In the past we hand-selected interim builds to be installed on our production system. We keep this policy for for our main SwyxServer system to ensure maximal availability. We start updating that system to beta versions after we made sure that it works well enough. Swyx Development/QA has a separate system connected to the main one via SwyxLink. That system is used by all Swyx Development/QA staff for their day to day work. With SwyxWare v8.0 we go a step further. We have a build system which builds [sic!] SwyxWare from the latest source code automatically every night. About two weeks ago we started to install and use these daily build on our Swyx Development/QA department SwyxWare system. The update of the system is done automatically with a small Windows Powershell script using SwyxServer’s unattended installation feature available in v8.0. In case you're interested, here’s the update script: 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020 021 022 023 024 025 026 027 028 029 030 031 032 033 034 035 036 037 038 039 040 041 042 043 044 045 046 047 048 049 050 051 052 053 054 055 056 057 058 059 060 061 062 063 064 065 066 067 068 069 070 071 072 073 074 075 076 077 078 079 080 081 082 083 084 085 086 087 088 089 090 091 092 093 094 095 096 097 098 099 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
| <# .SYNOPSIS Updates SwyxWare and SwyxWare Administration with a daily build .DESCRIPTION Retrieves server and admin setup packages from daily build drop location, creates a VM snapshot, removes snapshots older than two days, executes SwyxWare and SwyxWare Administration setup packages, runs ippbxconfig.exe -c unattended.xml .PARAMETER Date Date of daily build to use. Uses current date if not set #> param($date = (get-date)) # HyperV server where the VM to update is located $HyperVServer = "hyperV1" # Daily build drop location $BuildDropLocation = "\\fileserver\Builds\" # Buildname prefix. Script appends $date time stamp $BuildNamePrefix = "Main_" # SwyxWare computer name $SwyxWareServer = "SwyxWare02" $Result = 0 try { $ScriptFolder = (split-path $MyInvocation.MyCommand.Path -Parent) # logging helper . (join-path $ScriptFolder Init-logging.ps1) # init logging $logThreshold = [log4net.Core.Level]::Info $LogFilesPath = (join-path $ScriptFolder "logs\") md $LogFilesPath -erroraction silentlycontinue init-logging (join-path $LogFilesPath "\Install-SwyxWare.log") $logthreshold # some logging utilities we need . (join-path $ScriptFolder Swyx-TraceUtilities.ps1) # ensure that hyperV module is loaded if (!(get-module HyperV)) { import-module HyperV } # daily build root path. Setups are expected here. $rootPath = (get-childitem ($BuildDropLocation + $BuildNamePrefix +($Date.ToString("yyyyMMdd"))+".*") | sort -descending | select -first 1) if (!$rootPath) { throw "No build found for $date" } $ServerSetupPath = join-path $RootPath "setup\server\english\" $AdminSetupPath = join-path $RootPath "setup\admin\english\" add-logMessage -Level Info -Message "update-Swyxware.ps1 starting" add-logMessage -Level Info -Message "RootPath $RootPath" add-logMessage -Level Info -Message "ServerSetupPath $ServerSetupPath" add-logMessage -Level Info -Message "AdminSetupPath $AdminSetupPath" # create snapshot add-logMessage -Level Info -Message "create VM snaphot" $vm = get-vm -Name $SwyxWareServer -Server $HyperVServer $note ="Before installing daily build $rootPath" $snapshot = New-VMSnapshot -VM $vm -Note $note -Server $HyperVServer -Wait -confirm:$false # new-vmsnapshot bug. It returns a string and the snapshot object $snapshot = $snapshot[1] Rename-VMSnapshot -Snapshot $snapshot -NewName ("BeforeDaily_{0:yyyyMMdd}" -f $date) -confirm:$false # remove older snapshots add-logMessage -Level Info -Message ("Remove snapshots older than " + ((get-date).AddDays(-2))) Get-VMSnapshot -VM $vm -Server $HyperVServer -name "BeforeDaily_%" | Where-Object { $_.ConvertToDateTime($_.CreationTime) -lt ((get-date).AddDays(-2)) } | Remove-VMSnapshot -confirm:$false add-logMessage -Level Info -Message "get setup packages from daily build drop location" copy $ServerSetupPath -Destination (join-path $ScriptFolder "Server") -Recurse -Force $ServerSetupPath = join-path $ScriptFolder "server\english\" copy $AdminSetupPath -Destination (join-path $ScriptFolder "Admin") -Recurse -Force $AdminSetupPath = join-path $ScriptFolder "admin\english\" add-logMessage -Level Info -Message "Stop services" stop-service -Force -Name HwdSrv stop-service -Force IpPbxCDS add-logMessage -Level Info -Message "Stop all mmc.exe instances" Stop-Process -Name mmc -Force -ErrorAction SilentlyContinue add-logMessage -Level Info -Message "Install SwyxServer" copy -Path (join-path $($ScriptFolder) "unattended.xml") -Destination $($ServerSetupPath) -Force msiexec.exe /qn /i "$($ServerSetupPath)setup.msi" /l*vx "$($LogFilesPath)msi-server.log" | out-null $result = $lastExitCode if ($result -ne 0) { throw "Install SwyxServer FAILED, error $result" } add-logMessage -Level Info -Message "Install SwyxWare Admin" msiexec.exe /qn /i "$($AdminSetupPath)admin64.msi" /l*vx "$($LogFilesPath)msi-admin.log" | out-null $result = $lastExitCode if ($result -ne 0) { throw "Install SwyxWare Admin FAILED, error $result" } $p = join-path (ls env:'programfiles(x86)').value "SwyxWare" $u = join-path $ScriptFolder "unattended.xml" add-logMessage -Level Info -Message "Run '$p\ippbxconfig.exe -c $u'" &"$p\ippbxconfig.exe" -c "$u" | out-null $result = $lastExitCode if ($result -ne 0) { throw "IpPbxConfig FAILED, error $result" } } finally { gather-logfiles -destinationPath $LogFilesPath add-logMessage -Level Info -Message "Result: $Result" add-logMessage -Level Info -Message "Install-Swyxware.ps1 done" $result } | * When we started we rented rooms in Dortmunds technology centre which provided us with old-style telephones until SwyxWare v1.0 was ready Tags: |
|