Skip to content

Instantly share code, notes, and snippets.

@jakelmg
Last active July 11, 2025 10:32
Show Gist options
  • Select an option

  • Save jakelmg/4d13abae3edf92aa5e5775516963efb7 to your computer and use it in GitHub Desktop.

Select an option

Save jakelmg/4d13abae3edf92aa5e5775516963efb7 to your computer and use it in GitHub Desktop.
LAN Cache Flatcar Butane Config Example (RAID 0 XFS, Bonded Network)
variant: flatcar
version: 1.0.0
kernel_arguments:
should_exist:
- flatcar.autologin
passwd:
users:
- name: core
ssh_authorized_keys:
- "ssh-ed25519 T0r5c5h2exdqJOsFgoimZmnNGkOwHse6CkbMcGrW8pi0vxXbkgdmcRDIepuw EXAMPLE SSH KEY"
storage:
disks:
- device: "/dev/disk/by-id/nvme-KIOXIA_KCMYXRUG15T3_<SERIAL1>"
wipe_table: true
partitions:
- label: "LC-STRIPE-0"
- device: "/dev/disk/by-id/nvme-KIOXIA_KCMYXRUG15T3_<SERIAL2>"
wipe_table: true
partitions:
- label: "LC-STRIPE-1"
- device: "/dev/disk/by-id/nvme-KIOXIA_KCMYXRUG15T3_<SERIAL3>"
wipe_table: true
partitions:
- label: "LC-STRIPE-2"
- device: "/dev/disk/by-id/nvme-KIOXIA_KCMYXRUG15T3_<SERIAL4>"
wipe_table: true
partitions:
- label: "LC-STRIPE-3"
raid:
- name: "lancache"
level: "raid0"
devices:
- "/dev/disk/by-id/nvme-KIOXIA_KCMYXRUG15T3_<SERIAL1>-part1"
- "/dev/disk/by-id/nvme-KIOXIA_KCMYXRUG15T3_<SERIAL2>-part1"
- "/dev/disk/by-id/nvme-KIOXIA_KCMYXRUG15T3_<SERIAL3>-part1"
- "/dev/disk/by-id/nvme-KIOXIA_KCMYXRUG15T3_<SERIAL4>-part1"
options:
- "--chunk=128"
filesystems:
- device: "/dev/md/lancache"
path: "/mnt/lancache"
format: "xfs"
label: "lancache"
wipe_filesystem: true
files:
- path: /etc/hostname
mode: 0644
contents:
inline: lancache
- path: /etc/flatcar/update.conf
overwrite: true
contents:
inline: |
REBOOT_STRATEGY=reboot
LOCKSMITHD_REBOOT_WINDOW_START=06:00
LOCKSMITHD_REBOOT_WINDOW_LENGTH=1h
mode: 0420
- path: /etc/systemd/network/10-add-enp1s0fxxxx-to-bond.network
contents:
inline: |
[Match]
Name=enp1s0f*
[Network]
Bond=bond0
- path: /etc/systemd/network/20-bond0.netdev
contents:
inline: |
[NetDev]
Name=bond0
Kind=bond
[Bond]
Mode=802.3ad
MIIMonitorSec=1s
LACPTransmitRate=fast
TransmitHashPolicy=layer3+4
- path: /etc/systemd/network/20-bond0.network
contents:
inline: |
[Match]
Name=bond0
[Network]
BindCarrier=enp1s0f*
DNS=1.1.1.1
Address=10.0.0.20/22
Gateway=10.0.0.1
[Address]
Address=10.0.0.21/22
[Address]
Address=10.0.0.22/22
[Address]
Address=10.0.0.23/22
links:
- path: /etc/localtime
overwrite: true
target: /usr/share/zoneinfo/America/Vancouver
systemd:
units:
- name: mnt-lancache.mount
enabled: true
contents: |
[Unit]
Description=Mount LANCache Linux RAID0 Array XFS
[Mount]
What=/dev/md/lancache
Where=/mnt/lancache
Type=xfs
Options=rw,noatime
[Install]
WantedBy=local-fs.target
- name: lancache-dns.service
enabled: true
contents: |
[Unit]
Description=LANCache-DNS Docker Container
After=docker.service
Requires=docker.service
[Service]
ExecStart=/usr/bin/docker run \
--name lancache-dns \
--rm \
--publish 10.0.0.20:53:53/udp \
--publish 10.0.0.20:53:53/tcp \
-e USE_GENERIC_CACHE=true \
-e LANCACHE_IP="10.0.0.20 10.0.0.21 10.0.0.22 10.0.0.23" \
-e DNS_BIND_IP=10.0.0.20 \
-e UPSTREAM_DNS="1.1.1.1 8.8.8.8" \
--label com.centurylinklabs.watchtower.enable=true \
lancachenet/lancache-dns:latest
ExecStop=/usr/bin/docker stop lancache-dns
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
- name: lancache-monolithic.service
enabled: true
contents: |
[Unit]
Description=LANCache-Monolithic Docker Container
After=docker.service
Requires=docker.service
[Service]
ExecStart=/usr/bin/docker run \
--name lancache-monolithic \
--rm \
--network host \
--label com.centurylinklabs.watchtower.enable=true \
-v /mnt/lancache/cache:/data/cache \
-v /mnt/lancache/logs:/data/logs \
-e CACHE_DISK_SIZE=40000g \
-e MIN_FREE_DISK=1000g \
-e CACHE_INDEX_SIZE=12500m \
-e CACHE_MAX_AGE=1095d \
-e TZ=America/Vancouver \
-e UPSTREAM_DNS="1.1.1.1 8.8.8.8" \
lancachenet/monolithic:latest
ExecStop=/usr/bin/docker stop lancache-monolithic
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
- name: watchtower.service
enabled: true
contents: |
[Unit]
Description=Watchtower Docker Container Auto-Updater
After=docker.service
Requires=docker.service
[Service]
ExecStart=/usr/bin/docker run \
--name watchtower \
--rm \
--label com.centurylinklabs.watchtower.enable=true \
-e WATCHTOWER_LABEL_ENABLE=true \
-e WATCHTOWER_CLEANUP=true \
-e WATCHTOWER_NO_RESTART=true \
-v /var/run/docker.sock:/var/run/docker.sock \
ghcr.io/containrrr/watchtower:latest
ExecStop=/usr/bin/docker stop watchtower
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment