Skip to content

feat: launchd service for auto-start and crash recovery#8

Merged
BH3GEI merged 1 commit into
mainfrom
feat/08-launchd-service
May 21, 2026
Merged

feat: launchd service for auto-start and crash recovery#8
BH3GEI merged 1 commit into
mainfrom
feat/08-launchd-service

Conversation

@BH3GEI

@BH3GEI BH3GEI commented May 21, 2026

Copy link
Copy Markdown
Member

Summary

  • Add deploy/com.mofa.digital-human.plist for macOS launchd
  • KeepAlive: auto-restarts on crash, RunAtLoad: starts on login
  • Logs stdout/stderr to ~/digital-human-live/logs/
  • Replaces manual nohup process with proper service management

Test plan

  • ssh macmini2 "launchctl list | grep mofa" shows the service
  • curl -s https://dh.mofa.ai/api/health returns ok
  • Kill uvicorn and verify launchd restarts it automatically

Provides auto-start on login and crash recovery via KeepAlive.
Logs to ~/digital-human-live/logs/ for easy debugging.
The OPENAI_API_KEY placeholder is replaced during deployment.
Copilot AI review requested due to automatic review settings May 21, 2026 16:49
@BH3GEI BH3GEI merged commit 845362d into main May 21, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a macOS launchd service definition to run the FastAPI/uvicorn app as a managed background job, aiming to replace manual nohup usage with auto-start and crash recovery.

Changes:

  • Introduces a launchd plist (deploy/com.mofa.digital-human.plist) to start uvicorn on login (RunAtLoad).
  • Enables automatic restarts via KeepAlive.
  • Directs stdout/stderr to log files under a logs/ directory.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +24 to +25
<key>OPENAI_API_KEY</key>
<string>YOUR_OPENAI_API_KEY_HERE</string>
Comment on lines +9 to +21
<key>ProgramArguments</key>
<array>
<string>/Users/mac/Library/Python/3.9/bin/uvicorn</string>
<string>app:app</string>
<string>--host</string>
<string>0.0.0.0</string>
<string>--port</string>
<string>8080</string>
</array>

<key>WorkingDirectory</key>
<string>/Users/mac/digital-human-live</string>

Comment on lines +37 to +40
<string>/Users/mac/digital-human-live/logs/stdout.log</string>

<key>StandardErrorPath</key>
<string>/Users/mac/digital-human-live/logs/stderr.log</string>
Comment on lines +31 to +32
<true/>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants