4 Commits

Author SHA1 Message Date
13e1c6dd5c Fix systemd service to use uv with full path
Updated service to use uv run with absolute path to avoid
PATH issues in systemd environment.

Service file changes:
- ExecStart: Uses absolute path to uv (/home/berwn/.local/bin/uv)
- Runs: uv run --no-project python rotary_phone_web.py
- This ensures uv manages dependencies correctly

Install script improvements:
- Auto-detects uv location with 'which uv'
- Falls back to $HOME/.local/bin/uv if not in PATH
- Validates uv exists before proceeding
- Substitutes actual uv path into service file
- Shows detected uv path in output

This fixes:
  ModuleNotFoundError: No module named 'waitress'

Now uv properly manages the virtual environment and
dependencies are available to the service.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 16:16:08 +07:00
6198bff860 Fix systemd service to use python3 directly instead of uv
Changed service to run python3 directly instead of 'make start'
to avoid dependency on uv being installed system-wide.

Service file changes:
- ExecStart: /usr/bin/python3 rotary_phone_web.py (instead of make)
- User/Group: berwn (match actual user, not hardcoded pi)
- WorkingDirectory: /home/berwn/wedding-phone
- PATH includes user's .local/bin for any user-installed packages

Install script improvements:
- Automatically substitutes correct username
- Substitutes correct home directory in PATH
- Substitutes correct working directory
- More robust sed replacements with proper escaping

This fixes the error:
  make: uv: No such file or directory
  make: *** [Makefile:8: start] Error 127

Now the service works regardless of whether uv is installed,
as it uses system python3 which is always available.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 16:11:27 +07:00
d0bbaf6d4e Fix UV build issues by removing build system
**Issues Fixed:**
- Removed hatchling build-backend (not needed for scripts)
- Changed to --no-project mode (no editable install)
- UV now runs scripts directly without building

**Makefile Updated:**
- Uses 'uv run --no-project' to skip build
- Added 'make sync' to install dependencies
- Simplified dependency installation
- No more build errors

**Install Script Updated:**
- Uses 'make sync' instead of 'uv pip install -e .'
- Faster installation, no build step

**Usage:**
```bash
# Install dependencies
make sync

# Run the system (no build needed)
make start

# Everything just works!
```

**Why This Works:**
- No build system = no build errors
- Direct script execution via UV
- Dependencies installed separately
- Simpler, more reliable

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 16:59:03 +07:00
81731ce4a4 Add UV run support and systemd service installer
**UV Integration:**
- Updated pyproject.toml with [tool.uv.scripts]
- Added 'uv run start' to launch wedding phone
- Added 'uv run test' to run audio tests
- Refactored main code into main() function
- Added proper entry point for package installation

**Systemd Service:**
- Created wedding-phone.service template
- Service runs with UV for dependency management
- Automatic restart on failure
- Proper security hardening (NoNewPrivileges, PrivateTmp)
- GPIO and audio group access configured

**Service Installer:**
- Created install_service.sh automated installer
- Auto-detects project path and user
- Checks for UV installation and dependencies
- Configures service file with correct paths
- Option to enable and start immediately
- Provides helpful command reference

**Installer Features:**
- Validates config.json exists (creates from example if missing)
- Installs UV dependencies automatically
- Updates service file paths dynamically
- Color-coded output for clarity
- Error checking at each step
- Clean installation process

**Usage:**
```bash
# Run directly with UV
uv run start

# Install as system service
./install_service.sh

# Service management
sudo systemctl start wedding-phone
sudo systemctl stop wedding-phone
sudo journalctl -u wedding-phone -f
```

**Documentation:**
- Updated README with UV commands
- Added service installation guide
- Removed old manual systemd instructions
- Added service management commands
- Updated file structure documentation

**Benefits:**
- Easier to run (single command)
- Automatic startup on boot
- Better dependency management
- Professional service integration
- Simplified installation process

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 16:52:08 +07:00