Last active
September 29, 2016 20:57
-
-
Save hackzilla/709bdfaf3dfa988bcae8 to your computer and use it in GitHub Desktop.
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 | |
hostname: {{ name }} | |
write_files: | |
- path: /etc/environment | |
permissions: 0644 | |
content: | | |
COREOS_PUBLIC_IPV4={{ public_ip }} | |
COREOS_PRIVATE_IPV4={{ private_ip }} | |
coreos: | |
etcd: | |
name: {{ name }} | |
#generate a new token for each unique cluster from https://discovery.etcd.io/new | |
discovery: https://discovery.etcd.io/{{ token }} | |
addr: {{ public_ip }}:4001 | |
peer-addr: {{ private_ip }}:7001 | |
peer-election-timeout: 500 | |
peer-heartbeat-interval: 100 | |
update: | |
group: {{ update_channel }} | |
reboot-strategy: best-effort | |
units: | |
- name: etcd.service | |
command: start | |
- name: fleet.service | |
command: start | |
enable: true | |
content: | | |
[Unit] | |
Description=fleet | |
[Service] | |
Environment="FLEET_PUBLIC_IP={{ public_ip }}" | |
ExecStart=/usr/bin/fleet | |
- name: docker-tcp.socket | |
command: start | |
enable: true | |
content: | | |
[Unit] | |
Description=Docker Socket for the API | |
[Socket] | |
ListenStream=2375 | |
Service=docker.service | |
BindIPv6Only=both | |
[Install] | |
WantedBy=sockets.target | |
{% for i in 1..2 %} | |
- name: project.backend.{{ i }}.service | |
command: start | |
content: | | |
[Unit] | |
Description=Project backend | |
After=docker.service | |
Requires=docker.service | |
[Service] | |
Environment="FLEET_PUBLIC_IP={{ public_ip }}" | |
TimeoutStartSec=0 | |
ExecStartPre=-/usr/bin/docker kill project | |
ExecStartPre=-/usr/bin/docker rm project | |
ExecStartPre=/usr/bin/docker pull hackzilla/project:latest | |
ExecStart=/usr/bin/docker run --rm --name project -p 81:80 -p 2221:22 -e PROJECT_PASSWORD=letmein hackzilla/project:latest | |
ExecStop=/usr/bin/docker stop project | |
[X-Fleet] | |
X-Conflicts=project.backend.*.service | |
- name: project-discovery.backend.{{ i }}.service | |
command: start | |
content: | | |
[Unit] | |
Description=Announce Project backend | |
BindTo=project.backend.{{ i }}.service | |
[Service] | |
Environment="FLEET_PUBLIC_IP={{ public_ip }}" | |
ExecStart=/bin/sh -c "while true; do etcdctl set /varnish/backends/project/%H:81 '{ \"host\": \"%H\", \"port\": 81, \"version\": \"ooh\" }' --ttl 60;sleep 45;done" | |
ExecStop=/usr/bin/etcdctl rm /varnish/project/kohana/%H:81 | |
[X-Fleet] | |
X-ConditionMachineOf=project.backend.{{ i }}.service | |
{% endfor %} | |
ssh_authorized_keys: | |
- ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key | |
- ssh-rsa AAAAB... [email protected] | |
users: | |
- name: hackzilla | |
passwd: $6$WQ74... | |
groups: | |
- sudo | |
- docker | |
- wheel | |
- portage | |
- core | |
ssh-authorized-keys: | |
- ssh-rsa AAAAB... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment