Skip to content

Instantly share code, notes, and snippets.

@DarkOoze
Last active October 7, 2022 08:13
Show Gist options
  • Save DarkOoze/7d0e66c1f9a8297525d5655453d930e0 to your computer and use it in GitHub Desktop.
Save DarkOoze/7d0e66c1f9a8297525d5655453d930e0 to your computer and use it in GitHub Desktop.
#cloud-config
groups:
- docker
users:
- default
- name: buildagent
primary_group: buildagent
groups: buildagent, docker
package_upgrade: true
package_update: true
packages:
- unzip
- docker.io
- openjdk-11-jdk
write_files:
- content: |
[Unit]
Description=TeamCity Build Agent
After=network.target
[Service]
Type=oneshot
User=buildagent
Group=buildagent
ExecStart=/opt/buildagent/bin/agent.sh start
ExecStop=-/opt/buildagent/bin/agent.sh stop
# Support agent upgrade as the main process starts a child and exits then
RemainAfterExit=yes
# Support agent upgrade as the main process gets SIGTERM during upgrade and that maps to exit code 143
SuccessExitStatus=0 143
[Install]
WantedBy=default.target
path: /etc/systemd/system/teamcityagent.service
runcmd:
- wget http://teamcity.sitebase.se:8180/update/buildAgentFull.zip
- mkdir /opt/buildagent
- unzip buildAgentFull.zip -d /opt/buildagent
- chown buildagent /opt/buildagent -R
- cd /opt/buildagent/bin/ && ./install.sh http://teamcity.sitebase.se:8180 -1 buildagent buildagent
- systemctl enable --now teamcityagent.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment