@@ -8,6 +8,9 @@ $spikeRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
88$runtimeRoot = Join-Path $spikeRoot ' runtime'
99$certRoot = Join-Path $runtimeRoot ' certs'
1010$synapseImage = ' matrixdotorg/synapse:v1.157.0@sha256:53a686c52cdfca5fdb0adff5ef10b276b1d0971931b09815a9eb6b48d7188a1a'
11+ $isWindows = [System.Runtime.InteropServices.RuntimeInformation ]::IsOSPlatform(
12+ [System.Runtime.InteropServices.OSPlatform ]::Windows
13+ )
1114
1215if ($Reset ) {
1316 Push-Location $spikeRoot
@@ -80,9 +83,7 @@ function Ensure-SynapseConfig {
8083 $configPath = Join-Path $dataPath ' homeserver.yaml'
8184 if (-not (Test-Path - LiteralPath $configPath )) {
8285 $dockerRunArguments = @ (' run' , ' --rm' )
83- if (-not [System.Runtime.InteropServices.RuntimeInformation ]::IsOSPlatform(
84- [System.Runtime.InteropServices.OSPlatform ]::Windows
85- )) {
86+ if (-not $isWindows ) {
8687 $userId = (& id - u).Trim()
8788 if ($LASTEXITCODE -ne 0 -or $userId -notmatch ' ^\d+$' ) {
8889 throw ' Could not determine the Unix user ID for Matrix spike setup'
@@ -163,6 +164,22 @@ allow_public_rooms_over_federation: true
163164"@
164165 }
165166 Copy-Item - LiteralPath $caCert - Destination (Join-Path $dataPath ' test-ca.crt' ) - Force
167+ if (-not $isWindows ) {
168+ # Disposable CI only: the host runner owns setup files while Synapse
169+ # runs as UID 991. Keep the gitignored runtime mutually accessible so
170+ # reset can rewrite it and the container can create its SQLite/media
171+ # state. Production homeserver permissions are configured elsewhere.
172+ & chmod 0777 $dataPath
173+ if ($LASTEXITCODE -ne 0 ) {
174+ throw " Could not grant Synapse write access to $dataPath "
175+ }
176+ foreach ($runtimeFile in Get-ChildItem - LiteralPath $dataPath - File) {
177+ & chmod 0644 $runtimeFile.FullName
178+ if ($LASTEXITCODE -ne 0 ) {
179+ throw " Could not grant Synapse read access to $ ( $runtimeFile.FullName ) "
180+ }
181+ }
182+ }
166183}
167184
168185Ensure- SynapseConfig - DirectoryName ' hs1' - ServerName ' hs1.mesh.test' - HostPort 8008
0 commit comments