Created
January 31, 2016 18:45
-
-
Save cescoferraro/60a984e3f3df11b4da1d 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 | |
coreos: | |
etcd2: | |
# generate a new token for each unique cluster from https://discovery.etcd.io/new: | |
discovery: https://discovery.etcd.io/XXXXX | |
# multi-region deployments, multi-cloud deployments, and Droplets without | |
# private networking need to use $public_ipv4: | |
advertise-client-urls: http://$private_ipv4:2379,http://$private_ipv4:4001 | |
initial-advertise-peer-urls: http://$private_ipv4:2380 | |
# listen on the official ports 2379, 2380 and one legacy port 4001: | |
listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001 | |
listen-peer-urls: http://$private_ipv4:2380 | |
fleet: | |
public-ip: $private_ipv4 # used for fleetctl ssh command | |
units: | |
- name: systemd-sysctl.service | |
command: restart | |
- name: etcd2.service | |
command: restart | |
- name: fleet.service | |
command: restart | |
- name: create-swap.service | |
command: start | |
runtime: true | |
content: | | |
[Unit] | |
Description=Create swap file | |
Before=swap.service | |
[Service] | |
Type=oneshot | |
Environment="SWAPFILE=/4GiB.swap" | |
ExecStart=/usr/bin/touch ${SWAPFILE} | |
ExecStart=/usr/bin/chattr +C ${SWAPFILE} | |
ExecStart=/usr/bin/fallocate -l 4096m ${SWAPFILE} | |
ExecStart=/usr/bin/chmod 600 ${SWAPFILE} | |
ExecStart=/usr/sbin/mkswap ${SWAPFILE} | |
[Install] | |
WantedBy=multi-user.target | |
- name: swap.service | |
command: start | |
content: | | |
[Unit] | |
Description=Turn on swap | |
[Service] | |
Type=oneshot | |
Environment="SWAPFILE=/4GiB.swap" | |
RemainAfterExit=true | |
ExecStartPre=/usr/sbin/losetup -f ${SWAPFILE} | |
ExecStart=/usr/bin/sh -c "/sbin/swapon $(/usr/sbin/losetup -j ${SWAPFILE} | /usr/bin/cut -d : -f 1)" | |
ExecStop=/usr/bin/sh -c "/sbin/swapoff $(/usr/sbin/losetup -j ${SWAPFILE} | /usr/bin/cut -d : -f 1)" | |
ExecStopPost=/usr/bin/sh -c "/usr/sbin/losetup -d $(/usr/sbin/losetup -j ${SWAPFILE} | /usr/bin/cut -d : -f 1)" | |
[Install] | |
WantedBy=multi-user.target | |
write_files: | |
- path: /etc/sysctl.d/swap.conf | |
permissions: 0644 | |
owner: root | |
content: | | |
vm.swappiness=10 | |
vm.vfs_cache_pressure=50 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment