Created
May 31, 2016 13:05
-
-
Save fdstevex/52da0d7e5892fe2965eae105b8cf3883 to your computer and use it in GitHub Desktop.
Running buildkite-agent as a Windows service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Download the Windows Service Wrapper binary from this project: https://github.com/kohsuke/winsw | |
2. Copy to your Buildkite directory and rename to "buildkite-service.exe" | |
3. Create buildkite-service.xml: | |
<service> | |
<id>buildkite-service</id> | |
<name>buildkite-service</name> | |
<description>The BuildKite build agent.</description> | |
<executable>buildkite-agent</executable> | |
<arguments>start</arguments> | |
<logmode>rotate</logmode> | |
</service> | |
4. Invoke "buildkite-service install" to register the service. | |
(This may show a dialog indicating that you need to install the .NET Framework 3.5 - you can do this in the Control Panel, search for Turn Windows Features On and Off and install it through the wizard). | |
5. Use the Services control panel to change the user that buildkite-service runs as, to an appropriate user. | |
6. "net start buildkite-agent" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for writing this up. I did some work automating this process, so I thought I'd just leave it here in case it's useful to anyone else. Something like this works for me:
Given there is the file
C:\foo\templates\buildkite-agent.cfg
:And there is the file
C:\foo\templates\buildkite-service.xml
:And an encrypted file
C:\foo\secrets\buildkite_agent_token
:And an encrypted file
C:\foo\secrets\buildkite_agent_user_password
:Then I can install the buildkite agent by running this script as Administrator: