From 1f1db0f8694bf51257f43954ef70571f20cc7891 Mon Sep 17 00:00:00 2001 From: Keith Whyte Date: Thu, 1 Mar 2018 17:57:15 +0000 Subject: [PATCH] Add Meas-Web Installation --- .../rhizo_base/files/etc/sv/meas-web/log/run | 4 ++++ modules/rhizo_base/files/etc/sv/meas-web/run | 3 +++ modules/rhizo_base/manifests/init.pp | 22 ++++++++++++++++++- 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100755 modules/rhizo_base/files/etc/sv/meas-web/log/run create mode 100755 modules/rhizo_base/files/etc/sv/meas-web/run diff --git a/modules/rhizo_base/files/etc/sv/meas-web/log/run b/modules/rhizo_base/files/etc/sv/meas-web/log/run new file mode 100755 index 0000000..a73b536 --- /dev/null +++ b/modules/rhizo_base/files/etc/sv/meas-web/log/run @@ -0,0 +1,4 @@ +#!/bin/sh +LOG_FOLDER=/var/log/meas-web +mkdir -p $LOG_FOLDER +exec svlogd -tt $LOG_FOLDER diff --git a/modules/rhizo_base/files/etc/sv/meas-web/run b/modules/rhizo_base/files/etc/sv/meas-web/run new file mode 100755 index 0000000..f3c4b7d --- /dev/null +++ b/modules/rhizo_base/files/etc/sv/meas-web/run @@ -0,0 +1,3 @@ +#!/bin/sh +exec 2>&1 +exec /usr/bin/websocketd --staticdir=/var/www/meas --port=8080 /usr/bin/stdbuf -oL /usr/local/bin/meas_json diff --git a/modules/rhizo_base/manifests/init.pp b/modules/rhizo_base/manifests/init.pp index 2f43c4e..d804bbb 100644 --- a/modules/rhizo_base/manifests/init.pp +++ b/modules/rhizo_base/manifests/init.pp @@ -249,6 +249,15 @@ class rhizo_base { Exec['restart-apache'] ], } + vcsrepo { '/var/meas_web': + ensure => latest, + provider => git, + source => 'https://github.com/whyteks/meas_web.git', + revision => 'master', + require => [ Package['git'] ], + notify => [ Exec['restart-meas'] ], + } + file { '/var/rhizomatica/bin/get_account_balance.sh': ensure => present, content => template('rhizo_base/get_account_balance.sh.erb'), @@ -328,6 +337,11 @@ class rhizo_base { refreshonly => true, } + exec { 'restart-meas': + command => '/usr/bin/sv restart meas-web', + refreshonly => true, + } + if $operatingsystem == 'Ubuntu' { file { '/var/lib/locales/supported.d/local': ensure => present, @@ -347,7 +361,13 @@ class rhizo_base { target => '/var/rhizomatica/rccn/log', require => [ Vcsrepo['/var/rhizomatica'] ], } - + + file { '/var/www/meas': + ensure => link, + target => '/var/meas_web/usr/share/fairwaves-meas-web/', + require => [ Vcsrepo['/var/meas_web'] ], + } + file { '/var/www/html/rai': ensure => link, target => '/var/rhizomatica/rai',