aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2020-06-25 14:41:42 +0200
committerLoïc Hoguin <[email protected]>2020-06-25 14:42:25 +0200
commitaa59e12e8a0242dd326ccb022ddd4fd14af28969 (patch)
tree686e9a71734bde3fc215bc2430f6de0579f0dccb
parent25c7489370f2c6758a6bc18386587c1c409c2496 (diff)
downloadci-aa59e12e8a0242dd326ccb022ddd4fd14af28969.tar.gz
ci-aa59e12e8a0242dd326ccb022ddd4fd14af28969.tar.bz2
ci-aa59e12e8a0242dd326ccb022ddd4fd14af28969.zip
Add prometheus_ranch to the prometheus environment
And remove the other environment. Too complicated to use two separate environments.
-rwxr-xr-xprometheus.sh28
-rwxr-xr-xranch_prometheus_example.sh32
2 files changed, 27 insertions, 33 deletions
diff --git a/prometheus.sh b/prometheus.sh
index 72974e9..23877dc 100755
--- a/prometheus.sh
+++ b/prometheus.sh
@@ -7,10 +7,15 @@ NAME=$1
DIST=archlinux
RELEASE=current
ARCH=amd64
-PACKAGES="git sudo base-devel grafana"
+PACKAGES="git sudo base-devel grafana \
+ cronie erlang-nox make"
for f in ci.d/*; do source "$f"; done
+# This or that may be required to keep the static IP:
+kill $(cat /var/run/lxc/dnsmasq.pid)
+systemctl restart lxc-net
+
lxc_destroy
lxc_create $DIST $RELEASE $ARCH
lxc_wait_for_ip
@@ -22,11 +27,14 @@ sleep 5
pacman_upgrade
pacman_install $PACKAGES
+archlinux_enable_cron
echo "[auth.anonymous]" >> /etc/grafana.ini
echo "enabled = true" >> /etc/grafana.ini
echo "org_role = Admin" >> /etc/grafana.ini
+lxc_do grafana-cli plugins install flant-statusmap-panel
+
lxc_do git clone https://aur.archlinux.org/prometheus-bin.git /tmp/prometheus-bin
lxc_do chown -R nobody:nobody /tmp/prometheus-bin
lxc_do sudo -u nobody bash -c 'cd /tmp/prometheus-bin && makepkg'
@@ -39,11 +47,29 @@ lxc_do bash -c "printf \"%s\n\" \
\" static_configs:\" \
\" - targets: ['localhost:3000']\" >> /etc/prometheus/prometheus.yml"
+lxc_do bash -c "printf \"%s\n\" \
+ \"\" \
+ \" - job_name: 'ranch_prometheus_example'\" \
+ \"\" \
+ \" static_configs:\" \
+ \" - targets: ['localhost:8080']\" >> /etc/prometheus/prometheus.yml"
+
lxc_do systemctl enable grafana
lxc_do systemctl enable prometheus
+lxc_do mkdir -p /home/ninenines
+lxc_do git clone https://github.com/juhlig/prometheus_ranch_example /home/ninennes/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"
+
lxc_do /usr/bin/env sh -c "until curl http://admin:admin@localhost:3000/api/org ; do sleep 1 ; done"
echo
diff --git a/ranch_prometheus_example.sh b/ranch_prometheus_example.sh
deleted file mode 100755
index a85a8a2..0000000
--- a/ranch_prometheus_example.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/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"