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>
This commit is contained in:
24
wedding-phone.service
Normal file
24
wedding-phone.service
Normal file
@@ -0,0 +1,24 @@
|
||||
[Unit]
|
||||
Description=Wedding Phone - Vintage Rotary Phone Audio System
|
||||
After=network.target sound.target
|
||||
Wants=network.target sound.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=pi
|
||||
Group=pi
|
||||
WorkingDirectory=/home/pi/wedding-phone
|
||||
Environment="PATH=/home/pi/.local/bin:/usr/local/bin:/usr/bin:/bin"
|
||||
ExecStart=/usr/bin/env uv run start
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
|
||||
# Security hardening
|
||||
NoNewPrivileges=true
|
||||
PrivateTmp=true
|
||||
|
||||
# Allow GPIO access
|
||||
SupplementaryGroups=gpio audio
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user