Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@hoshinotsuyoshi
Last active October 8, 2015 22:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hoshinotsuyoshi/dce5e957aa9ebfec816c to your computer and use it in GitHub Desktop.
Save hoshinotsuyoshi/dce5e957aa9ebfec816c to your computer and use it in GitHub Desktop.
#cloud-config
coreos:
etcd2:
# https://discovery.etcd.io/new?size=3
discovery: https://discovery.etcd.io/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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
units:
- name: timezone.service
command: start
content: |
[Unit]
Description=timezone
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/ln -sf ../usr/share/zoneinfo/Japan /etc/localtime
- name: docker-tcp.socket
command: start
enable: true
content: |
[Unit]
Description=Docker Socket for the API
[Socket]
ListenStream=2375
BindIPv6Only=both
Service=docker.service
[Install]
WantedBy=sockets.target
- name: docker-pull-redis.service
command: start
content: |
[Unit]
Description=docker pull redis
After=docker.service
Requires=docker.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/docker pull redis
- name: swarm-join.service
command: start
content: |
[Unit]
Description=swarm-join Container
After=docker.service
Requires=docker.service
[Service]
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker stop swarm-join
ExecStartPre=-/usr/bin/docker rm swarm-join
ExecStartPre=-/usr/bin/docker pull swarm
ExecStart=/usr/bin/docker run --name=swarm-join swarm join --advertise=$private_ipv4:2375 etcd://$private_ipv4:2379/swarm
[Install]
WantedBy=multi-user.target
- name: swarm-manage.service
command: start
content: |
[Unit]
Description=swarm-manage Container
After=docker.service
Requires=docker.service
[Service]
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker stop swarm-manage
ExecStartPre=-/usr/bin/docker rm swarm-manage
ExecStartPre=-/usr/bin/docker pull swarm
ExecStart=/usr/bin/docker run --net=host --name=swarm-manage swarm manage -H :4000 --replication --strategy=binpack --advertise $private_ipv4:4000 etcd://$private_ipv4:2379/swarm
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment