|
#cloud-config |
|
write_files: |
|
- path: /root/.ssh/id_rsa |
|
permissions: 0600 |
|
owner: root |
|
content: | |
|
-----BEGIN RSA PRIVATE KEY----- |
|
<YOUR_SSH_KEY_TO_PULL_PRIVATE_GITHUB_REPO> |
|
-----END RSA PRIVATE KEY----- |
|
- path: /root/.dockercfg |
|
permissions: 0600 |
|
owner: root |
|
content: | |
|
{ |
|
"https://index.docker.io/v1/": { |
|
"auth": "<DOCKER_HUB_AUTH_TOKEN>", |
|
"email": "<EMAIL>" |
|
} |
|
} |
|
coreos: |
|
etcd: |
|
# generate a new token for each unique cluster from https://discovery.etcd.io/new?size=1 |
|
# specify the intial size of your cluster with ?size=X |
|
discovery: https://discovery.etcd.io/<TOKEN> |
|
# multi-region and multi-cloud deployments need to use $public_ipv4 |
|
addr: $private_ipv4:4001 |
|
peer-addr: $private_ipv4:7001 |
|
units: |
|
- name: etcd.service |
|
command: start |
|
- name: fleet.service |
|
command: start |
|
# Attached storage mount to avoid space overfow with default tiny GCE drive |
|
- name: format-var-lib-docker.service |
|
command: start |
|
content: | |
|
[Unit] |
|
Description=Formats the var-lib-docker drive |
|
[Service] |
|
Type=oneshot |
|
RemainAfterExit=yes |
|
ExecStart=/usr/sbin/wipefs -f /dev/disk/by-id/google-var-lib-docker |
|
ExecStart=/usr/sbin/mkfs.btrfs -f /dev/disk/by-id/google-var-lib-docker |
|
- name: var-lib-docker.mount |
|
command: start |
|
content: | |
|
Before=docker.service |
|
[Mount] |
|
What=/dev/disk/by-id/google-var-lib-docker |
|
Where=/var/lib/docker |
|
Type=btrfs |
|
- name: format-buildkite.service |
|
command: start |
|
content: | |
|
[Unit] |
|
Description=Formats the buildkite drive |
|
[Service] |
|
Type=oneshot |
|
RemainAfterExit=yes |
|
ExecStart=/usr/sbin/wipefs -f /dev/disk/by-id/google-buildkite |
|
ExecStart=/usr/sbin/mkfs.btrfs -f /dev/disk/by-id/google-buildkite |
|
- name: buildkite.mount |
|
command: start |
|
content: | |
|
Before=docker.service |
|
[Mount] |
|
What=/dev/disk/by-id/google-buildkite |
|
Where=/buildkite |
|
Type=btrfs |
|
- name: fail2ban.service |
|
command: start |
|
content: | |
|
[Unit] |
|
Description=Fail2ban systemd monitoring service |
|
After=docker.service |
|
[Service] |
|
User=core |
|
TimeoutStartSec=10m |
|
EnvironmentFile=/etc/environment |
|
ExecStartPre=-/usr/bin/docker kill fail2ban |
|
ExecStartPre=-/usr/bin/docker rm fail2ban |
|
ExecStart=/usr/bin/docker run --name fail2ban --privileged --net=host -v /run/systemd:/var/run/systemd ianblenke/fail2ban |
|
ExecStop=/usr/bin/docker kill fail2ban |
|
ExecStop=/usr/bin/docker rm fail2ban |
|
Restart=on-failure |
|
TimeoutSec=10 |
|
RestartSec=5 |
|
[X-Fleet] |
|
Global=true |
|
- name: buildagent.service |
|
command: start |
|
content: | |
|
[Unit] |
|
Description=CI build agent |
|
After=docker.service |
|
Requires=docker.service |
|
|
|
[Service] |
|
TimeoutStartSec=0 |
|
ExecStart=/usr/bin/docker run -e BUILDKITE_AGENT_TOKEN=<BUILDKITE_TOKEN> -v /var/lib/docker:/var/lib/docker -v /var/run/docker.sock:/var/run/docker.sock -v /buildkite/builds/:/buildkite/builds/ -v /root/.ssh:/root/.ssh -v /root/.dockercfg:/root/.dockercfg buildkite/agent:ubuntu |