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:
@@ -873,12 +873,13 @@ def get_local_ip():
|
||||
except:
|
||||
return "127.0.0.1"
|
||||
|
||||
if __name__ == "__main__":
|
||||
def main():
|
||||
"""Main entry point for the wedding phone application"""
|
||||
# Create templates directory and HTML template
|
||||
script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
templates_dir = os.path.join(script_dir, 'templates')
|
||||
os.makedirs(templates_dir, exist_ok=True)
|
||||
|
||||
|
||||
# Create the HTML template if it doesn't exist
|
||||
template_file = os.path.join(templates_dir, 'index.html')
|
||||
if not os.path.exists(template_file):
|
||||
@@ -1983,3 +1984,6 @@ if __name__ == "__main__":
|
||||
|
||||
# Start Flask web server
|
||||
app.run(host='0.0.0.0', port=WEB_PORT, debug=False, threaded=True)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user