aboutsummaryrefslogtreecommitdiffstats
path: root/ranch_prometheus_example.sh
blob: a85a8a2636a064a166c15025ff85bf01852742d1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env sh

set -e
#set -x

NAME=$1
DIST=archlinux
RELEASE=current
ARCH=amd64
PACKAGES="cronie git sudo erlang-nox make"

for f in ci.d/*; do source "$f"; done

lxc_destroy
lxc_create $DIST $RELEASE $ARCH
lxc_wait_for_ip
pacman_upgrade
pacman_install $PACKAGES
archlinux_enable_cron

lxc_do mkdir -p /home/ninenines
lxc_do git clone https://github.com/juhlig/prometheus_ranch_example /home/ninenines/prometheus_ranch_example
lxc_do make -C /home/ninenines/prometheus_ranch_example clean
lxc_do make -C /home/ninenines/prometheus_ranch_example

lxc_do sh -c 'echo "@reboot /home/ninenines/prometheus_ranch_example/_rel/prometheus_ranch_example_release/bin/prometheus_ranch_example_release start" >> tmpcron'
lxc_do sh -c 'crontab tmpcron'
lxc_do sh -c 'rm tmpcron'

lxc_restart

lxc_do /usr/bin/env sh -c "until curl http://localhost:8080/metrics ; do sleep 1 ; done"