Commit a54d93b1 by source_reader

added nilmdb configuration

parent ef9c6099
......@@ -38,8 +38,8 @@
class joule {
$pip_url="http://nuc.office:8080/"
$pip_cmd="pip3 install --extra-index-url ${pip_url} --trusted-host nuc.office"
$pip_url="http://puppet:wX27zvbA@pypi.wattsworth.net:8080/"
$pip_cmd="pip3 install --extra-index-url ${pip_url} --trusted-host pypi.wattsworth.net"
$deps = ['libblas-dev', 'liblapack-dev', 'gfortran']
......
<VirtualHost *:80>
WSGIScriptAlias /nilmdb /opt/data/nilmdb.wsgi
WSGIDaemonProcess nilmdb-procgroup threads=32 user=nilmdb group=nilmdb
<Location /nilmdb>
WSGIProcessGroup nilmdb-procgroup
WSGIApplicationGroup nilmdb-appgroup
Require all granted
</Location>
ErrorLog ${APACHE_LOG_DIR}/nilmdb_error.log
CustomLog ${APACHE_LOG_DIR}/nilmdb_access.log combined
</VirtualHost>
\ No newline at end of file
import nilmdb.server
application = nilmdb.server.wsgi_application("/opt/data","/nilmdb")
# == Class: nilmdb
#
# Full description of class nilmdb here.
#
# === Parameters
#
# Document parameters here.
#
# [*sample_parameter*]
# Explanation of what this parameter affects and what it defaults to.
# e.g. "Specify one or more upstream ntp servers as an array."
#
# === Variables
#
# Here you should define a list of variables that this module would require.
#
# [*sample_variable*]
# Explanation of how this variable affects the funtion of this class and if
# it has a default. e.g. "The parameter enc_ntp_servers must be set by the
# External Node Classifier as a comma separated list of hostnames." (Note,
# global variables should be avoided in favor of class parameters as
# of Puppet 2.6.)
#
# === Examples
#
# class { 'nilmdb':
# servers => [ 'pool.ntp.org', 'ntp.local.company.com' ],
# }
# Install nilmdb and nilmtools
#
# === Authors
#
# Author Name <author@domain.com>
# John Donnal donnal@usna.edu
#
# === Copyright
#
# Copyright 2017 Your name here, unless otherwise noted.
# Copyright 2017 John Donnal, unless otherwise noted
#
class nilmdb {
$pip_url="http://puppet:wX27zvbA@pypi.wattsworth.net:8080/"
$pip_cmd="pip2 install --extra-index-url ${pip_url}"
$deps = ['cython','build-essential','python2.7','python2.7-dev','python-setuptools','python-pip',
'python-cherrypy3','python-decorator','python-requests',
'python-dateutil','python-tz','python-progressbar','python-psutil',
'python-simplejson','apache2','libapache2-mod-wsgi']
package{ $deps:
ensure => present,
before => Exec['install_nilmdb']
}
exec{'install_nilmdb':
command => "${pip_cmd} nilmdb nilmtools",
timeout => 0,
path => ["/usr/local/bin","/usr/bin"]
}
user{'nilmdb':
ensure => present,
system => true
}
file{'/etc/apache2/sites-available/10-nilmdb.conf':
source => 'puppet:///modules/nilmdb/10-nilmdb.conf',
owner => root,
group => root,
mode => 644
}
exec{'a2ensite 10-nilmdb.conf':
creates => '/etc/apache2/sites-enabled/10-nilmdb.conf',
path => ['/usr/sbin','/usr/bin'],
subscribe => File['/etc/apache2/sites-available/10-nilmdb.conf'],
notify => Exec['apache2ctl restart']
}
file{'/etc/apache2/sites-enabled/000-default.conf':
ensure => absent,
notify => Exec['apache2ctl restart']
}
exec{'apache2ctl restart':
path => ['/usr/sbin','/usr/bin'],
refreshonly => true,
}
file{'/opt/data':
ensure => directory,
owner => nilmdb,
group => nilmdb,
require => User['nilmdb']
}
file{'/opt/data/nilmdb.wsgi':
ensure => present,
owner => nilmdb,
group => nilmdb,
mode => 644,
source => 'puppet:///modules/nilmdb/nilmdb.wsgi',
require => User['nilmdb'],
notify => Exec['apache2ctl restart']
}
#mod_wsgi tries to access user home directory
#nilmdb is a system account but just create a stub
#directory to satisfy wsgi :P
file{'/home/nilmdb':
ensure => directory,
owner => nilmdb,
group => nilmdb,
notify => Exec['apache2ctl restart']
}
}
......@@ -2,4 +2,5 @@ node 'raspberrypi' {
include python3
include joule
include raspi
include nilmdb
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment