Skip to content

Instantly share code, notes, and snippets.

@devx
Created October 17, 2016 17:31
Show Gist options
  • Save devx/3b6b968274fadcf589d37c07a18e8f6d to your computer and use it in GitHub Desktop.
Save devx/3b6b968274fadcf589d37c07a18e8f6d to your computer and use it in GitHub Desktop.
#cloud-config
users:
- name: "prometheus"
system: true
primary-group: "prometheus"
groups:
- "prometheus"
- "docker"
coreos:
update:
reboot-strategy: off
units:
- name: format-ephemeral.service
command: start
content: |
[Unit]
Description=Formats the ephemeral drive
After=dev-xvdb.device
Requires=dev-xvdb.device
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/wipefs -f /dev/xvdb
ExecStart=/usr/sbin/mkfs.xfs -f /dev/xvdb
- name: mnt-prometheus.mount
command: start
content: |
[Unit]
Description=Mount ephemeral to /mnt/prometheus
Requires=format-ephemeral.service
After=format-ephemeral.service
[Mount]
What=/dev/xvdb
Where=/mnt/prometheus
Type=ext4
- name: chown-prometheus-data-dir.service
command: start
content: |
[Unit]
Description=Make prometheus user owner of prometheus data dir
After=mnt-prometheus.mount
Requires=mnt-prometheus.mount
Before=prometheus.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/chown prometheus.prometheus /mnt/prometheus
- name: prometheus.service
runtime: true
command: start
content: |
[Unit]
Description=Prometheus
After=docker.service
Requires=docker.service
[Service]
Restart=always
ExecStartPre=/usr/bin/docker pull prom/prometheus
ExecStart=/usr/bin/docker run -p 9090:9090 -v /mnt/prometheus:/prometheus --name prometheus prom/prometheus
ExecStop=/usr/bin/docker rm -f prometheus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment