Skip to content

Instantly share code, notes, and snippets.

@peripau
Last active January 26, 2019 22:48
Show Gist options
  • Save peripau/3c346f4c0dbcd79b48b7 to your computer and use it in GitHub Desktop.
Save peripau/3c346f4c0dbcd79b48b7 to your computer and use it in GitHub Desktop.
Zookeeper and Kafka cloud-init script
#cloud-config
coreos:
etcd2:
discovery: https://discovery.etcd.io/8085f8fcb83c12f27593b23069533e98
advertise-client-urls: http://$private_ipv4:2379
initial-advertise-peer-urls: http://$private_ipv4:2380
listen-client-urls: http://0.0.0.0:2379
listen-peer-urls: http://$private_ipv4:2380
units:
- name: etcd2.service
command: start
- name: fleet.service
command: start
- name: pktzoo-01.service
command: start
content: |
[Unit]
Description=Packet Zookeeper 1
After=docker.service
Requires=docker.service
[Service]
Type=Simple
TimeoutStartSec=0
EnvironmentFile=/etc/environment
ExecStartPre=-/usr/bin/docker kill pktzoo-01
ExecStartPre=-/usr/bin/docker rm pktzoo-01
ExecStartPre=/usr/bin/docker pull mbabineau/zookeeper-exhibitor
ExecStart=/usr/bin/docker run --name pktzoo-01 -p 8181:8181 -p 2181:2181 -p 2888:2888 -p 3888:3888 -e HOSTNAME=pktzoo-01 mbabineau/zookeeper-exhibitor
ExecStop=/usr/bin/docker stop pktzoo-01
- name: pktkafka-01.service
command: start
content: |
[Unit]
Description=Packet Kafka 1
After=docker.service pktzoo-01.service
Requires=docker.service pktzoo-01.service
[Service]
Type=Simple
TimeoutStartSec=0
EnvironmentFile=/etc/environment
ExecStartPre=-/usr/bin/docker kill pktkafka-01
ExecStartPre=-/usr/bin/docker rm pktkafka-01
ExecStartPre=/usr/bin/docker pull wurstmeister/kafka
ExecStart=/usr/bin/docker run --name pktkafka-01 -p 6667:6667 --link pktzoo-01:pktzoo-01 -e KAFKA_ADVERTISED_PORT=6667 -e KAFKA_ZOOKEEPER_CONNECT=pktzoo-01:2181 -e KAFKA_BROKER_ID=100 wurstmeister/kafka
ExecStop=/usr/bin/docker stop pktkafka-01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment