Skip to content

Instantly share code, notes, and snippets.

@carmstrong
Last active August 29, 2015 14:13
Show Gist options
  • Save carmstrong/c5c4d60c59fbf1558d77 to your computer and use it in GitHub Desktop.
Save carmstrong/c5c4d60c59fbf1558d77 to your computer and use it in GitHub Desktop.
etcd 2.0rc1 on CoreOS
diff --git a/contrib/coreos/user-data.example b/contrib/coreos/user-data.example
index 6c37afc..12308f8 100644
--- a/contrib/coreos/user-data.example
+++ b/contrib/coreos/user-data.example
@@ -5,12 +5,10 @@ coreos:
# generate a new token for each unique cluster from https://discovery.etcd.io/new
# uncomment the following line and replace it with your discovery URL
# discovery: https://discovery.etcd.io/12345693838asdfasfadf13939923
- addr: $private_ipv4:4001
- peer-addr: $private_ipv4:7001
- # give etcd more time if it's under heavy load - prevent leader election thrashing
- peer-election-timeout: 2000
- # heartbeat interval should ideally be 1/4 or 1/5 of peer election timeout
- peer-heartbeat-interval: 500
+ listen-peer-urls: "http://$private_ipv4:2380,http://$private_ipv4:7001"
+ listen-client-urls: "http://localhost:2379,http://localhost:4001,http://$private_ipv4:2379,http://$private_ipv4:4001"
+ advertise-client-urls: "http://$private_ipv4:2379,http://$private_ipv4:4001"
+ initial-advertise-peer-urls: "http://$private_ipv4:2380,http://$private_ipv4:7001"
fleet:
# We have to set the public_ip here so this works on Vagrant -- otherwise, Vagrant VMs
# will all publish the same private IP. This is harmless for cloud providers.
@@ -20,6 +18,18 @@ coreos:
units:
- name: etcd.service
command: start
+ content: |
+ [Unit]
+ Description=etcd
+
+ [Service]
+ User=etcd
+ PermissionsStartOnly=true
+ Environment=ETCD_DATA_DIR=/var/lib/etcd
+ Environment=ETCD_NAME=%m
+ ExecStart=/run/etcd-v2.0.0-rc.1-linux-amd64/etcd
+ Restart=always
+ RestartSec=10s
- name: fleet.service
command: start
- name: stop-update-engine.service
@@ -65,6 +75,18 @@ coreos:
ExecStartPre=/usr/bin/curl -sSL -o /opt/bin/jq http://stedolan.github.io/jq/download/linux64/jq
ExecStartPre=/usr/bin/chmod +x /opt/bin/jq
ExecStart=/usr/bin/bash -c "while true; do curl -sL http://127.0.0.1:4001/v2/stats/leader | /opt/bin/jq . ; sleep 1 ; done"
+ - name: install-etcd-2rc1.service
+ command: start
+ content: |
+ [Unit]
+ Description=install etcd 2.0 rc1
+ ConditionPathExists=!/run/etcd-v2.0.0-rc.1-linux-amd64/etcd
+ Before=etcd.service
+
+ [Service]
+ Type=oneshot
+ ExecStart=/usr/bin/bash -c "curl -sL https://github.com/coreos/etcd/releases/download/v2.0.0-rc.1/etcd-v2.0.0-rc.1-linux-amd64.tar.gz | tar xzf - -C /run"
+ ExecStart=/bin/chown -R etcd:etcd /run/etcd-v2.0.0-rc.1-linux-amd64/
write_files:
- path: /etc/deis-release
content: |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment