Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
67 changes: 67 additions & 0 deletions .github/workflows/board-controller-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Build and Publish Board Controller Docker Image

on:
push:
branches: [ main ]
paths:
- 'board-controller/**'
- '.github/workflows/board-controller-docker.yml'
release:
types: [published]

env:
REGISTRY: ghcr.io
IMAGE_NAME: boardsesh-board-controller

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest,enable={{is_default_branch}}

- name: Build and push Docker image
id: build
uses: docker/build-push-action@v5
with:
context: ./board-controller
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
subject-digest: ${{ steps.build.outputs.digest }}
push-to-registry: true
10 changes: 8 additions & 2 deletions app/components/queue-control/hooks/use-controller-websocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,13 @@ export const useControllerWebSocket = (): UseControllerWebSocketReturn => {
}

// Ensure the WebSocket URL includes the /ws path
const wsUrl = controllerUrl.endsWith('/ws') ? controllerUrl : `${controllerUrl}/ws`;
let wsUrl = controllerUrl.endsWith('/ws') ? controllerUrl : `${controllerUrl}/ws`;

// Use WSS if the page is loaded over HTTPS
if (typeof window !== 'undefined' && window.location.protocol === 'https:') {
wsUrl = wsUrl.replace(/^ws:\/\//, 'wss://');
}

console.log('🎮 Connecting to Board Controller:', wsUrl);
wsRef.current = new WebSocket(wsUrl);

Expand Down Expand Up @@ -175,7 +181,7 @@ export const useControllerWebSocket = (): UseControllerWebSocketReturn => {
wsRef.current.close(1000, 'Component unmounting');
}
};
}, [isControllerMode, connect]);
}, [isControllerMode, controllerUrl, connect]);

return {
isControllerMode,
Expand Down
43 changes: 43 additions & 0 deletions board-controller/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
env/
venv/
ENV/
env.bak/
venv.bak/

# Database (will be created in container)
board_controller.db
*.db

# Logs
*.log

# IDE
.vscode/
.idea/
*.swp
*.swo

# OS
.DS_Store
Thumbs.db

# Docker
.dockerignore
Dockerfile
docker-compose.yml

# Git
.git/
.gitignore

# Static frontend files (we redirect to BoardSesh now)
static/

# Data directory (mounted as volume)
data/
32 changes: 32 additions & 0 deletions board-controller/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM python:3.11-slim

# Install system dependencies
RUN apt-get update && apt-get install -y \
bluez \
python3-dbus \
&& rm -rf /var/lib/apt/lists/*

# Set working directory
WORKDIR /app

# Copy requirements and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy application code
COPY main.py .
COPY controller.py .

# Create data directory for persistent storage
RUN mkdir -p /app/data

# Expose port
EXPOSE 8000

# Set environment variables
ENV DB_PATH=/app/data/board_controller.db
ENV PYTHONUNBUFFERED=1
ENV DOCKER_CONTAINER=1

# Run the application with auto-SSL enabled
CMD ["python", "main.py", "--host", "0.0.0.0", "--port", "8000", "--auto-ssl"]
Loading