Skip to content

Instantly share code, notes, and snippets.

@micahhausler
Created May 15, 2017 19:06
Show Gist options
  • Save micahhausler/81d6ccfdedc87492b21b9225af7ae0ca to your computer and use it in GitHub Desktop.
Save micahhausler/81d6ccfdedc87492b21b9225af7ae0ca to your computer and use it in GitHub Desktop.
etcd-v3-proxy
coreos:
units:
- name: etcd3-peers.service
command: start
content: |
[Unit]
Description=Write a file with the etcd peers that we should bootstrap to\n",
Requires=docker.socket
After=docker.socket
[Service]
Restart=on-failure
RestartSec=10
ExecStartPre=-/usr/bin/systemctl stop etcd-member
ExecStartPre=/usr/bin/docker pull monsantoco/etcd-aws-cluster:latest
ExecStartPre=/usr/bin/docker run \
--rm=true \
--net host \
-v /etc/sysconfig/:/etc/sysconfig/ \
-e ETCD_CLIENT_SCHEME=https \
-e ETCD_PEER_SCHEME=https \
-e PROXY_ASG=${etcd_asg_name} \
monsantoco/etcd-aws-cluster:latest
ExecStart=/usr/bin/systemctl start etcd-member.service
- name: etcd-member.service
command: stop
enable: true
drop-ins:
- name: 10-etcd-member.conf
content: |
[Service]
EnvironmentFile=/etc/sysconfig/etcd-peers
Environment="ETCD_IMAGE_TAG=v3.1.7"
Environment="ETCD_INITIAL_ADVERTISE_PEER_URLS=https://$private_ipv4:2380"
Environment="ETCD_LISTEN_PEER_URLS=https://$private_ipv4:2380"
Environment="ETCD_ADVERTISE_CLIENT_URLS=https://$private_ipv4:2379,https://127.0.0.1:2379"
Environment="ETCD_LISTEN_CLIENT_URLS=https://$private_ipv4:2379,https://127.0.0.1:2379"
Environment="ETCD_PEER_AUTO_TLS=true"
Environment="ETCD_AUTO_TLS=true"
Environment="ETCD_DATA_DIR=/opt/etcd/data"
Environment="ETCD_PROXY=on"
EnvironmentFile=/etc/sysconfig/etcd-peers
ExecStartPre=/usr/bin/mkdir -p /opt/etcd/data
ExecStartPre=/usr/bin/chown -R etcd:etcd /opt/etcd/data
ETCD_INITIAL_CLUSTER_STATE=new
ETCD_NAME=i-instance4
ETCD_INITIAL_CLUSTER="i-instance1=https://172.16.80.96:2380,i-instance2=https://172.16.48.66:2380,i-instance3=https://172.16.70.222:2380"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment