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 24f9f8c..adfbbcc 100644 --- a/modules/rhizo_base/manifests/init.pp +++ b/modules/rhizo_base/manifests/init.pp @@ -240,6 +240,16 @@ class rhizo_base { Exec['restart-smpp'] ], } + 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'), @@ -308,6 +318,12 @@ class rhizo_base { command => '/usr/bin/sv restart smpp', refreshonly => true, } + + exec { 'restart-meas': + command => '/usr/bin/sv restart meas-web', + refreshonly => true, + } + if $operatingsystem == 'Ubuntu' { file { '/var/lib/locales/supported.d/local': @@ -329,6 +345,12 @@ class rhizo_base { 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', diff --git a/modules/rhizo_base/manifests/packages.pp b/modules/rhizo_base/manifests/packages.pp index d16f86f..af0302e 100644 --- a/modules/rhizo_base/manifests/packages.pp +++ b/modules/rhizo_base/manifests/packages.pp @@ -19,7 +19,7 @@ class rhizo_base::packages::common { package { ['mosh', 'git', 'openvpn', 'lm-sensors', 'runit', 'sqlite3', 'libffi-dev', 'apcupsd', 'expect', 'gawk', 'swig', 'g++', - 'python-python-smpplib', 'libcdk5' ]: + 'python-python-smpplib', 'libcdk5', 'websocketd', 'osmo-meas' ]: ensure => installed, require => Class['rhizo_base::apt'], } diff --git a/modules/rhizo_base/manifests/runit.pp b/modules/rhizo_base/manifests/runit.pp index af51296..5a32c55 100644 --- a/modules/rhizo_base/manifests/runit.pp +++ b/modules/rhizo_base/manifests/runit.pp @@ -58,4 +58,10 @@ class rhizo_base::runit { require => [ File['/etc/sv'], Class['rhizo_base::kiwi'] ], } + file { '/etc/service/meas-web': + ensure => link, + target => '/etc/sv/meas-web', + require => [ File['/etc/sv'], Package['websocketd'] ], + } + } \ No newline at end of file