-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document how to run multiple agents with different config files #141
Comments
@toolmantim is this still the only way to have multiple config files? Does the config path env var/flag not allow you to specify different files? |
I'm not exactly sure of the steps… I think there's a few different ways to do it. At a base level the agent let's you customise the config path, and create separate configuration files, but the Ubuntu-specific instructions here https://buildkite.com/docs/agent/v3/ubuntu#running-multiple-agents don't tell you how to do it — I believe it only shows how to run multiple agents from the same config file, because it's using a systemd template: https://www.digitalocean.com/community/tutorials/understanding-systemd-units-and-unit-files#creating-instance-units-from-template-unit-files @sj26 is our go-to systemd expert! |
Hi folks! 👋 The systemd way to do this is probably using a template instance specific drop-in file.
This will override the config location for this one particular service instance. You can verify this is working using
|
It'd be great to figure out a real life example, so we could use that instead of "custom". If you're doing a custom agent config, it's probably also on a separate queue? Or perhaps a separate organization? Would you also probably want to override the unit’s |
What about a scenario where you want to run a few agents per host, plus an agent dedicated to pipeline uploads on a separate queue? $ systemctl edit buildkite-agent@pipeline-uploader.service
# opens /etc/systemd/system/buildkite-agent@pipeline-uploader.service.d/override.conf in $EDITOR
$ systemctl cat buildkite-agent@pipeline-uploader.service
# /lib/systemd/system/buildkite-agent@.service
[Unit]
Description=Buildkite Agent (%i)
Documentation=https://buildkite.com/agent
After=syslog.target
After=network.target
[Service]
Type=simple
User=buildkite-agent
Environment=HOME=/var/lib/buildkite-agent
ExecStart=/usr/bin/buildkite-agent start
RestartSec=5
Restart=on-failure
TimeoutStartSec=10
TimeoutStopSec=5min
KillMode=mixed
[Install]
WantedBy=multi-user.target
DefaultInstance=1
# /etc/systemd/system/buildkite-agent@pipeline-uploader.service.d/override.conf
[Service]
Environment=BUILDKITE_AGENT_NAME=%%hostname-pipeline-uploader
Environment=BUILDKITE_AGENT_TAGS=queue=pipeline-uploader $ systemctl enable --now buildkite-agent@pipeline-uploader
Created symlink from /etc/systemd/system/multi-user.target.wants/buildkite-agent@pipeline-uploader.service to /lib/systemd/system/buildkite-agent@.service.
$ systemctl enable --now buildkite-agent@1
Created symlink from /etc/systemd/system/multi-user.target.wants/buildkite-agent@1.service to /lib/systemd/system/buildkite-agent@.service.
$ systemctl enable --now buildkite-agent@2
Created symlink from /etc/systemd/system/multi-user.target.wants/buildkite-agent@2.service to /lib/systemd/system/buildkite-agent@.service.
$ systemctl enable --now buildkite-agent@3
Created symlink from /etc/systemd/system/multi-user.target.wants/buildkite-agent@3.service to /lib/systemd/system/buildkite-agent@.service.
$ systemctl enable --now buildkite-agent@4
Created symlink from /etc/systemd/system/multi-user.target.wants/buildkite-agent@4.service to /lib/systemd/system/buildkite-agent@.service. The default systemd description makes sure the instance name is interpolated, so it looks nice: |
What if I wanted to make let's say 5 copies of a custom service? I could use |
@hofstee ah, in that case you might like to add
You could probably also use systemd's |
(The default buildkite agent configuration uses the name |
In the docs we show how to run multiple agents but we don't show any way to customise the agent configuration files for each agent… say, for giving them different tags/meta-data.
Someone just submitted the process it took for them:
The text was updated successfully, but these errors were encountered: