feat: run codex acp with launchd on macos
This commit is contained in:
parent
2946a7bc42
commit
75c4c98613
@ -3,8 +3,21 @@
|
||||
ansible.builtin.service:
|
||||
name: caddy
|
||||
state: reloaded
|
||||
when: ansible_os_family != 'Darwin'
|
||||
|
||||
- name: Restart acp codex
|
||||
ansible.builtin.service:
|
||||
name: "{{ acp_codex_service_name }}"
|
||||
state: restarted
|
||||
when: ansible_os_family != 'Darwin'
|
||||
|
||||
- name: Restart acp codex on macOS
|
||||
ansible.builtin.command: "launchctl stop plus.svc.xworkspace.acp.codex"
|
||||
register: launchctl_stop
|
||||
failed_when: false
|
||||
changed_when: false
|
||||
notify: Start acp codex on macOS
|
||||
|
||||
- name: Start acp codex on macOS
|
||||
ansible.builtin.command: "launchctl start plus.svc.xworkspace.acp.codex"
|
||||
changed_when: false
|
||||
|
||||
13
roles/vhosts/acp_server_codex/tasks/macos.yml
Normal file
13
roles/vhosts/acp_server_codex/tasks/macos.yml
Normal file
@ -0,0 +1,13 @@
|
||||
---
|
||||
- name: Create launchd plist template for Codex ACP
|
||||
ansible.builtin.template:
|
||||
src: codex.plist.j2
|
||||
dest: "{{ ansible_env.HOME }}/Library/LaunchAgents/plus.svc.xworkspace.acp.codex.plist"
|
||||
mode: "0644"
|
||||
notify: Restart acp codex on macOS
|
||||
|
||||
- name: Reload launchd agent for Codex ACP
|
||||
ansible.builtin.command: "launchctl load -w {{ ansible_env.HOME }}/Library/LaunchAgents/plus.svc.xworkspace.acp.codex.plist"
|
||||
register: launchctl_result
|
||||
changed_when: false
|
||||
failed_when: launchctl_result.rc != 0 and 'already loaded' not in launchctl_result.stderr
|
||||
41
roles/vhosts/acp_server_codex/templates/codex.plist.j2
Normal file
41
roles/vhosts/acp_server_codex/templates/codex.plist.j2
Normal file
@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Label</key>
|
||||
<string>plus.svc.xworkspace.acp.codex</string>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>/bin/bash</string>
|
||||
<string>-c</string>
|
||||
<string>
|
||||
export PATH="{{ acp_codex_path }}"
|
||||
export LITELLM_MASTER_KEY="{{ acp_codex_auth_token }}"
|
||||
{% for key, value in acp_codex_environment.items() %}
|
||||
export {{ key }}="{{ value }}"
|
||||
{% endfor %}
|
||||
|
||||
exec "{{ acp_codex_bridge_binary_path }}" acp-server \
|
||||
--port {{ acp_codex_listen_port }} \
|
||||
--host {{ acp_codex_listen_host }} \
|
||||
--sub-command codex \
|
||||
--sub-command mcp-app-server
|
||||
</string>
|
||||
</array>
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
<key>KeepAlive</key>
|
||||
<true/>
|
||||
<key>WorkingDirectory</key>
|
||||
<string>{{ acp_codex_workdir }}</string>
|
||||
<key>StandardOutPath</key>
|
||||
<string>{{ ansible_env.HOME }}/.local/state/xworkspace/acp.codex.log</string>
|
||||
<key>StandardErrorPath</key>
|
||||
<string>{{ ansible_env.HOME }}/.local/state/xworkspace/acp.codex.err.log</string>
|
||||
<key>EnvironmentVariables</key>
|
||||
<dict>
|
||||
<key>HOME</key>
|
||||
<string>{{ acp_codex_workdir }}</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
Loading…
Reference in New Issue
Block a user