How to customize the cloud-init template
You can customize your instance configuration by providing a custom cloud-init file. Below is sample cloud-init file that you can use as a baseline and customize.
#cloud-config
apt_reboot_if_required: false
package_update: false
package_upgrade: false
apt:
sources:
docker.list:
source: deb [arch=amd64] https://download.docker.com/linux/ubuntu $RELEASE stable
keyid: 0EBFCD88
packages:
- docker-ce
write_files:
- path: /etc/systemd/system/docker.service.d/override.conf
content: |
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd
- path: /etc/default/docker
content: |
DOCKER_OPTS=""
- path: /etc/docker/daemon.json
content: |
{
"dns": [ "8.8.8.8", "8.8.4.4" ],
"hosts": [ "0.0.0.0:2376", "unix:///var/run/docker.sock" ],
"tls": true,
"tlsverify": true,
"tlscacert": "/etc/docker/ca.pem",
"tlscert": "/etc/docker/server-cert.pem",
"tlskey": "/etc/docker/server-key.pem"
}
- path: /etc/docker/ca.pem
encoding: b64
content: {{ .CACert | base64 }}
- path: /etc/docker/server-cert.pem
encoding: b64
content: {{ .TLSCert | base64 }}
- path: /etc/docker/server-key.pem
encoding: b64
content: {{ .TLSKey | base64 }}
runcmd:
- [ systemctl, daemon-reload ]
- [ systemctl, restart, docker ]
You will need to provide your custom cloud-init file to the autoscale server. You can mount the file as a volume:
--volume=/path/on/host/init.yml:/path/in/container/init.yml
You will also need to tell the autoscale server where to find the file inside the container:
DRONE_AMAZON_USERDATA_FILE=/path/inside/container/init.yml