Skip to content

Instantly share code, notes, and snippets.

@scrivy
Last active January 3, 2024 07:38
Show Gist options
  • Save scrivy/633580d80523d184ca440ab44663a55c to your computer and use it in GitHub Desktop.
Save scrivy/633580d80523d184ca440ab44663a55c to your computer and use it in GitHub Desktop.
Nightscout butane configuration for Fedora CoreOS with IFTTT and Dexcom modules enabled
#!/bin/bash
IGNITION_CONFIG="/srv/coreos/nightscout.ign"
IMAGE="/srv/coreos/fedora-coreos-38.qcow2"
VM_NAME="nightscout"
VCPUS="4"
RAM_MB="4000"
STREAM="stable"
DISK_GB="12"
virt-install --connect="qemu:///system" --name="${VM_NAME}" --vcpus="${VCPUS}" --memory="${RAM_MB}" \
--os-variant="fedora-coreos-$STREAM" --import --graphics=none --autostart \
--disk="size=${DISK_GB},backing_store=${IMAGE}" \
--disk=/dev/mapper/CHANGEME \
--network bridge=virbr0 \
--qemu-commandline="-fw_cfg name=opt/com.coreos/config,file=${IGNITION_CONFIG}"
{
"settings":{},
"extendedSettings":{
"maker": {
"key": "CHANGEME"
}
}
}
variant: fcos
version: 1.5.0
passwd:
users:
- name: core
ssh_authorized_keys:
- ssh-rsa CHANGEME
storage:
files:
- path: /etc/containers/systemd/mongodb.container
contents:
inline: |
[Unit]
Description=mongo
After=network-online.target
Wants=network-online.target
[Container]
Image=docker.io/mongo:4
Network=host
Volume=mongodb:/data/db
[Install]
WantedBy=multi-user.target
- path: /etc/containers/systemd/mongo-express.container
contents:
inline: |
[Unit]
Description=mongo-express
After=network-online.target mongodb.service
Wants=network-online.target
[Container]
Image=docker.io/mongo-express:latest
Environment=ME_CONFIG_MONGODB_URL=mongodb://localhost:27017/
Network=host
[Install]
WantedBy=multi-user.target
- path: /etc/containers/systemd/file-server.container
contents:
inline: |
[Unit]
Description=static file server
After=network-online.target
Wants=network-online.target
[Container]
Image=docker.io/halverneus/static-file-server
Network=host
Volume=/var/srv/httpFileServer:/web:z
Environment=PORT=5007
Environment=FOLDER=/web
[Install]
WantedBy=multi-user.target
- path: /etc/containers/systemd/nightscout.container
contents:
inline: |
[Unit]
Description=nightscout
After=network-online.target mongodb.service file-server.service
Wants=network-online.target
[Container]
Image=docker.io/nightscout/cgm-remote-monitor:latest
Environment=TZ=America/Los_Angeles
Environment=INSECURE_USE_HTTP=true
Environment=SECURE_HSTS_HEADER=false
Environment=HOSTNAME=0.0.0.0
Environment=MONGO_CONNECTION=mongodb://localhost:27017/nightscout
Environment=API_SECRET=CHANGEME
Environment=AUTH_DEFAULT_ROLES=readable
Environment=DISPLAY_UNITS=mg/dl
Environment=ENABLE=bridge maker
Environment=BRIDGE_USER_NAME=CHANGEME
Environment=BRIDGE_PASSWORD=CHANGEME
Environment=IMPORT_CONFIG=http://127.0.0.1:5007/nightscout-settings.json
Network=host
[Install]
WantedBy=multi-user.target
filesystems:
- path: /var/srv
device: /dev/disk/by-uuid/CHANGEME
format: xfs
with_mount_unit: true
systemd:
units:
- name: podman-prune.service
enabled: true
contents: |
[Unit]
Description=podman prune
After=network-online.target
Wants=network-online.target
[Service]
Type=oneshot
ExecStartPre=/usr/bin/sleep 30m
ExecStart=/bin/podman system prune -af
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment