Skip to content

Instantly share code, notes, and snippets.

@wbrown-lg
Created June 18, 2018 19:49
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 wbrown-lg/810c7802f59ab06858f00b20d02e387f to your computer and use it in GitHub Desktop.
Save wbrown-lg/810c7802f59ab06858f00b20d02e387f to your computer and use it in GitHub Desktop.
Matchbox template file for DC/OS and ZFS install
---
systemd:
units:
- name: lg-zfs-installer.service
enable: true
contents: |
[Unit]
Requires=network-online.target
After=network-online.target
[Service]
Type=oneshot
ExecStart=/opt/lg-zfs-installer
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
- name: lg-dcos-installer.service
enable: true
contents: |
[Unit]
Requires=lg-zfs-installer.service
After=lg-zfs-installer.service
[Service]
Type=oneshot
ExecStart=/opt/lg-dcos-installer
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
- name: nfs-tpx.mount
enable: true
contents: |
[Unit]
Before=remote-fs.target
[Mount]
What=nas01.is.lgscout.com:/LGData
Where=/nfs/tpx
Type=nfs
[Install]
WantedBy=remote-fs.target
- name: nfs-archive.mount
enable: true
contents: |
[Unit]
Before=remote-fs.target
[Mount]
What=nas03.is.lgscout.com:/data/spark
Where=/nfs/archive
Type=nfs
[Install]
WantedBy=remote-fs.target
storage:
filesystems:
disks:
files:
- path: /etc/modprobe.d/zfs.conf
filesystem: root
mode: 0644
contents:
inline: |
# Flush out our disk write transactions every 30s.
options zfs zfs_txg_timeout=30
# log2 fraction of ARC to reclain
options zfs zfs_arc_shrink_shift=4
# Disable ZFS prefetch on all systems.
options zfs zfs_prefetch_disable=1
# Don't immediately write less than 1MB to the pool.
options zfs zfs_immediate_write_sz=2097152
# Set the maximum ZIL TXG to 1GB
options zfs zil_slog_limit=1073741824
# Tune the minimum dirty pages before we start flushing to a TXG. The default
# threshold of 64MB is too low, as we are often rewriting pages right after
# we flush to disk. This has been observed to dramatically reduce the amount
# of I/O due to effective write coalescing.
options zfs zfs_dirty_data_sync=2147483648
# Increase the minimum disk queue sizes, which allows for higher throughput.
# We are more throughput sensiitive on our spinning medium than we are latency
# sensitive due to the amount of SSD and RAM cache we have.
options zfs zfs_vdev_async_write_min_active=4
options zfs zfs_vdev_async_read_min_active=4
# 10 seconds betweeen attempts to grow the ZFS ARC cache
options zfs zfs_arc_grow_retry=3
# Fill the cache way faster, as on the bigger nodes, we have high
# write endurance SSDs.
options zfs l2arc_headroom=4
# Allow 64MB/sec to be written to the L2ARC cache
options zfs l2arc_write_max=67108864
# After boot, allow +64MB/sec to be written to the L2ARC cache
options zfs l2arc_write_boost=67108864
- path: /opt/lg-dcos-installer
filesystem: root
mode: 0500
contents:
inline: |
#!/bin/bash -ex
if [[ ! -z "{{.install_dcos}}" ]] || [ "{{.install_dcos}}" = true ];
then
mkdir /tmp/dcos || true
cd /tmp/dcos
curl --retry 10 --fail "http://${matchbox_url}/assets/dcos/dcos_install.sh" -o dcos_install.sh
bash ./dcos_install.sh {{.dcos_role}}
cd /
rm -rf /tmp/dcos
fi
systemctl disable lg-dcos-installer
- path: /opt/lg-zfs-installer
filesystem: root
mode: 0500
contents:
inline: |
#!/bin/bash -ex
mkdir -p /opt/corezfs || true
curl --retry 10 --fail "http://${matchbox_url}/assets/corezfs/corezfs" -o /opt/corezfs/corezfs
curl --retry 10 --fail "http://${matchbox_url}/assets/corezfs/corezfs_amd64-usr_${coreos_version}_${coreos_channel}.tar.gz" -o "/opt/corezfs/corezfs_amd64-usr_${coreos_version}_${coreos_channel}.tar.gz"
bash /opt/corezfs/corezfs install "/opt/corezfs/corezfs_amd64-usr_${coreos_version}_${coreos_channel}.tar.gz"
if [[ ! -z "{{.provision_zpool}}" ]] || [ "{{.provision_zpool}}" = true ];
then
zpool destroy -f {{.zpool_name}} || true
zpool create -f {{.zpool_name}} {{.zpool_vdevs}} {{.zpool_cache}} {{.zpool_log}}
zfs set compression=lz4 {{.zpool_name}}
zfs create -o mountpoint=/var/lib/mesos {{.zpool_name}}/mesos
zfs create -o mountpoint=/var/lib/docker {{.zpool_name}}/docker
zfs create -o mountpoint=/var/lib/dcos {{.zpool_name}}/dcos
# homedir
mv /home /home.old
zfs create -o mountpoint=/home {{.zpool_name}}/home || true
zfs mount -O {{.zpool_name}}/home || true
mv /home.old/* /home
rm -rf /home.old
# logs
systemctl stop systemd-journald || true
mv /var/log /var/log.old
zfs create -o mountpoint=/var/log {{.zpool_name}}/var-log || true
zfs mount -O {{.zpool_name}}/var-log || true
mv /var/log.old/* /var/log
rm -rf /var/log.old
systemctl start systemd-journald
fi
systemctl disable lg-zfs-installer
- path: /etc/datadog/conf.d/datadog.yaml
filesystem: root
mode: 755
contents:
inline: |
#logs_enabled:true
- path: /etc/datadog/conf.d/haproxy.yaml
filesystem: root
mode: 755
contents:
inline: |
init_config:
instances:
- url: https://localhost:9090/haproxy?stats
networkd:
units:
- name: 00-disabled.network
contents: |
[Match]
Name=eth1 eno2 enp132s0f1np1
[Network]
DHCP=no
LinkLocalAddressing=no
IPv6AcceptRA=no
- name: 01-primary.network
contents: |
[Match]
Name=eth0 eno1 enp132s0f0np0
[Network]
DHCP=ipv4
Domains=dev.lgscout.com
LinkLocalAddressing=no
IPv6AcceptRA=no
[DHCP]
UseDomains=yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment