diff --git a/squashkiwi-streaming/config/overlay/Dockerfile b/squashkiwi-streaming/config/overlay/Dockerfile index 91af08c..4c3e0a9 100644 --- a/squashkiwi-streaming/config/overlay/Dockerfile +++ b/squashkiwi-streaming/config/overlay/Dockerfile @@ -20,10 +20,11 @@ COPY overlay_service.py . # Create recordings directory RUN mkdir -p /recordings -# Run as non-root user +# Create user but don't switch to it - need root for shared volume RUN useradd -m -s /bin/bash overlay && \ chown -R overlay:overlay /app /recordings -USER overlay +# Running as root to access shared /tmp volume +# USER overlay # Health check HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ diff --git a/squashkiwi-streaming/config/overlay/overlay_service.py b/squashkiwi-streaming/config/overlay/overlay_service.py index 31be1fd..1c7aa24 100644 --- a/squashkiwi-streaming/config/overlay/overlay_service.py +++ b/squashkiwi-streaming/config/overlay/overlay_service.py @@ -246,8 +246,20 @@ class ScoreOverlayService: # Initialize overlay text court_name = os.getenv('COURT_NAME', f'Court {self.court_number}') - with open('/tmp/score.txt', 'w') as f: - f.write(f"{court_name} - Waiting for match...") + try: + # Create file with write permissions for all + with open('/tmp/score.txt', 'w') as f: + f.write(f"{court_name} - Waiting for match...") + os.chmod('/tmp/score.txt', 0o666) + except PermissionError: + # If file exists and we can't write, try to remove and recreate + try: + os.remove('/tmp/score.txt') + with open('/tmp/score.txt', 'w') as f: + f.write(f"{court_name} - Waiting for match...") + os.chmod('/tmp/score.txt', 0o666) + except: + logger.error("Cannot create score.txt file - check permissions") await self.cleanup_old_recordings() last_cleanup = datetime.now()