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
4 changes: 2 additions & 2 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: .NET

on:
push:
branches: [ master ]
branches: [ main ]
pull_request:
branches: [ master ]
branches: [ main ]

jobs:
build:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,14 @@ jobs:
STAGE_DIR="spyder-tally-${{ matrix.rid }}"
mkdir -p "$STAGE_DIR/bin"

# Copy published binary
# Copy published binary and static web assets
cp publish/${{ matrix.rid }}/SpyderTallyControllerWebApp "$STAGE_DIR/bin/"
if [ -d "publish/${{ matrix.rid }}/wwwroot" ]; then
cp -r publish/${{ matrix.rid }}/wwwroot "$STAGE_DIR/bin/"
fi

# Copy config and support files
cp docs/sd_card/install.sh "$STAGE_DIR/"
cp docs/sd_card/nginx.conf "$STAGE_DIR/"
cp docs/sd_card/SpyderTallies.service "$STAGE_DIR/"
cp docs/sd_card/appConfig.json "$STAGE_DIR/"
cp docs/sd_card/deviceConfig.json "$STAGE_DIR/"
Expand Down
6 changes: 6 additions & 0 deletions docs/sd_card/SpyderTallies.service
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ SyslogIdentifier=SpyderTallies
# The install script will replace __USER__ with the installing user
User=__USER__

# Allow binding to port 80 without running as root
AmbientCapabilities=CAP_NET_BIND_SERVICE

# Listen on port 80 directly (no reverse proxy needed)
Environment=ASPNETCORE_URLS=http://+:80

# ensure the service restarts after crashing
Restart=always
# amount of time to wait before restarting the service
Expand Down
20 changes: 6 additions & 14 deletions docs/sd_card/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,6 @@ if systemctl is-active --quiet "$SERVICE_NAME" 2>/dev/null; then
systemctl stop "$SERVICE_NAME"
fi

# --- Install nginx ---

echo "Installing nginx..."
apt-get update -qq
apt-get install -y -qq nginx > /dev/null

# --- Enable I2C ---

echo "Enabling I2C interface..."
Expand All @@ -94,6 +88,12 @@ mkdir -p "$INSTALL_DIR"
cp "$SCRIPT_DIR/bin/SpyderTallyControllerWebApp" "$INSTALL_DIR/"
chmod +x "$INSTALL_DIR/SpyderTallyControllerWebApp"

# Copy static web assets (CSS, JS, images, etc.)
if [ -d "$SCRIPT_DIR/bin/wwwroot" ]; then
cp -r "$SCRIPT_DIR/bin/wwwroot" "$INSTALL_DIR/"
echo " Installed static web assets"
fi

# Copy default config files (only if they don't already exist, to preserve user settings on upgrade)
for config_file in appConfig.json deviceConfig.json; do
if [ ! -f "$INSTALL_DIR/$config_file" ]; then
Expand All @@ -107,14 +107,6 @@ done
# Set ownership so the service user can write config files
chown -R "$INSTALL_USER":"$INSTALL_USER" "$INSTALL_DIR"

# --- Install nginx config ---

echo "Installing nginx configuration..."
cp "$SCRIPT_DIR/nginx.conf" /etc/nginx/nginx.conf
nginx -t -q
systemctl restart nginx
systemctl enable nginx

# --- Install systemd service ---

echo "Installing systemd service..."
Expand Down
44 changes: 0 additions & 44 deletions docs/sd_card/nginx.conf

This file was deleted.

7 changes: 5 additions & 2 deletions src/SpyderTallyControllerWebApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@

var builder = WebApplication.CreateBuilder(args);

//Allow access on outside adapters
builder.WebHost.UseUrls("http://*:5000");
// Use ASPNETCORE_URLS if set (e.g. http://+:80 in production), otherwise default to port 5000 for development
if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("ASPNETCORE_URLS")))
{
builder.WebHost.UseUrls("http://*:5000");
}

builder.Services.AddSingleton(serverEventListener);
builder.Services.AddSingleton<ISpyderRepository, SpyderRepository>();
Expand Down