forked from buildkite/agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlaunchd.plist
93 lines (68 loc) · 3.09 KB
/
launchd.plist
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?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">
<!--
This is an example launchd config for loading buildbox-agent on system boot on OS X systems using launchd
To install:
# Download the launchd config to /Library/LaunchAgents/ (it needs to be owned by root:wheel)
sudo curl -o /Library/LaunchAgents/io.buildbox.buildbox-agent.plist https://raw.githubusercontent.com/buildbox/buildbox-agent/master/templates/launchd.plist
# Set the user to run buildbox-agent as (usually `whoami`). It should be a full OS X user created via System Prefs, and the one you installed buildbox-agent under.
sudo sed -i '' "s/your-build-user/[insert username here]/g" /Library/LaunchAgents/io.buildbox.buildbox-agent.plist
# Set the agent's name
sudo sed -i '' "s/your-agent-name/[insert agent name]/g" /Library/LaunchAgents/io.buildbox.buildbox-agent.plist
# Set the agent's access token
sudo sed -i '' "s/your-agent-access-token/[insert agent access token here]/g" /Library/LaunchAgents/io.buildbox.buildbox-agent.plist
# Create the agent's log directory with permissions for your user
sudo mkdir -p /usr/local/var/log
sudo chmod 775 /usr/local/var/log
sudo chown root:staff /usr/local/var/log
# Add it to launchd (which also starts buildbox-agent)
launchctl load /Library/LaunchAgents/io.buildbox.buildbox-agent.plist
# Check the logs
tail -f /usr/local/var/log/buildbox-agent.log
# Troubleshooting
If you're setting up a new user for your buildbox-agent, the agent may stall on the first attempt of cloning code from your code host.
To solve this you need trust the the RSA fingerprint of your code host manually, just run the following.
ssh github.com
If you need to edit the plist:
# Edit the plist, and then...
launchctl unload /Library/LaunchAgents/io.buildbox.buildbox-agent.plist
launchctl load /Library/LaunchAgents/io.buildbox.buildbox-agent.plist
-->
<plist version="1.0">
<dict>
<key>Label</key>
<string>io.buildbox.buildbox-agent</string>
<key>UserName</key>
<string>your-build-user</string>
<key>ProgramArguments</key>
<array>
<string>/Users/your-build-user/.buildbox/bin/buildbox-agent</string>
<string>start</string>
</array>
<key>KeepAlive</key>
<true/>
<key>RunAtLoad</key>
<true/>
<key>OnDemand</key>
<false/>
<key>ProcessType</key>
<string>Interactive</string>
<key>SessionCreate</key>
<true/>
<key>ThrottleInterval</key>
<integer>30</integer>
<key>StandardOutPath</key>
<string>/usr/local/var/log/buildbox-agent.log</string>
<key>StandardErrorPath</key>
<string>/usr/local/var/log/buildbox-agent.log</string>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin</string>
<key>BUILDBOX_AGENT_TOKEN</key>
<string>your-agent-access-token</string>
<key>BUILDBOX_AGENT_NAME</key>
<string>your-agent-name</string>
</dict>
</dict>
</plist>