This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cloud-config | |
ssh_authorized_keys: | |
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQAB ...snip... QAyapHGwoBvkq7nNp | |
coreos: | |
etcd: | |
# via https://discovery.etcd.io/new | |
discovery: https://discovery.etcd.io/7028e012ca66ef0121b64c19c40a425a | |
addr: $private_ipv4:4001 | |
peer-addr: $private_ipv4:7001 | |
write_files: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cloud-config | |
ssh_authorized_keys: | |
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQAB ...snip... QAyapHGwoBvkq7nNp | |
coreos: | |
etcd: | |
# via https://discovery.etcd.io/new | |
discovery: https://discovery.etcd.io/7028e012ca66ef0121b64c19c40a425a | |
addr: $private_ipv4:4001 | |
peer-addr: $private_ipv4:7001 | |
units: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cloud-config | |
ssh_authorized_keys: | |
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQAB ...snip... QAyapHGwoBvkq7nNp | |
coreos: | |
etcd: | |
# via https://discovery.etcd.io/new | |
discovery: https://discovery.etcd.io/7028e012ca66ef0121b64c19c40a425a | |
addr: $private_ipv4:4001 | |
peer-addr: $private_ipv4:7001 | |
units: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cloud-config | |
ssh_authorized_keys: | |
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQAB ...snip... QAyapHGwoBvkq7nNp | |
coreos: | |
etcd: | |
# via https://discovery.etcd.io/new | |
discovery: https://discovery.etcd.io/7028e012ca66ef0121b64c19c40a425a | |
addr: $private_ipv4:4001 | |
peer-addr: $private_ipv4:7001 | |
units: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
etcd_sync_check(){ | |
count=0; | |
while ( true ); do | |
check=$(etcdctl ls / | grep 'Cannot sync' | wc -l) ; | |
if [ $check -eq 0 ]; then | |
break ; | |
else | |
warning "Cannot connect to etcd" | |
if [ $count -gt 50 ]; then | |
fatal "Failed to connect to etcd" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker pull registry:latest && docker run --rm --name registry -p 5000:5000 registry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Docker registry | |
After=etcd.service | |
After=docker.service | |
[Service] | |
ExecStop=/usr/bin/bash -l -c "docker stop registry ;" | |
ExecStart=/usr/bin/bash -l -c "docker pull registry:latest ; docker run --rm --name registry -p 5000:5000 registry ;" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Example website | |
After=etcd.service | |
After=docker.service | |
[Service] | |
ExecStop=/usr/bin/bash -l -c "docker stop $image_name ;" | |
ExecStart=/usr/bin/bash -l -c "docker pull $registry_ip:5000/$image_name ; docker run --rm --name $container_name -p 80:80 -i $image_name /bin/bash -l -c "service nginx start";" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Example website | |
After=etcd.service | |
After=docker.service | |
[Service] | |
ExecStop=/usr/bin/bash -l -c "docker stop $image_name ;" | |
ExecStart=/usr/bin/bash -l -c "docker pull $registry_ip:5000/$image_name ; docker run --rm --name $container_name -p 80 -i $image_name /bin/bash -l -c "service nginx start";" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# $1 = service name | |
# $2 = service internal port | |
getServiceIPAndPort(){ | |
local id=$(docker ps -a | grep "\( ${1}\)" | awk '{ print $1 }') | |
local port=$(docker port $id $2 | sed -r 's#0.0.0.0:##gi') | |
if [[ -z $port ]]; then | |
sleep 5 | |
getServiceIPAndPort "${1}" "${2}" | |
fi | |
echo "${COREOS_PRIVATE_IPV4}:${port}" |
OlderNewer